Hello,
I’m trying to make it possible to turn on my computers witch button on Lovelace.
Typical wake_on_lan solution does’nt work on my system (Docker issue I think),
so i try to utilise OPNSense router i have.
Thanks to hass-opnsense, integration it is possible to send magic packet from router by calling a service.
When i call service like this, it works grat:
service: opnsense.send_wol
data:
entity_id: binary_sensor.stioopnsense_pending_notices_present
interface: lan
mac: 00:1D:7D:03:71:A5
Now i want to call that service by hitting Lovelace button.
I try to add tamplate switch in configuration.yaml but i got error
that i cant put interface and mac parameters after entity_id
The router does not have to send the WOL packet, I have Home Assistant Supervised running on a Raspberry PI 4 and one of the dashboards on there has a button to send the packet for one of my computers to wake it up, it has nothing to do with the router -
And I am using a built-in integration available on home assistant:
In this case it just shows up as a dumb switch, which you can put on a dashboard, that when you switch it on, just stays on which doesn’t make any sense as a switch really - (screen shot below of one of my dashboards):
So then I have this automation which when I click on the lightning bolt to essentially send the WOL packet from my Raspberry PI 4b running Home Assistant Supervised (essentially turning the switch “on”) that just bounces the switch to the off position on it’s own, 1/2 a second afterward:
alias: Wake On Lan Reset
description: >-
As the Wake On Lan switch is turning on only sends a WOL network message
(and it really isn't a switch), since there is no such thing as "Off" with the
way it really functions, this automation switches it back to "Off"
automatically - after .5 sec - (so it is ready to resend the message again).
trigger:
- platform: state
entity_id:
- switch.wake_on_lan
to: "on"
condition: []
action:
- delay:
hours: 0
minutes: 0
seconds: 0.5
milliseconds: 0
- service: switch.turn_off
data: {}
target:
entity_id: switch.wake_on_lan
mode: single