Nice job on here. Just got a batch of these tonight from MyDigitalDiscount.
However, I ran across this thread because i was looking for a way to “reverse” the Open/Close reporting. But, did not find anything. I have a situation (manual garage rollup door) where the only thing i could do was mount rare earth magnets on the side of the door and the sensor on the top of the track. This let me better cover the sensor as well since the door never opens to the exact same spot. So, I copied and modified your device handler code to report the “opposites”. So if the magnet was near the sensor it reported “Open” and if the magnets were away from the sensor it reported “Closed”.
Not sure if this would be handy for anyone else, but basically all i changed was the Definition/name value to show “reverse” on line 19:
definition (name: "Visonic Door/Window Sensor Reverse",
and then flipped the names/color settings on lines 47/48:
attributeState "open", label: 'Closed', icon: "st.contact.contact.closed", backgroundColor: "#00A0DC"
attributeState "closed", label: 'Open', icon: "st.contact.contact.open", backgroundColor: "#e86d13"
Not sure if thats something you want to edit in yours Tomas, and publish a “Reverse” github code (i didnt publish mine, its just a copy of yours). But thought i’d share what I ran into.
EDIT: Or, even better, make it so under the “Configuration” options on the device itself, be able to toggle between the two (more complicated - but better user experience).