anthonywebb / homebridge-cbus

CBus plugin for homebridge
MIT License
35 stars 20 forks source link

Contact Switch #144

Closed luke-b5114 closed 5 months ago

luke-b5114 commented 5 months ago

Hi all,

Connected a C-Bus Coupler for receiving the status of my reed switches for multiple doors. I've added them to homebridge using a "contact" switch. only issue I'm having its displaying the opposite state of the contact. when close, it says open, vice versa.

I've tried to use "Invert: true" to change the status around. but does not work.

{ "type": "contact", "id": 74, "name": "Front Door", "invert": "true" }, { "type": "contact", "id": 75, "name": "Laundry Door", "invert": "true" }, { "type": "contact", "id": 76, "name": "Garage Door", "invert": "true" }

Thanks in advanced.

DarylMc commented 5 months ago

In the notes invert is not applicable to contact. Try switch. Also you may be able to invert the bus coupler in toolkit or in Homekit.

DarylMc commented 5 months ago

image

luke-b5114 commented 5 months ago

I'll look into toolkit and see what i can find.

Thank you

JasonY00 commented 5 months ago

Daryl is correct. Invert is not for the contact sensor. In the bus coupler set short/long-open/close output for each channel in Toolkit config screen. You just swap the logic, I.e. when on, send off and vice versa. I use it all of the time with my Aux In and Bus couplers this way and when I wrote the contact sensor part, it is intended to only work this way.

cheers

Jason

luke-b5114 commented 5 months ago

I was unable to find on toolkit the logic to change this, do you have any instructions on this?

Thank you

JasonY00 commented 5 months ago

I’m travelling for a couple more days, but when back, I can send a screenshot to you. Until then, open the bus coupler config in toolkit and look at the screens, one lists what each channel should output for a long or short press or release. It’s in a table format. Invert the logic there.

JasonY00 commented 5 months ago

Hi mate,

Here is the screen you need to edit in Toolkit. Its titled "Key Functions" in the settings. Its generally the same for both the bus coupler and the auxiliary input units:

Depending on the logic needed, just choose either this setting or the opposite for each channel. i.e. if you want the c-bus Group Address (GA) to be ON when the contact switch is CLOSED or if you want the c-bus GA OFF when the reed switch is CLOSED. So set what you need for Short/Long Press/Release in the "Micro Function" table settings.

image

Let me know how you go.

Cheers

Jason

luke-b5114 commented 5 months ago

Awesome !

Thank you very much, working fine now

JasonY00 commented 5 months ago

Great news. If all good, can you close the issue please.

Cheers

Jason

DarylMc commented 5 months ago

I just want to add for a door integration to Homekit I think it is preferable to use a specific door device which adds security. I use a Homekit specific Meross door opener. This has door status, warnings for door left open, jammed notifications and native Homekit functionality. If you use a switch in Homekit it can be operated for example by someone outside if Homepod can hear them. Door accessories in Homekit will require an elevated security to open eg need to unlock phone or be wearing logged in Apple watch. Can be closed without elevated security though. You could also map a CBus group address to a CBus key input if the requirement was to also operate the door via CBus key input or bus coupler although in most cases a dumb momentary contact in parallel is all that would most likely be needed in the garage.

JasonY00 commented 5 months ago

Hi Daryl,

the contact sensor is a read only device in homekit. I adapted this from the motion detector and used it for smoke detection sensor etc. It will only tell you the status ON/OFF, OPEN/CLOSED etc. and an can be chosen in homekit to be represented as contact, door, garage door or window icons. It is not a controllable device.

Agree with your point above re: security for (garage) door access. The problem with the homebridge-cbus plugin is that it creates only one homekit service for each c-bus GA. In Node Red, I have played with composite devices (door/lock, garage door) where you can take several c-bus group addresses (already defined in homebridge via the plugin) that are connected to Aux In/Bus Couplers (for open/close/obstruction state) and relay outputs (for O/S/C) and create a garage door opener or door service that provides everything you are talking about above, including opening the garage door via carplay when you are detected to arrive at home. I also used this technique to create thermostats with c-bus relays and temp sensors. This is all done with just, c-bus/homebridge/node red and no additional hardware. It dovetails in with my Color C-Touch and EDLT's

image

image

Node Red has extended the usefulness of the homebridge-cbus plugin to create complex devices in homekit that are a level above what can be achieved with the plugin alone. The bonus is that it runs on the same pi as homebridge...

Cheers

Jason