Use Dimmer-item with modbus binding OH2

Object: To control dimmers in Carlo Gavazzi smart-house controller from openhab via modbus TCP

Hardware:
Carlo Gavazzi controller SH2WEB24. A controller that can handle all automation I want, but only with smart-house hardware. I use OpenHab on a RPI to get CG smart-house connected to other devices and services, for example simple things like network binding to let smart-house know which phones are home or if the TV is ON. The automation (more or less equivalent to “rules” in openhab) is done in the SH2WEB controller.

To control switches has worked fine in OH1 as well, but dimmers was tricky. Since the update of modbus-binding to OH2 (Modbus binding for openHAB-2) the dimmers work perfect, so I can now control them from Openhabs app, Apple Home-kit and Siri, which is awesome! This is what this small tutorial is about.

Extract from modbus.cfg (folder services)
I left all parameters like polling etc as default .
Then add my modbus-slaves like this. I have about 180 slaves defined (dimmers, digital objects, temperature-objects)

# smart-house (Fx) Hall - Dimmer vita väggen_Status
modbus:tcp.slave71.connection=192.168.1.198:502
modbus:tcp.slave71.type=holding
modbus:tcp.slave71.id=1
modbus:tcp.slave71.start=2975
modbus:tcp.slave71.length=1
modbus:tcp.slave71.valuetype=uint16

# smart-house (Fx) Hall - Dimmer Bruna väggen_Status
modbus:tcp.slave72.connection=192.168.1.198:502
modbus:tcp.slave72.type=holding
modbus:tcp.slave72.id=1
modbus:tcp.slave72.start=3052
modbus:tcp.slave72.length=1
modbus:tcp.slave72.valuetype=uint16

# smart-house (Fx) Hall - Dimmer Entré Tak_Status
modbus:tcp.slave73.connection=192.168.1.198:502
modbus:tcp.slave73.type=holding
modbus:tcp.slave73.id=1
modbus:tcp.slave73.start=3129
modbus:tcp.slave73.length=1
modbus:tcp.slave73.valuetype=uint16

Next, the items-file:

Dimmer Fx_Hall__Dimmer_vita_vggen_Status  "Hall-Dimmer vita väggen"  (Hall,Dimbart_ljus) ["Lighting"] {modbus="slave71:0"}          
Dimmer Fx_Hall__Dimmer_Bruna_vggen_Status "Hall-Dimmer Bruna väggen" (Hall,Dimbart_ljus) ["Lighting"] {modbus="slave72:0"}          
Dimmer Fx_Hall__Dimmer_Entr_Tak_Status    "Hall-Dimmer Entré Tak"    (Hall,Dimbart_ljus) ["Lighting"] {modbus="slave73:0"}          

The sitemap:

sitemap hemma label="Hemma" {
	Frame label="Funktioner" {
		Group item=Ljusfunktion	
		Group item=Dimbart_ljus	
		Group item=Temperaturzon
	}
	Frame label="Olika platser" {
		Group item=Vardagsrum
		Group item=Hall
		
	}
}

And…thats it!

/Per

1 Like

Just to clarify one thing

You are linking to my post which refers to the alpha version of Modbus binding for openHAB2. The major difference to the old binding (used here) is the introduction of things instead of cfg file configuration.

The old binding is the stable version, and yes, it works with openHAB2, similarly to many other bindings originally developed for openHAB1.

In this thread, some issues might occurr with Dimmer not updating… it’s weird that you did not have to do the “transformation trick” as described in the other thread.