iomax / homebridge-mqttgaragedoor

Homebridge accessory plugin that create an HomeKit Garage Door Opener mapped on MQTT topics
Apache License 2.0
8 stars 9 forks source link

Reed sensor on GPIO14? #3

Closed timhng closed 6 years ago

timhng commented 6 years ago

Maybe a bit of a noob question, but does the "openGet" topic inform homekit of the open/closed status of the garage door? I have a reed switch attached to GPIO14, what should the mqtt command look like?

iomax commented 6 years ago

"openGet" will get the information by the "garage door HW" about the open status change as "ClosedGet" about the closed status change. If only one was present, the status will be determined as a consequence ( something like : it's not Open so it's Closed ).

The use of one or the other (or both) depends on where you will place the reed switch but in your example I would make sure that every change on GPIO14 is published on "OpenGET topic" with "openValue" as message ( by default "true" when open and any other value, I would say "false", when "unopened")

timhng commented 6 years ago

Thank you very much for your prompt response. Unfortunately, I'm still struggling to understand.

Tapping the 'Garage Door' accessory in the Apple 'Home' app does correctly trigger the opening/closing of the garage door. The status displayed on the accessory changes to 'opening.../closing...' and then to 'open/closed' after the 5 seconds configured for the 'doorRunInSeconds' attribute.

The problem is that when I separate and then bring together the two halves of the reed switch, the status of the Home app accessory doesn't change accordingly.

When I separate and then bring together the two halves of the reed switch, the Sonoff SV console displays the following : 01:14:13 MQT: cmnd/2/POWER2 = ON 01:14:16 MQT: cmnd/2/POWER2 = OFF

the relevant section from my config.json file is:

"topics": { "statusSet": "cmnd/GarageDoor/POWER" "openGet": "cmnd/2/POWER" }, "doorRunInSeconds": "5"

In configuring the Sonoff SV device I had previously run the following commands: switchmode1 0 switchmode2 2 switchtopic2 2

I believe that I have not correctly specified 'openGet', and possibly need to define the 'openStatusCmdTopic' and or 'openStatusCmd' values. Any help would be much appreciated. Thanks in advance.

iomax commented 6 years ago

From my understanding, I'd use "openGet": "cmnd/2/POWER2" as "openValue":"ON".

openStatusCmdTopic and openStatusCmd, is used to "manually trigger" the feedback by the door HW about the status, openGet and openValue is where and how the feedback is provided.

timhng commented 6 years ago

Thanks @iomax . I've redefined 'switchtopic2' as 'DoorStatus' to make it more readable. So my config.json file is now:

"topics": { "statusSet": "cmnd/GarageDoor/POWER", "openGet": "cmnd/DoorStatus/POWER2", "openValue": "On" }, "doorRunInSeconds": "5"

I think that I should also add: "openStatusCmdTopic": "DoorStatus"

but what should "openStatusCmd" be???

iomax commented 6 years ago

I'd suggest to take care about the "openValue" ... "On" could be not as "ON". Regarding openStatusCmdTopic as openStatusCmd you've to know how to trig the feedback about the status by your Sonoff SV. Which firmware are you using on it ?

timhng commented 6 years ago

Yes, that worked!!!! "On" should have been "ON" Doh! Thank you @iomax for your help, much appreciated.