[SOLVED] Switch off triggering button entity

Hello!

I setup Wake on LAN as a switch and it works as expected.

However, I want to make the off part of the switch, turn off my PC; I have a separate button which already does this as I am using windows HASS.Agent and works great.

I just wondered if anyone can help me with the config for getting the off side of the switch to run this entity?

There’s an example in the documents:

switch:
  - platform: wake_on_lan
    name: "TARGET"
    ...
    turn_off:
      service: # put whatever service your off button calls here.

It would have helped if you had included the configuration of both your WoL switch and button in your post.

Hi Tom,

I tried this but didnt work, I get the error Failed to call service switch/turn_off. Unable to find service button.morgan_pc2_shutdown

I’m probably making a really simple and stupid mistake as I’m only 72 hours into using home assistant but this was my switch config (censored mac address just incase):

wake_on_lan:

switch:
  - platform: wake_on_lan
    mac: **-**-**-**-**-**
    name: “Morgans PC2”
    turn_off:
      service: button.morgan_pc2_shutdown

That isn’t a service. It is an entity. This is a service:

    turn_off:
      service: button.press
      target:
        entity_id: button.morgan_pc2_shutdown
2 Likes