Hi all
Apologies if this has been covered, I did search for it but couldn’t find this specific issue anywhere.
I have set up WOL for 2 PC’s. One is a Windows PC and one is Ubuntu. Both wake up fine, but only the Windows PC will turn off. The strange thing is I have set both up with a small bash script each, and the Ubuntu PC will turn off if I run the script from the command line. It just won’t turn off via the switch in HA.
Here is the script I am calling:
ssh [email protected] sudo shutdown -h now
And here it is in my configuration.yaml file:
shell_command:
pcoff: /home/pi/scripts/pcoff.sh
ubuntuoff: /home/pi/scripts/ubuntuoff.sh
…
switch:
- platform: wake_on_lan
name: "Wake PC"
mac_address: "AA-BB-CC-DD-EE-FF"
host: "192.168.0.79"
turn_off:
service: shell_command.pcoff
- platform: wake_on_lan
name: "Wake Ubuntu"
mac_address: "AA-BB-CC-DD-EE-FG"
host: "192.168.0.78"
turn_off:
service: shell_command.ubuntuoff
Similarly if I call the service from HA Developer Tools it ignores me, whereas calling the shell_command.pcoff
works just fine. Clearly there’s a problem with HA calling the script since the script works from the command line, but when I switched the logger on and ran a tail -f
command on the log file it reports the script as running OK:
17-07-15 10:34:17 DEBUG (MainThread) [homeassistant.components.websocket_api] WS 1854565904: Received {'id': 11, 'domain': 'homeassistant', 'service': 'turn_off', 'type': 'call_service', 'service_data': {'entity_id': 'switch.wake_ubuntu'}}
17-07-15 10:34:17 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=homeassistant, service=turn_off, service_call_id=1976876400-3, service_data=entity_id=switch.wake_ubuntu>
17-07-15 10:34:17 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=switch, service=turn_off, service_call_id=1976876400-4, service_data=entity_id=['switch.wake_ubuntu']>
17-07-15 10:34:17 INFO (MainThread) [homeassistant.helpers.script] Running script
17-07-15 10:34:17 INFO (MainThread) [homeassistant.helpers.script] Executing step call service
17-07-15 10:34:17 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=shell_command, service=ubuntuoff, service_call_id=1976876400-5, service_data=>
17-07-15 10:34:17 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1976876400-5>
17-07-15 10:34:17 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1976876400-4>
17-07-15 10:34:17 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1976876400-3>
17-07-15 10:34:17 DEBUG (MainThread) [homeassistant.components.websocket_api] WS 1854565904: Sending {'id': 11, 'result': None, 'success': True, 'type': 'result'}
So now I’m a bit lost! Any ideas gratefully received.
Regards,
Simon