I use OH 2.5.4 on a PC Engines Board running ubuntu 20.04
I have a modbus-conection to my intrusion-system to get information about door and window contacts. To link to a readable format i use the following .map
A Contact type Item can have only states OPEN and CLOSED (well, and NULL or UNDEF)
How would you like to to map your six different states to those two choices?
I think I would create another modbus data Thing, using the same register, but with a different MAP to your choice of OPEN/CLOSED, and link this new data Thing to a Contact Item for Homekit to look at.
HomeKit can use string item as ContactSensor but it expects value “Open” or “Opened” for OPEN, everything else considered as CLOSED. currently these values, “Open” and “Opened” cannot be changed or configured.
What you can do is to create a new contact item for homekit and a rule to updated it.
e.g.
item
Contact door "Door" ["ContactSensor"]
and rule
rule "AL_RK_EINGANG received update"
when
Item AL_RK_EINGANG received update
then
if(AL_RK_EINGANG.state.toString.contains("offen")) {
door.postUpdate(OPEN)
}
else {
door.postUpdate(CLOSED)
}
end