Hello
I am trying to work out what methodology is required to achieve my outcome of placing a single button or toggle on dashboard to turn on/off two devices.
I have a NUC & NAS I can currently turn both on via WoL switches and turn both off via Rest Commands utilising URL’s.
What would be best practice to fold these 2x WoL’s and 2x Rest Commands to a button or toggle so that the on state wakes both devices and off state shuts them down?
Any advice appreciated, I’m not having any success with my attempts of triggering an if/then automation from a button press.
Yeah they will be turned on/off together. The NUC hosts my Plex Server and the NAS has the media content.
I currently have two automations that turn on and off on time schedules 18:00-22:00. The new function I’m looking to add is for other adhoc times.
The Restful commands aren’t switches, I don’t even see them in UI as entities. They only appear as services.
That is why Tom suggested a script. You can call services from there.
An, ok. So one script that calls both WoL switches and Restful services and have the button on the dashboard as the trigger with tap action?
yes sir! Just reference the script in the tap action.
1 Like
Thank you. I will try this now.
Does this script look right?
sequence:
- service: switch.turn_on
metadata: {}
data: {}
target:
entity_id:
- switch.nas
- switch.plex
- service: rest_command.nuc_shutdown
data: {}
- service: rest_command.nas_shutdown
data: {}
mode: single
icon: phu:plex
The tap action is turning on both devices but the button status remains off. Tapping again after devices are on is not turning them off?
tom_l
April 28, 2024, 3:29am
12
sequence:
- service: switch.turn_on
metadata: {}
data: {}
target:
entity_id: ### <--- Remove this duplicate ####
entity_id:
- switch.nas
- switch.plex
Also change the service to switch.toggle
of you want on/off with each tap.
Your rest commands will only turn off though. Do you have rest commands for on?
The entity ids are WoL switches, one for each device, the rest commands are to shutdown. I’ll adjust to toogle.
tom_l
April 28, 2024, 4:05am
14
That will toggle your switches but these are still only shutdown with no way to turn on:
1 Like
So it’s not possible to have a single button toggle my devices on and off, on with wake on lan and off with rest command?
I’d setup the WOL switch integration with the turn_off option set to run the rest command. Then group those.
2 Likes
tom_l
April 28, 2024, 4:22am
17
Wait, so these are the same devices?
Just add the rest commands to the WoL switches. They have the option for an off command:
https://www.home-assistant.io/integrations/wake_on_lan/#turn_off
EDIT: beaten to it by Ryan.
2 Likes
Is the Plex a movie service on the NAS or an actual device? You have a NUC restful command, but a switch called Plex so I was bit confused.
When I group them, assuming I call the group switch from dashboard button? Do I use tap or toggle for button?
I need to rename that switch. Plex is running g on the NUC. I’ll rename WoL switch to NUC and call the group switch Plex.