Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 105753

Tracking rocker switch position using event trigger

$
0
0

Hi,

I recently installed a Hue wall switch module and have had success using the Hue integration and event triggers to create an automation that turns on/off my lights everytime a flick my traditional light switch. I do this rather than just using the Hue app as I like to use the values from my circadian lighting sensors to set the lights at the right temperature and brightness straight away (and for the other possibilities it opens up).

As a next step what I would love to be able to do is track the position of my light switch (i.e. whether it’s in the up or down, on/off, position). This would allow me to effectively force the light switch to always be in the logical position. For example if I switch the lights on using my phone, and the light switch remains in the off position, to turns the lights off using the switch I could make it so that I have to to flick it to the on and then back to the off position.

To do this I thought I could use the event trigger to and some conditions to set a binary sensors state to “on” if HA detects the event and the sensor is currently “off” and to “off” if HA detects the event and the sensor is currently “on”.

However I’ve hit a bit of a wall with this. I can’t work out how to create a custom binary sensor with a manually set initial state. I am then unsure how to use the trigger template or an automation to update that sensor based on the event and its current state. After struggling I thought maybe I could use Node Red. I can pick up the right event in Node Red, but then can’t work out how to pass that along to a function that takes an initial value (e.g. “on”) and switches it to “off” and the other way round each time it gets triggered.

Has anyone else had any success doing something like this?

I would say I’m a fairly beginner level user of HA and Node Red, so apologies if I’m missing obvious solutions here.

Thanks,

Peter

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 105753

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>