It's a type of Planche
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

screensaver_end.sh 766B

123456789101112
  1. #!/usr/bin/env bash
  2. # homeassistant_access_token=""
  3. homeassistant_url="http://homeassistant.natrinicle.com:8123/api/states"
  4. homeassistant_screensaver_binary_sensor="${homeassistant_url}/binary_sensor.$(hostname | tr -s '-' '_' | tr '[:upper:]' '[:lower:]')_screen_locked"
  5. ps -e -o stat,command,pid | grep '^T' | grep -P "(firefox|atom)" | awk '{print $NF}' | xargs -P0 -I {} kill -CONT {}
  6. # Update Homeassistant
  7. if [ -n "${homeassistant_access_token}" ] && [ -n "${homeassistant_screensaver_binary_sensor}" ]; then
  8. curl -X POST -H "Authorization: Bearer ${homeassistant_access_token}" -H "Content-Type: application/json" -d "{\"state\": \"off\", \"attributes\": {\"friendly_name\": \"$(hostname) Screensaver\"}}" "${homeassistant_screensaver_binary_sensor}"
  9. fi