ePrivacy and GPDR Cookie Consent by TermsFeed Generator Home Automation System - SONOFF 4 Channel integration with OpenHAB | OpenHAB - SmartHome | DomoticsDuino - Computer engineer, Smart Home / OpenHAB, Flight Sim and others...
OpenHAB - SmartHome (239 posts)


Home Automation System - SONOFF 4 Channel integration with OpenHAB [Versione in italiano]

by Marco Lamanna

In the previous post, I spoke about my SONOFF 4 channel, describing the physical installation.

Now, this device will help me to drive 4 lights: 1 internal and 3 exterior; of course, OpenHAB will be my control system and MQTT will be the message protocol.

Let's go to setup the SONOFF, using its web interface

The first step will be to setup the module type, using the menĂ¹ Configuration -> Configure Module

Then, in Configuration -> Configure MQTT, we will put the MQTT topic, splitted in TOPIC and FULLTOPIC as TASMOTA ask

In my case the device will use the following topic smarthome/sonoff4ch14/###. TASMOTA will replace ### with the type of message it will be sending (for example cmnd for commands, state for status information etc etc)

No more details on the other configuration options...they are the same as the other SONOFF

Now it's time for OpenHAB...we will add 4 items, one for each light.

Create a new file, called sonoff4ch.items, in the usual folder /etc/openhab2/items; in the file we will write the items configuration:

As you can see, MQTT topic is the same for all items. Only one thing changes...the property name, indexed by a number to indicate the relay number.

Finally, the last step: put the 4 items into a sitemap. So, write down 4 switch into the sitemap file

(these are the 3 items for exterior lights...)

And here is my complete sitemap:

Now let's push some buttons and see what happens.