#HTTP get toggle switches

14 messages · Page 1 of 1 (latest)

cosmic creek
#

hello i wanted to ask about http get toggle switches currently i use them to control a few stuff in an online game called rust to control smart switches (ingame item) how i have it set up atm is that when the toggle switch is on it sends an http get to a specific url and when its off it sends an http get to an other url now this set up works great but there is one flaw with it the toggle switch might be on in ha but the smart switch ingame might be off if turned off from ingame or in any other way so what i want to do is have the toggle in ha be synced with the ingame switch through an http get url that tells the status of the ingame switch i am not sure if this is possible

warped turtle
#

Wow that was a long sentence.

#

But you need an automation to fetch the status periodically

cosmic creek
#

so make an automation that uses http get to get the status of the switch via the url and depending on if it returns on or off turn on or off the toggle?

#

oh man thats going to be a lot of automations

#

2 per switch

#

also can i make these automations through the ui or do i need to make them in the config file

fathom carbon
#

Make one pair in the UI first. Then once you are satisfied with them, use them as a basis to make a blueprint that you can just reuse the logic and sub in the relevant entities.

cosmic creek
#

so i dont have to deal with the config file at all?

#

also how do i make a triger that fires when the http get changes

fathom carbon
#

To make the initial pair, you can try doing it in the UI. But to convert the pair into blueprints, you'd need to write yaml.

#

I think you would need an automation that triggers regularly eg. Every 1min, to get the state of the switch. I.e. to poll the http endpoint, unless you can adjust the endpoint to push updates to HA?

cosmic creek
#

yea i tried but i have no idea how to do that in ha

#

i guess if i need to use these ingame switches in automations like turning them on i can tell ha to turn them off and back on if i need it to turn on and the opposite if i want them off