bropat / eufy-security-ws

Small server wrapper around eufy-security-client library to access it via a WebSocket.
MIT License
176 stars 26 forks source link

[Bug]: entry sensors not updating correctly #219

Closed RemcoveHA closed 1 year ago

RemcoveHA commented 1 year ago

Version

1.3.0

Node version

?

Operating System type

Linux

Operating system version

HA OS 10.1

Describe the bug

I’ve installed the addon now twice following all steps. It looks like it is working but I have a strange problem with all of my entry sensors. It seems they are not updating when a door is opened or closed.

I figured that the open/close event is to short before a new “fetch” but also when I open a door for longer then, let’s say, 30 minutes it’s not updating. I looked in the logs and found it full of errors.

Once I reboot the addon and reboot home assistant everything seems to work fine. The log shows me the following but after a while it goes back to what happened above…

To reproduce

No clue

Screenshots & Logfiles

Log 1: at P2PClientProtocol.handleDataControl (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1450:43) at P2PClientProtocol.handleData (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1043:18) at P2PClientProtocol.parseDataMessage (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1031:26) at P2PClientProtocol.handleMsg (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:868:26) at Socket.<anonymous> (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1732:56) at Socket.emit (node:events:513:28) at UDP.onMessage [as onmessage] (node:dgram:930:8), payload: '{"cmd":1550,"payload":{"status":0}}\x00' } 2023-05-17 17:14:44.887 ERROR Station T8010P2322381E5F - CMD_NOTIFY_PAYLOAD Error: { error: SyntaxError: Unexpected token in JSON at position 35 at JSON.parse (<anonymous>) at P2PClientProtocol.handleDataControl (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1450:43) at P2PClientProtocol.handleData (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1043:18) at P2PClientProtocol.parseDataMessage (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1031:26) at P2PClientProtocol.handleMsg (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:868:26) at Socket.<anonymous> (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1732:56) at Socket.emit (node:events:513:28) at UDP.onMessage [as onmessage] (node:dgram:930:8), payload: '{"cmd":1550,"payload":{"status":1}}\x00' } 2023-05-17 17:15:04.631 ERROR Station T8010P2322381E5F - CMD_NOTIFY_PAYLOAD Error: { error: SyntaxError: Unexpected token in JSON at position 35 at JSON.parse (<anonymous>) at P2PClientProtocol.handleDataControl (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1450:43) at P2PClientProtocol.handleData (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1043:18) at P2PClientProtocol.parseDataMessage (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1031:26) at P2PClientProtocol.handleMsg (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:868:26) at Socket.<anonymous> (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1732:56) at Socket.emit (node:events:513:28) at UDP.onMessage [as onmessage] (node:dgram:930:8), payload: '{"cmd":1550,"payload":{"status":0}}\x00' } 2023-05-17 17:16:21.928 ERROR Station T8010P2322381E5F - CMD_NOTIFY_PAYLOAD Error: { error: SyntaxError: Unexpected token in JSON at position 35 at JSON.parse (<anonymous>) at P2PClientProtocol.handleDataControl (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1450:43) at P2PClientProtocol.handleData (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1043:18) at P2PClientProtocol.parseDataMessage (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1031:26) at P2PClientProtocol.handleMsg (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:868:26) at Socket.<anonymous> (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1732:56) at Socket.emit (node:events:513:28) at UDP.onMessage [as onmessage] (node:dgram:930:8), payload: '{"cmd":1550,"payload":{"status":1}}\x00' } 2023-05-17 17:16:25.998 ERROR Station T8010P2322381E5F - CMD_NOTIFY_PAYLOAD Error: { error: SyntaxError: Unexpected token in JSON at position 35 at JSON.parse (<anonymous>) at P2PClientProtocol.handleDataControl (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1450:43) at P2PClientProtocol.handleData (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1043:18) at P2PClientProtocol.parseDataMessage (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1031:26) at P2PClientProtocol.handleMsg (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:868:26) at Socket.<anonymous> (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1732:56) at Socket.emit (node:events:513:28) at UDP.onMessage [as onmessage] (node:dgram:930:8), payload: '{"cmd":1550,"payload":{"status":0}}\x00' } 2023-05-17 17:21:29.544 ERROR Station T8010P2322381E5F - CMD_NOTIFY_PAYLOAD Error: { error: SyntaxError: Unexpected token in JSON at position 35 at JSON.parse (<anonymous>) at P2PClientProtocol.handleDataControl (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1450:43) at P2PClientProtocol.handleData (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1043:18) at P2PClientProtocol.parseDataMessage (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1031:26) at P2PClientProtocol.handleMsg (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:868:26) at Socket.<anonymous> (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1732:56) at Socket.emit (node:events:513:28) at UDP.onMessage [as onmessage] (node:dgram:930:8), payload: '{"cmd":1550,"payload":{"status":1}}\x00' } 2023-05-17 17:21:35.362 ERROR Station T8010P2322381E5F - CMD_NOTIFY_PAYLOAD Error: { error: SyntaxError: Unexpected token in JSON at position 35 at JSON.parse (<anonymous>) at P2PClientProtocol.handleDataControl (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1450:43) at P2PClientProtocol.handleData (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1043:18) at P2PClientProtocol.parseDataMessage (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1031:26) at P2PClientProtocol.handleMsg (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:868:26) at Socket.<anonymous> (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1732:56) at Socket.emit (node:events:513:28) at UDP.onMessage [as onmessage] (node:dgram:930:8), payload: '{"cmd":1550,"payload":{"status":0}}\x00' } 2023-05-17 17:32:07.292 ERROR Station T8010P2322381E5F - CMD_NOTIFY_PAYLOAD Error: { error: SyntaxError: Unexpected token in JSON at position 35 at JSON.parse (<anonymous>) at P2PClientProtocol.handleDataControl (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1450:43) at P2PClientProtocol.handleData (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1043:18) at P2PClientProtocol.parseDataMessage (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1031:26) at P2PClientProtocol.handleMsg (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:868:26) at Socket.<anonymous> (/usr/src/app/node_modules/eufy-security-client/build/p2p/session.js:1732:56) at Socket.emit (node:events:513:28) at UDP.onMessage [as onmessage] (node:dgram:930:8), payload: '{"cmd":1550,"payload":{"status":0}}\x00' }

