Skip to content

OpenHAB integration

Florian edited this page Oct 2, 2018 · 7 revisions

The integration has to be done in the sitemap and the item file. On the sitemap file just add a normal switch like below : Switch item=PlugSwitch1

Switch item=IRtest

On the item file we will precise how OpenHAB will link the switch to the mqtt subject, the following text must be in one line :

Switch PlugSwitch1 "Test" {mqtt=">[broker: home/OpenMQTTGateway/MQTTto433:command:ON:1312081], >[broker:home/OpenMQTTGateway/MQTTto433:command:OFF:1312084], <[broker: home/OpenMQTTGateway/433toMQTT:state:ON:1312081], <[broker: home/OpenMQTTGateway/433toMQTT:state:OFF:1312084]", autoupdate="false"}

Switch IRtest "IR" <light> (GF_JA,Plugsm) {mqtt=">[broker:home/OpenMQTTGateway/commands/IR_GC:command:ON:38000,1,1,171,171,21,64,21,21,21,21,21,21,21,21,21,21,21,21,21,64,21,64,21,21,21,21,21,21,21,21,21,21,21,21,21,64,21,21,21,21,21,21,21,64,21,21,21,21,21,21,21,21,21,64,21,64,21,64,21,21,21,64,21,64,21,64,21,64,21,1114]"}

Where broker is the name of your broker defined in your openhab config file.

home/OpenMQTTGateway/MQTTto433 is the subject for outgoing states and home/OpenMQTTGateway/433toMQTT for the incomming command, home/OpenMQTTGateway/MQTTto433 is either changed by the acknowledgment of the gateway or by a physical action on a remote sending the defined code 1312081 or 1312084.

This definition enable to power ON and OFF the switch from OpenHAB and also to update the state of the switch into OpenHAB if you use the remote control.

For IR the principe is the same just change the subject and the values Switch PlugSwitch2 "Test2" {mqtt=">[broker: home/OpenMQTTGateway/commands/IR_SAMSUNG:command:ON:3772793023], >[broker:home/OpenMQTTGateway/commands/IR_SAMSUNG:command:OFF:3772793023]"}

I removed the incoming commands begining by "<" due to the fact that for IR it is less interesting compared to RF to have the incoming signal to update the switch test. Mainly due to the directional characteristic of infrared signals.

Clone this wiki locally
You can’t perform that action at this time.