Addressing a wake on lan switch in an automation

Hi apologies if this is covered my search fu is clearly not good enough to reveal answers.

I have successfully created a wake on lan switch using yaml that let’s my switch on and hibernate my pc via hass.agent from a switch on my dashboard . All good so far. It works exactly like I want on the dashboard.

The problem is that, now I want to use a physical button to toggle the state of this switch. I have a zigbee button I want to use. If the wake on lan switch were like any other device, e.g. a light, I could do this easily.

Problem is that my yaml generated wake on lan switch doesn’t appear in the devices list so I can’t work out how to toggle it with the automations UI. As far as I can tell, only an entity has been generated and I don’t know how to access it from UI. Is there some matter device it belongs to? Another missing piece of the puzzle is that the PC switch is also not made available to Alexa, I guess because it is not registered as a device.

Is there a way I can generate the pc as a new device (not the hass.agent device) with my wake on lan switch as an entity under it so that it shows as any other device in the devices list and is visible to Alexa.

Thanks in advance for any help and apologies if I missed a post that answers this.

Cheers

You can still control the switch with automations, you just use the call service action, instead of a device action.

action:
  - service: switch.turn_on
    entity_id: switch.my_pc

Thanks that works. Also realised the switch is showing on alexa devices but I had a conflicting name which was preventing it from working as expected.

1 Like

You probably don’t actually want it in Alexa though - just for information.

It’s very easy to accidentally turn everything on or off with a voice assistant, and for lights etc that’s not the end of the world. But accidentally turning off a computer that was in the middle of doing something, when really just wanted one light to turn off, but you were misheard (or heard correctly, but the basic AI behind the scenes still did the wrong thing) - can be a pain. I am very very cautious what devices I make available to my Google Assistant, a very small subset of all the things that could be available.

It doesn’t help either when someone knows you have a voice assistant, and decides to prank you by issuing the command, either in person, or while you are in a video call or a phone call on speaker.