bropat / ioBroker.eusec

This ioBroker adapter allows to control Eufy security devices by connecting to the Eufy cloud servers.
MIT License
140 stars 18 forks source link

Feature Request: Doorbell Ring #3

Closed lk911lk closed 3 years ago

lk911lk commented 4 years ago

Hi, thank you for your great work. Is it possible to add a feature that shows the pressed ring button in iobroker? So it will be possible to swich lights when anybody is knock on the door.

Alexa can say "its somebody at the door" maybe thats an hint.

When you need logs or something i can help.

thank you

lk911lk

bropat commented 4 years ago

Hi lk911lk,

i've already implemented the push notification (thanks to @JanLoebel). I think with that i can implement what you ask. As soon as i will release this version I will ask you for some logs, because I do not own a Eufy Doorbell.

bropat commented 4 years ago

Hi lk911lk,

i've already implemented the push notification (thanks to @JanLoebel). I think with that i can implement what you ask. As soon as i will release this version I will ask you for some logs, because I do not own a Dorbell Ring.

In the meantime the push notifications aren't working anymore. I'm investigating the issue with @JanLoebel here.

lk911lk commented 4 years ago

Hi, thank you.  Logs are no Problem to Send you logs, but you write 'Ring doorbell' i have an eufy doorbell ;)

Thank you for you greate work!

bropat commented 4 years ago

Hi,

i've released the new version (0.0.2) with integrated push notifications. Can you check if you get a push notification when you press the ring button?

Thanks!

tomazmla commented 4 years ago

hi bropat,

I have update to version 0.0.2 and noticed this in the logs: 2020-11-21 19:31:23.205 - info: eufy-security.0 (14739) starting. Version 0.0.2 in /opt/iobroker/node_modules/iobroker.eufy-security, node: v10.20.1, js-controller: 3.1.6 2020-11-21 19:31:23.362 - info: eufy-security.0 (14739) Refresh data from cloud and schedule next refresh. 2020-11-21 19:31:23.584 - info: eufy-security.0 (14739) state eufy-security.0.T8010P23202718FD.station.lan_ip_address changed: (ack = true) 2020-11-21 19:31:23.591 - info: eufy-security.0 (14739) state eufy-security.0.T8010P23202718FD.station.lan_ip_address changed: (ack = true) 2020-11-21 19:31:23.725 - error: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). 2020-11-21 19:31:23.725 - error: eufy-security.0 (14739) unhandled promise rejection: Cannot read property 'authToken' of undefined 2020-11-21 19:31:23.726 - error: eufy-security.0 (14739) TypeError: Cannot read property 'authToken' of undefined at EufySecurity. (/opt/iobroker/node_modules/iobroker.eufy-security/build/lib/eufy-security/eufy-security.js:252:71) at Generator.next () at /opt/iobroker/node_modules/iobroker.eufy-security/build/lib/eufy-security/eufy-security.js:8:71 at new Promise () at __awaiter (/opt/iobroker/node_modules/iobroker.eufy-security/build/lib/eufy-security/eufy-security.js:4:12) at EufySecurity.registerPushNotifications (/opt/iobroker/node_modules/iobroker.eufy-security/build/lib/eufy-security/eufy-security.js:244:16) at EufySecurity. (/opt/iobroker/node_modules/iobroker.eufy-security/build/main.js:823:33) at Generator.next () at fulfilled (/opt/iobroker/node_modules/iobroker.eufy-security/build/main.js:27:58) at process._tickCallback (internal/process/next_tick.js:68:7) 2020-11-21 19:31:23.728 - info: eufy-security.0 (14739) Disconnect from station T8010P23202718FD. 2020-11-21 19:31:23.739 - info: eufy-security.0 (14739) terminating 2020-11-21 19:31:23.741 - info: eufy-security.0 (14739) Terminated (NO_ERROR): Without reason 2020-11-21 19:31:23.771 - info: eufy-security.0 (14739) state eufy-security.0.T8010P23202718FD.cameras.T8210P0020271335.last_camera_url changed: (ack = true)

