rudyberends / homebridge-loxone-proxy

Homebridge Dynamic Platform Plugin which exposes a Loxone System to Homekit
Apache License 2.0
12 stars 6 forks source link

Doorbell activation from NFC #109

Open jan-sevcik-snadnee opened 20 hours ago

jan-sevcik-snadnee commented 20 hours ago

Hi, is there a chance to expose when somebody click on the Doorbell from the NFC keyboard? Maybe see it as a light on for a few seconds?

Thank you for your amazing work! :)

rudyberends commented 15 hours ago

Are you referring to this? https://www.loxone.com/nlnl/kb/nfc-code-touch-air/

We could try to implement this as a doorbell, so it will show up like that in HomeKit? Is this useful for you?

jan-sevcik-snadnee commented 15 hours ago

Yes, I have 2 pieces of this as a Tree version. Afterwards I would create a HomeKit automation that would be triggered any time somebody rings the bell.

That would be awesome :) is there any chance to support you? Your work helped me in many cases in my smart home :)

Thank you

rudyberends commented 13 hours ago

No problem, glad to help.

Not sure about this one. I expected the NfcCodeTouch to expose a "bell" state, just like the intercom. There is no bell state, but there is an (undocumented) "events" state. This events state might contain a certain value once the doorbell is pressed, however I cannot test this myself. It wil probably also change when using codes/ nfc tags, so it might not be usefull.

If you try the latest beta, your nfc codetouch devices will get registered as a doorbell. The log should contain entries like this;

[11/14/2024, 5:39:29 PM] [LoxonePlatform] [NfcCodeTouchItem] Restoring accessory from cache: test codetouch [11/14/2024, 5:39:29 PM] [LoxonePlatform] [test codetouch] Registering Listeners for NfcCodeTouchItem [11/14/2024, 5:39:29 PM] [LoxonePlatform] [test codetouch] Callback state update for Doorbell: 0

The callback state is the one we are interested in. It is 0 by default. If we are lucky, the state will have a specific number or value for when the doorbell is pressed. Could you test this, and check if the value is always the same (on both devices)?

jan-sevcik-snadnee commented 11 hours ago

Thank you for the super fast response. I installed the beta 6 and it almost works!

1) My log doesnt show anything you mentioned, should I turn on some debug mode? Attaching my log homebridge-loxone-proxy.log.txt

2) It immediately shows the doorbell in Homekit, no setup needed. Altough it says that the accessory is not supported. 3) Even it is not supported, I get a notification when I ring the bell in both of the NFCs, hooray!! 4) Im unable to use the accessory in any of the automation scenes - maybe because of the unsuported state?

Thank you again!

rudyberends commented 11 hours ago

Right now, if the value of the events state is anything other than zero, it will ring the doorbell. It could be that this event state is only used for the doorbell. But I would not be surprised if it also rings when you use an nfc tag or a code to unlock the door.

If that is the case, we need to check the logs for the exact value in the state. If we are lucky, there is a unique value for the doorbell. You need to set the homebridge log to debug to see these log entries.

Apple does not support doorbells without a camera. If all you want is to get notifications on your devices, or doorbell sounds on your HomePods, then this is no issue. It could be that these unsupported devices cannot act as triggers for automations.

Let's find out if we have any useful information in that state. If we can get it working, we can see how we can get automations working.

jan-sevcik-snadnee commented 10 hours ago

I made a proper test with the debug option on :)

Here is how it works:

return 0 - default value. Anytime it switches to any of the numbers bellow, it comes back to a 0 within in a less than a second return 1 - doorbel ring return 2 - authorized (NFC tag or code, both returns 2), also doesnt matter if its a user or just "guest code" return 4 - unauthorized

I didnt find a scenario when it returns 3 :(

So for the doorbel, it returns 1 and then in a few miliseconds back to 0.

ccky commented 10 hours ago

Hi, @jan-sevcik-snadnee have you considered configuring a Presence block in Loxone Config that would be triggered with event from NFC. This Homebridge plugin will then expose it as Occupancy and you can use it as Home automations trigger in the Home app

rudyberends commented 10 hours ago

So this means it's already functioning as expected for the doorbell right? Can you confirm it only rings when you actually ring the doorbell?

The suggestion made by @ccky is a valid solution. The NfcCodeTouch has a Bell output that you can use to connect a pushbutton or a presence block. This wil give you an item in HomeKit that you can use to trigger an automation.

I can also expose a motion sensor directly from the plugin for the NfcCodeTouch. This wil give us a working doorbell with an additional motion sensor (or switch if you want) without modifications to Loxone config

jan-sevcik-snadnee commented 9 hours ago

Yes it works :) I would think that exposing it as a motion sensor will be better solution, because you can run a variety of automation, not just playing a sound on HomePod. Maybe the solution can have switch in the config - for people who wants the native behavior and the motion version for anybody who wants to do more.

Yes it can be done in the config, but sounds to me like less convenient solution to anybody, since there will be an additional setup

Thank you

rudyberends commented 9 hours ago

Agreed. The latest beta should give you the requested functionality, but it is untested. It will still map to a Doorbell, but there is a switch in the config under advanced to set it to a motion sensor.

Please let me know if it works as expected.