I’m experimenting moving from the Zigbee binding to “zigbee2mqtt + home assistant discovery” configuration because most of the sensors I have here are not properly recognized by the original binding.
After having figured out that I need to install the Jinja add-on, it works fine in most cases but I’m having an issue with door/window contact sensors.
They show up just fine with their channels but the open/close detection, temper alarm and battery low channels come up as a switch and not as a contact.
This means their status is ON/OFF instead of OPEN/CLOSED and the default sitemap item is showing a switch element that triggers errors when activated (rightfully so).
Using Metadata on the linked item allows for a nice OPEN/CLOSED display but this does not change the core type of the item and so groups based on “contact” no longer update.
In the UI, I tried manually adding a new item linked to the channel and was able to change the type from “switch” to “contact”, but the status stays null and never updates.
Is there a way to “transform” a switch into a “contact” in such a way that it really is considered a contact by everything else?
If yes, is there a way to make it generic? I’m asking because I have a dozen window/door contact sensors and I’d rather not have to do multiple manipulations to have them back to working.
I can’t answer this, but if you don’t find a direct solution then you could use proxy contact items and a rule that triggers when a member of a group changes to update the related proxy item. If you standardize your item names, you could send the command to the proxy based on the name of the triggering item.
The way I currently do it is manually set up my zigbee2mqtt stuff manually using mqtt instead of using the homeassistant discovery. This gives me full control over what type I want for everything. It does require extra work, but I use my items/things generator which utilised a template for each device type (e.g. one template for motion sensors).
I have been meaning to look into the homeassistant way one of these days.