REST-light: Seamless 433Mhz Socket integration for OpenHAB

REST-light is a container-based microservices to control 433Mhz Sockets on a RaspberryPi or similar single board computer. It is essentially a HTTP-Wrapper around the famous 433Utils project that runs in a docker container.

While we have seen numerous proposals on how to integrate 433Mhz Sockets into OpenHAB (e.g. using the exec binding), REST-light offers some unique benefits:

  • Simple configuration in OpenHAB, no additional Bindings or Add-Ons needed.
  • Configuration can be done completely using the OpenHAB UI/Web-Interface. No need for textual definitions. You’ll just need to add a single rule and items for the sockets you want to control.
  • No need to install or build the 433Utils Project or its dependencies, REST-light comes in a single docker-container
  • Minimal latency between triggering an action and actual execution
  • OpenHAB does not need to run on the same Device that controls the sockets, e.g. to use multiple Senders to cover bigger areas or to use a more powerful device for OpenHAB than e.g. a Raspberry Pi

How to Use:

  • Run REST-light on the same network as OpenHAB - see the GitHub Page for detailed instructions on how to deploy.

The following steps can either be done manually using the OpenHAB UI or using RESTlight.items file found below:

  • Add the RESTlight.rules rule (see below) to OpenHAB and replace the IP-Adress and API-Key with the values from your REST-light setup.
  • Add a group gREST_light to OpenHAB and add your 433Mhz Devices as Switches to this group. The Device name has to be in the format of example_<SYSTEM_CODE>_<UNIT_CODE> and is used to determine which device is controlled. The Label can then be used to add a more meaningful display-name in the UI.




See Docker Hub as well as the GitHub Page for a more detailed Version overview.

I’ve used the solution myself for over a month now without any issues. Nevertheless, there is always room for improvements, so contributions are very welcome :slight_smile:

Version 2022.01.16-0801

  • initial release


See the GitHub Page as the main source of Resources. Additional ideas are welcome!


Group:Switch:OR(OFF, ON)    gREST_light                 "REST-light"    <light>                            ["Location"]

Switch                      RESTLight_10000_1           "Light"         <light>   (mygroup, gREST_light)   ["Switch"]
Switch                      RESTLight_01000_3           "Light2"        <light>   (mygroup, gREST_light)   ["Switch"]
Switch                      RESTLight_00100_3           "Light3"        <light>   (mygroup, gREST_light)   ["Switch"]


rule "REST_light"
    Member of gREST_light received command
    logInfo("REST_light", "Member " + + " to " + receivedCommand)

    try {
      // receive system & unit code from item name
      val sys_num ="_").get(1)
      val unit_num ="_").get(2)

      var String state = ""
      if(receivedCommand == ON) {
        state = "1"
      } if(receivedCommand == OFF) {
        state = "0"

      var String jsonstring = (
              '{"api_key" : "<INSERT KEY HERE>", "system_code" : "' + 
              sys_num + '", "unit_code" : "' + unit_num + '", "state" : "' + state + '"}'

      sendHttpPostRequest("http://<INSERT IP HERE>:4242/send", "application/json", jsonstring.toString, 5000)
      logInfo("REST_light", jsonstring.toString)
      logInfo("REST_light", "Finished command!")

    } catch(Throwable t) {
      logInfo("REST_light", "Caught exception during attempt to contact REST_light API!")

1 Like