snowdd1 / homebridge-knx

KNX platform shim for homebridge
https://github.com/nfarina/homebridge
GNU General Public License v2.0
97 stars 56 forks source link

How can I configure a OR condition for the Listen statement #124

Closed migabc closed 5 years ago

migabc commented 6 years ago

Hi,

I need to configure a ContactSensor that will OPEN when any GA is triggered How can I configure a OR condition for the Listen statement? I.e, I need to to Listen for one OR another GA (not AND)

OPEN the contact sensor if 8/0/12 OR 8/0/22 are triggered

{ "ServiceType": "ContactSensor", "ServiceName": "All Doors & Windows", "Characteristics": [ { "Type": "ContactSensorState", "Listen": [ "8/0/12", >>>> All basement Doors & Windows "8/0/22" >>>> All mainfloor Doors & Windows ] } ] }

wendelit commented 6 years ago

Can't you just put but in the Listen list like this: "Listen": [ "8/0/12", "8/0/22" ]

migabc commented 6 years ago

That's what I did (see code above) but it doesn't seem to work consistently Sometimes when either one is open (8/0/12 OR 8/0/22) but the resulting ContactSensor does not reflect that

wendelit commented 6 years ago

Try this:

"Characteristics": [
                        {
                            "Type": "ContactSensorState",
                            "Handler": "ContactSensor",
                            "Listen": [
                                "8/0/12",
                                "8/0/13"
                            ]
                        }
                    ],
                    "KNXReadRequests": [
                        "8/0/12",
                        "8/0/13"
                    ]

Tho one problem is that if both are opened and then one is closed it will say that it's closed, to fix this you will probably have to do a special handler

snowdd1 commented 5 years ago

@wendelit is right - negative telegrams overwrite positive telegrams in that setup.
Basically it's neither OR nor AND it's just later supersedes earlier telegrams.

So, if you get one ON telegram and an OFF later from the other address, the contact will show OFF in homekit.

For a real AND or OR circuit you need to write an handler or use some backend software like a home server or node-red.