Switch device dependency

Hi all

I currently have two switches (relevant to this topic) defined:

  • A wake_on_lan switch which will power up and (by a webhook) shut down my PC
  • A RESTful switch which uses an endpoint on my PC.

Obviously, the RESTful switch is dependant on my PC being available. Is there any way to:

  1. Stop polling the REST endpoint when the PC switch is off and just assume it is OFF, and/or
  2. Ensure the PC is on before trying to turn the REST switch on?

Thanks in advance

Set a really long polling interval for the rest sensor (years).

Use a time pattern triggered automation to update the rest sensor with the homeassistant.update_entity service.

Prevent this from happening with a state condition based on the WoL switch state.

In your rest sensor value template also take into account the WoL switch state (state = โ€˜offโ€™ if WoL is off).

You may also have to add a state trigger to the automation when the WoL switch goes on โ†’ off, to ensure the restful off state gets applied.

1 Like

Brilliant, thank you so much.