Im trying to turn on a switch with automation, does anyone have an idea why this is not working ?
- alias: "Turn the TV on"
trigger:
- platform: state
entity_id: binary_sensor.tv_power
to: 'on'
action:
service: switch.turn_on
entity_id: switch.wake_lg_tv
Yes I have reloaded Automations and also restarted the server after writing the automation.
And yes I am using the correct entity_id, see below
My binary sensor is changing to on I can see that on the states page.
My switch is a command_line switch with the following configuration:
switch WOL:
- platform: command_line
switches:
wake_lg_tv:
command_on: ssh -i (Etc.. I have tested the command from within my Docker container and it works)
Actually I cannot control it manually, I just assumed it worked which seems a bit stupid now I think of it. So i guess something is wrong with my command_line switch, but I have followed the documentation on the home page. Can you see anything wrong with it ?
I have also tried that. But I believe it didn’t work because my server is connected to the network via wlan, and the wake on lan switch uses Ethernet to send the packet, and that cannot be changed. So I use etherwake on my host PC because with that I can specify it to use wlan.
But what I really want is to turn on my tv using automation.
And my tv is connected with the WebOs component and with that I can turn on the tv using wake on lan. But when I try and do an automation with action “media_player.turn_on” nothing happens.
So, you can run the command from within the docker container but not get an automation to do so.
I struggled for ages with a shell command to delete old backups. Never got a solution. Some things just aren’t possible in the hassio environment, possibly due to permission problems, I just don’t know.
Hurray, I finally got it working after weeks of trying to turn my TV on with automation.
The issue was that I needed to run the etherwake command on the host with sudo, which normally requires a password. But I added a line in sudo visudo so that I can run sudo commands without passords for the specific user I log on to the host with.
Now I should be able to set up Siri to turn the TV on via mqtt, which was my original goal.