I have an alarm system that I can control from a switch on/off but the Home Assistant doesn’t know if someone in my family turns on or off the alarm via radio controller.
So i installed a led sensor with ESPhome to know the light variation of the alarm system monitoring the built-in light.
Now I just want to update the switch status directly from the light variation entity.
Can you help me?
In the Template Switch page (Template Switch - Home Assistant) it is described the exact problem that I want to solve but I’m not able to set the template.
I just want to overwrite the switch status using the light entity variation
So is the LED sensor exposed in home assistant? You can use that sensor and create an automation. when the state of the LED changes, you know the alarm is armed. Then you can run the switch.turn_on action to change the switch in home assistant.
I can’t use what you suggest because I don’t need to turn on the alarm. The alarm is already on (maybe activated by radio controller) but in Home Assistant appears as off.
Can you post the template you have now or have you not created one? It’s just a matter of setting the state to be the state of your LED using something like this in your template:
But the script is overkill, you could have done a simple automation, which you still can using the LED value above/below or create the binary sensor as above and use that as your condition.
So let me explain better because I’m a new in HA and I want to learn
So I have my alarm switch in HA (called switch.antifurto). I can use it to turn on and off the alarm via HA but it’s status sometimes is not correct because I can turn on/off the alarm via radio controller and the integration is not able to update the status.
Using a light sensor (called sensor.nodemcu_allarme_led_allarme) I can detect when the alarm light is on/off.
What I want to have at the end is to update the status of switch.antifurto using the second sensor.
Can you tell me step by step how to do that?
Using the script that I shared with you I can’t update the status; it update the status of a helper that I created following a YouTube video.