With the ‘on’ function from WOL and the ‘off’ function from rpc shutdown I can build a switch for my PC.
So I have a switch for the ‘turn_on’ function and I can call the rpc shutdown from the template switch. Finally I’ve made a binary_sensor for showing the state of the switch.
binary_sensor:
- platform: ping
name: kennethspc
host: !secret kennethspcip
scan_interval: 15
switch:
- platform: wake_on_lan
name: 'Turn on Kenneths PC'
mac: !secret kennethspc
host: !secret kennethspcip
- platform: template
switches:
kenneths_pc:
friendly_name: "Kenneths PC"
value_template: "{{ is_state('binary_sensor.kennethspc', 'on') }}"
icon_template: mdi:desktop-classic
turn_on:
service: switch.turn_on
data:
entity_id: switch.turn_on_kenneths_pc
turn_off:
service: hassio.addon_stdin
data:
addon: core_rpc_shutdown
input: KennethsPC
This seems to work nicely, but is it possible to have the wake_on_lan switch inside the template switch so I could skip that one as a seperate switch?