Objects are updated as they should, push is not working :(

Hope it helps, tomazmla

bropat commented 4 years ago

@tomazmla i fixed the issue with version 0.0.3. Please test again.

To be able to debug better I ask you to activate the debug mode and send me the logs in case of problems.

Attention: The logs contain sensitive data (e.g. login credentials etc.), you should obfuscate the sensitive part of the data before you send it to me.

tomazmla commented 4 years ago

Man, that was quick :) It works now as expected! I was able to use "eufy-security.0.push_notification.push_time" in a script to do automations based on the doorbell pressed.

Thanks so much for the great work, tomazmla

BTW, my setup: wireless doorbell T8210 with HomeBase T8010.

bropat commented 4 years ago

Can someone send me debug logs when they ring the doorbell? So I can integrate the Doorbell better :-) What other functionalities does Eufy offer for the Doorbell as a control in the app? As I said before, unfortunately I do not own Doorbell.

tomazmla commented 4 years ago

hi bropat,

Can you please help me enable adapter debuging. I have downloaded the adapter json configuration and changed and uploaded the loglevel to "debug" or "silly" but I don't see any additional records in the log (only info)?

bropat commented 4 years ago

hi bropat,

Can you please help me enable adapter debuging. I have downloaded the adapter json configuration and changed and uploaded the loglevel to "debug" or "silly" but I don't see any additional records in the log (only info)?

  1. Enable Administrator mode (2):

    image

  2. Now change the loglevel to debug (12) for the adapter eufy-security:

    image

Source: https://www.iobroker.net/#en/documentation/admin/instances.md

tomazmla commented 4 years ago

Hi bropat,

thanks for the detailed instructions:) Attached is the debug for the doorbell event.

tomazmla doorbell_log.txt

bropat commented 4 years ago

@tomazmla Thank you very much!

That's what I was looking for:

2020-11-23 19:07:36.596 - debug: eufy-security.0 (5816) handlePushNotifications(): Unhandled push event: {"content":"Doorbell:Someone has press doorbell","device_sn":"T8210XXXXXXXXXX","event_time":"1606154853590","payload":{"event_type":3103,"device_sn":"T8210XXXXXXXXXX","name":"Doorbell","channel":0,"cipher":97,"session_id":"xxxxxxxxxxx","pic_url":"https://security-app-eu.eufylife.com/v1/s/g/XXXXXXXX","create_time":1606154853590,"file_path":"","notification_style":2,"push_count":2},"push_time":"1606154856492","station_sn":"T8010XXXXXXXXXXX","title":"","type":"7","google.c.sender.id":"xxxx"}
{
   "content":"Doorbell:Someone has press doorbell",
   "device_sn":"T8210XXXXXXXXXX",
   "event_time":"1606154853590",
   "payload":{
      "event_type":3103,
      "device_sn":"T8210XXXXXXXXXX",
      "name":"Doorbell",
      "channel":0,
      "cipher":97,
      "session_id":"xxxxxxxxxxx",
      "pic_url":"https://security-app-eu.eufylife.com/v1/s/g/XXXXXXXX",
      "create_time":1606154853590,
      "file_path":"",
      "notification_style":2,
      "push_count":2
   },
   "push_time":"1606154856492",
   "station_sn":"T8010XXXXXXXXXXX",
   "title":"",
   "type":"7",
   "google.c.sender.id":"xxxx"
}
bropat commented 3 years ago

Feature integrated with version 0.0.5 released now. Please test it and let me know.

Thanks!

tofrie commented 3 years ago

Der Wert von Rninging bleibt beim Klingeln an der Tür auf False stehen.

nukleuz80 commented 3 years ago

Cool, dass du das umgesetzt hast - ich habe zwar noch nicht aktualisiert, bin aber schon fast dabei!

👍👍👍