Change state of group items from homebridge


it might be a more to homebridge oriented question but maybe it also fits in here quite well. Let’s see.

I use both openHAB and Homebridge in parallel. I use Homebridge mainly to control my roller shutters with Siri or via the Homekit app. What does not work unfortunately in the Homekit app is to control all roller shutters which are facing the north/east/south or west side.
I can define “zones” like “Ground floor”, “1st floor” and so on. When I tell Siri “Open all shutters on 1st floor” it works like that. However, I cannot define a “south” zone in parallel since a shutter that is already assigned to the “1st floor” zone cannot be assigned to another zone.

My idea was to use groups in openHAB and link it to homebridge via homebridge-openhab2-complete.

I created a group in openHAB Group:Rollershutter:MIN gJalousienSued and tried to link it with openhab2-complete. However, the type windowcovering expects a roller shutter and not a group as can be seen in the logs from openhab2-complete: Unable to add accessory Jalousien Südseite: Error: gJalousienSued's type (Group) is not as expected (["Rollershutter","Number","Switch"]), skipping.

Now I did something very ugly which works but I find it super ugly and my question is whether you have better ideas how to solve this. I created a virtual item Number v_JalousienSuedseite "Zustand Jalousien Südseite" which can be read and written by/from homebridge via openhab2-complete. This is the item I see on the Homekit app on my iPhone which represents the state of all shutters on the south side.

And this is what I do on openHAB to keep it synced:

rule "Fenster: Suedseite von Homebridge aktualisieren"
	Item v_JalousienSuedseite received command
	logInfo("Fenster: Suedseite von Homebridge aktualisieren", "Alle Jalousien verfahren auf: " +v_JalousienSuedseite.state)
	gJalousienSued.sendCommand(v_JalousienSuedseite.state as Number)

rule "Fenster: Suedseite von openHAB aktualisieren"
        Item gJalousienSued changed
	v_JalousienSuedseite.postUpdate((gJalousienSued.state as DecimalType).intValue)
	logInfo("Fenster: Suedseite von openHAB aktualisieren", "Eine oder mehrere Jalousien der Südseite wurde(n) verfahren. gJalousienSued.state: " +gJalousienSued.state)

Well… I do not have a good feeling about this. As I said, after a first smoke test it worked but I fear that there can be some very ugly synchronization issues. What do you think?

A dummy Item worked by rules seems a reasonable workaround.

I expect ‘Group’ types are reserved for some other purpose in the Homekit code, e.g. representing a thermostat or suchlike.

1 Like

OK, thanks for the feedback! After 2 days I must say that it works actually quite well.