Log 2 after rebooting: 2023-05-17 18:05:59.105 INFO Eufy Security server listening on host 0.0.0.0, port 3000 2023-05-17 18:06:09.324 INFO Connected to station T8010P2322381E5F on host 192.168.1.180 and port 25192 2023-05-17 18:06:12.764 INFO Push notification connection successfully established 2023-05-17 18:07:13.363 INFO Disconnected from station T8010P2322381E5F 2023-05-17 18:07:18.444 INFO Connected to station T8010P2322381E5F on host 192.168.1.180 and port 26767 2023-05-17 18:08:22.297 INFO Disconnected from station T8010P2322381E5F 2023-05-17 18:08:27.358 INFO Connected to station T8010P2322381E5F on host 192.168.1.180 and port 18258 2023-05-17 18:09:31.248 INFO Disconnected from station T8010P2322381E5F 2023-05-17 18:09:36.310 INFO Connected to station T8010P2322381E5F on host 192.168.1.180 and port 28795 2023-05-17 18:10:40.205 INFO Disconnected from station T8010P2322381E5F 2023-05-17 18:10:45.282 INFO Connected to station T8010P2322381E5F on host 192.168.1.180 and port 17378 2023-05-17 18:11:49.131 INFO Disconnected from station T8010P2322381E5F 2023-05-17 18:11:54.189 INFO Connected to station T8010P2322381E5F on host 192.168.1.180 and port 16541 2023-05-17 18:12:49.943 INFO Alarm mode for station T8010P2322381E5F changed to: DISARMED 2023-05-17 18:12:50.504 INFO Received push notification for changing guard mode { guard_mode: 63, current_mode: 63, stationSN: 'T8010P2322381E5F' } 2023-05-17 18:12:56.293 INFO Alarm mode for station T8010P2322381E5F changed to: HOME 2023-05-17 18:12:56.654 INFO Received push notification for changing guard mode { guard_mode: 1, current_mode: 1, stationSN: 'T8010P2322381E5F' }

