Button Switch 433Mhz + OpenHAB

What could be difficult to implement another switch Item? Actually when we find solution or when we purchase buttons it is easy. However this kind of button can work in 2 modes similar like previously described Remote 433MHz Switch . As reminder we may want to configure it as:

  • one push ON, second push OFF – toggle
  • push button and keep state ON until release

I need first option. I would like to install button switch for turning on/off my desk lamp which has installed Sonoff Basic installed instead of standard switch.

Hardware

OpenHAB configuration

As my button works using 433 MHz wireless I combined it with Sonoff RF Bridge to capture signal and send MQTT notification to OpenHAB.

I have clicked button multiple times and let Sonoff RF Bridge capture signal in console. In my case “Data” values were static. I wrote down to use it in my existing OpenHAB thing configuration.

.things

I add thing element to my existing configuration. We use specific code value to be captured.

.items

We have to create virtual Item that will track state of the button switch. It is String type as we just wants to collect Data value. (HINT: Do not use “-” in Item names. It is forbidden)

.rules

Yes, magic happens in rule. Unfortunately we can’t make it using standard settings. In short once Item button1_rf receives an update we check for the code and if matches perform opposite action to the current state.

I also implemented Sonoff T0 Wall switch (sonoffwall3_p3) that uses for the same purpose – control Desktop Lamp so button switch should control the same.

Code can be re-used for multi button switch which generates separate codes for any. You have to add additional “case <code>:” section. I hope you find this helpful.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *