1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#!/usr/bin/bash echo "Starting..." echo "Device: ${device}" echo "Scanner: ${scanner}" echo "Server: ${server}" while [ true ] do pidof "$scanner" status="$?" if [ $status -eq 0 ] then hass-cli --server ${server} state turn_on ${device} fi sleep 5 done