Window shutter contact in Homekit?

I’m wondering how to make a window shutter contact available in Homekit. The documentation does not specifically address window shutter contacts, so I tried Switchable, but this results in

[ERROR] [ssories.AbstractHomekitAccessoryImpl] - Type BedroomWindow_ContactState is a org.eclipse.smarthome.core.library.items.ContactItem instead of the expected org.eclipse.smarthome.core.library.items.SwitchItem

So, has anyone been able to use shutter contacts with Homekit?Could it be an option to simply allow ContactItem to be used for (cast) SwitchItem in the binding?

You could try to change your Item type from Contact to Switch and use a MAP transformation:


can you post your current Contact (BedroomWindow_ContactState) Item config?

Ps: How to use code fences

Can a MAP transformation change the item type? Guess I’ll have to dig deeper into it.

Here’s my item config:

Contact BedroomWindow_ContactState "Bedroom window" (Bedroom, allWindows) ["Switchable"] {channel="max:shuttercontact:KEQ0644073:NKF0014927:contact_state"}

Nothing special about it, is it?

This channel provides a link to a SWITCH channel
Your need to change your item to a Switch type.
A map transform cannot change an item type

Switch BedroomWindow_ContactState "Bedroom window" (Bedroom, allWindows) ["Switchable"] {channel="max:shuttercontact:KEQ0644073:NKF0014927:contact_state"}

Now if you want it DISPLAYED as a contact item you can use the tranform for the displayed value.
With the above posted MAP transform:

Switch BedroomWindow_ContactState "Bedroom window [MAP(]" (Bedroom, allWindows) [ "Switchable" ] { channel="max:shuttercontact:KEQ0644073:NKF0014927:contact_state" }

if this doesn’t work (because the contact_state Channel is sending OPEN/CLOSED states), you can try to use a MAP xform also on the channel profile:

Switch BedroomWindow_ContactState "Bedroom window [MAP(]" (Bedroom, allWindows) [ "Switchable" ] { channel="max:shuttercontact:KEQ0644073:NKF0014927:contact_state" [profile="transform:MAP", function=""] }

If I remember well, you need 2.4.0 Snapshot > 1350 to use ItemChannelLink xfroms

So it should? work like this (I haven’t tested it):
Channel sends OPEN, it gets xformed to ON due to the Channel xformation, it gets stored as ON in the Switch Item state and it is displayed as OPEN due to the label xformation. Messy but it should work.