This drives me crazy … I cannot get the state of a Group:Contact Item into KNX.
I have three (zigbee based) window contacts (Things), linked into openhab 3 via zigbee2mqtt, like so:
# -----------------------------------
# Dirk's Office (BD)
# --------------------
- id: BDW1
channelTypeUID: mqtt:contact
label: Window Right Dirk
description: null
configuration:
stateTopic: z2m/BDW1
transformationPattern: JSONPATH:$.contact
off: "true"
on: "false"
- id: BDW2
channelTypeUID: mqtt:contact
label: Window Left Dirk
description: null
configuration:
stateTopic: z2m/BDW2
transformationPattern: JSONPATH:$.contact
off: "true"
on: "false"
# --------------------
# Hervé's Office (BH)
# --------------------
- id: BHW1
channelTypeUID: mqtt:contact
label: Window Hervé
description: null
configuration:
stateTopic: z2m/BHW1
transformationPattern: JSONPATH:$.contact
off: "true"
on: "false"
#
I want to channel the contact state (OPEN/CLOSED
) as binary information to a KNX group address as (false/true
), for example to feed into a room thermostat’s window contact. To that end, I have created two virtual KNX Things of contact-control type, along with a Thing that will hold the number of open windows, like so:
UID: knx:device:_:__W
label: KNX Windows
thingTypeUID: knx:device
configuration:
pingInterval: 600
readInterval: 0
fetch: false
bridgeUID: knx:ip:_
channels:
# SECOND FLOOR
# -----------------------------------
# Windows open
# --------------------
- id: _2W0_
channelTypeUID: knx:number-control
label: Windows 2nd floor
description: Virtual for z2m
configuration:
ga: 9.001:6/2/5
- id: BDW0_
channelTypeUID: knx:contact-control
label: Windows Dirk
description: Virtual for z2m, BDW1 || BDW2
configuration:
ga: 1.009:6/2/15
- id: BHW0_
channelTypeUID: knx:contact-control
label: Window Hervé
description: Virtual for z2m
configuration:
ga: 1.009:6/2/25
If there is only window (contact) per room, I’m creating a single Item, linking the zigbee2mqtt contact Thing with the KNX contact-control Thing:
Contact OfficeHerve_Window "Window" <window> (OfficeHerve, SecondFloor_Windows, WindowContact) ["Window"]
{channel="mqtt:topic:_:__W:BHW1", channel="knx:device:_:__W:BHW0_"}
If there are several window (contact)s per room, I’m creating one Item per contact linked to the zigbee2mqtt sensor, plus a Windows Item per room, which is OPEN
, when at least one of the contacts in the room is OPEN
(i.e. logical OR) and which links to the virtual KNX contact-control channel.
Group:Contact:OR(OPEN,CLOSED) OfficeDirk_Windows "Windows" <window> (OfficeDirk)
{channel="knx:device:_:__W:BDW0_"}
Contact OfficeDirk_WindowRight "Window Right" <window> (OfficeDirk, OfficeDirk_Windows, SecondFloor_Windows, WindowContact) ["Window"]
{channel="mqtt:topic:_:__W:BDW1"}
Contact OfficeDirk_WindowLeft "Window Left" <window> (OfficeDirk, OfficeDirk_Windows, SecondFloor_Windows, WindowContact) ["Window"]
{channel="mqtt:topic:_:__W:BDW2"}
An additional Item counts the OPEN windows:
Group:Number:SUM SecondFloor_Windows "Windows Open" <window> (SecondFloor)
{channel="knx:device:_:__W:_2W0_"}
This works well on openhab and the UI. The Items do what they should:
2022-10-04 19:44:06.491 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'OfficeDirk_WindowLeft' changed from CLOSED to OPEN
2022-10-04 19:44:06.518 [INFO ] [hab.event.GroupItemStateChangedEvent] - Item 'SecondFloor_Windows' changed from 1 to 2 through OfficeDirk_WindowLeft
2022-10-04 19:44:06.528 [INFO ] [hab.event.GroupItemStateChangedEvent] - Item 'OfficeDirk_Windows' changed from CLOSED to UNDEF through OfficeDirk_WindowLeft
2022-10-04 19:44:06.491 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'OfficeDirk_WindowLeft' changed from CLOSED to OPEN
2022-10-04 19:44:06.518 [INFO ] [hab.event.GroupItemStateChangedEvent] - Item 'SecondFloor_Windows' changed from 1 to 2 through OfficeDirk_WindowLeft
2022-10-04 19:44:06.528 [INFO ] [hab.event.GroupItemStateChangedEvent] - Item 'OfficeDirk_Windows' changed from CLOSED to OPEN through OfficeDirk_WindowLeft
The ‘simple’ contact gets relayed into the KNX bus, but the 'OR’ed multiple contact does not:
Any help on what I’m doing wrong here? I have modified the GA types between 1.009, 1.019 and 1.001 types both in the Thing definition and ETS. Somehow, the simple Item is written to the KNX bus, while the Group Item is not.