Additional context

No response

fuatakgun commented 1 year ago

You are supposed to be on 1.5.2 version of add-on, please update first

RemcoveHA commented 1 year ago

Edit: I've noticed that I the manual has been updated. A few months ago I had to add the github from fuatakgun and now from bropat. I'm going to do this and hope the issue will be resolved. I'll keep you posted.


Where and how do it update? I just reinstalled it from the addon store so I suppose this is automatically the latest version? Screenshot_20230517_210349_Home Assistant

fuatakgun commented 1 year ago

Please follow the guideline from here: https://github.com/bropat/hassio-eufy-security-ws

This repository is the latest one

RemcoveHA commented 1 year ago

So I've updated and in good spirit I hoped it would fix anything. However the entry sensors are still not updating. I can change the alarm state do that part works. I opened a window in the hous for aprox 6 hours and it never updated the state to open. The logs shows me this:

s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service fix-attrs successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service legacy-services: starting s6-rc: info: service legacy-services successfully started 2023-05-17 19:18:27.028 INFO Eufy Security server listening on host 0.0.0.0, port 3000 2023-05-17 19:18:37.211 INFO Connected to station T8010P2322381E5F on host 192.168.1.180 and port 25561 2023-05-17 19:18:37.281 INFO Push notification connection successfully established 2023-05-17 19:19:00.392 INFO Alarm mode for station T8010P2322381E5F changed to: undefined 2023-05-17 19:19:00.715 INFO Received push notification for changing guard mode { guard_mode: 6, current_mode: 6, stationSN: 'T8010P2322381E5F' } 2023-05-17 19:19:06.464 INFO Alarm mode for station T8010P2322381E5F changed to: HOME 2023-05-17 19:19:06.789 INFO Received push notification for changing guard mode { guard_mode: 1, current_mode: 1, stationSN: 'T8010P2322381E5F' } 2023-05-18 01:08:50.969 WARN Station T8010P2322381E5F - Heartbeat check failed. Connection seems lost. Try to reconnect... 2023-05-18 01:08:50.977 INFO Disconnected from station T8010P2322381E5F 2023-05-18 01:09:11.190 WARN Station T8010P2322381E5F - Tried all hosts, no connection could be established 2023-05-18 01:09:11.194 INFO Timeout connecting to station T8010P2322381E5F 2023-05-18 01:09:18.212 INFO Connected to station T8010P2322381E5F on host 192.168.1.180 and port 28665

For the readability i added a printscreen of the log

RemcoveHA commented 1 year ago

Screenshot_20230518_103525_Home Assistant

RemcoveHA commented 1 year ago

So yeah, I finally figured it out.

The entry sensors will only work in HA if you have push-notification put on "on" in the eufy app.. Kinda strange but oh well it works :)

Jordi-m commented 1 year ago

@RemcoveHA Hi. Which notification setting exactly did you put to "on"? For entry/contact sensor I have 2 options: Notification when sensor is open for X minutes/hours OR notify me if it's still open after XX:XX hour every day.

My doorbell works fine in HA, but the contact sensor never synced. Hoped to fix it by using this addon, but cant get it to work yet. Thanks in advance for your input.

RemcoveHA commented 1 year ago

@Jordi-m hello, I meant the push notification in the eufy security app itself. When you disable the notification home assistant won't update anymore.. super annoying but no other option.

Jordi-m commented 1 year ago

@RemcoveHA Yes, I'm referring to the (Android in my case) app as well. But whatever I enable, I don't get any sync signal for the contact sensor. That;s why I was curious which notification you exactly enabled? I have notifications enabled for a bunch of things, but cant seem to find any device-specific notification toggles.