Closed bvli closed 2 years ago
I don't have any magnetic sensors, so I won't implement it, as I can't test it.
First solution looks most correct to me. It allows to use the magnetic contract even if it is not controlling an output. It's true that only the primary element is currently read, but reading all of them shouldn't be a problem. And yes, discovery should be changed to include the elements with magnetic contacts.
A PR would be great.
Hi @dkjonas
So glad I found this project! So cool that I can integrate my floor heating with home assistant. Great - and thanks a bunch.
While waiting for the components to arrive from China, I've setup platformIO and looked around in the source. Being new to home automation, I do not have that many sensors at home - but in fact I have two magnetic sensors connected to the AHC-9000, so it will shut off circuit, when a door or window is opened. I think I could use this information (that the door is actual open) in other ways in my automation setup. So what I'm asking for here, is to add support for this.
As I see it there's two possibilities for reading the status of the magnetic contact:
1) The correct way Iterate through the elements on each channel, and check if
NAT ELEM
is set and then check if it'sACTIVE
. This would mean that we need to change the code to iterate trough the elements. As I see it it's only the first (primary) element that is read in the loop right now.2) The more hackish way As we already read out the timer event of the current channels primary element. We could check if
BLKD
is set. If it is - it's blocked by a Magnetic contact.In any case we should publish a message with the status of the sensor if it's changed. And we would also need to change the discovery code.
My question here is twofold:
1) do you have any plans on implementing support for the magnetic contacts in the library? 2) if not - would you prefer having a PR if I try to get my feeds wet in IoT programming? And if so - which of the two alternatives above would you prefer to merge in?