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

JSON parse error #230

Closed johnjoemorgan closed 1 year ago

johnjoemorgan commented 1 year ago

Version

1.5.2

Node version

n/a

Operating System type

Other

Operating system version

Home Assistant 2022.6

Describe the bug

Home Assistant Add-on: eufy-security-ws installs OK and configuration is accepted. No custom options are input.

username: xxxxxxxxxxx password: yyyyyyyyyyy country: PH port: 3000 polling_interval: 10 accept_invitations: true debug: false event_duration: 10 stations: []

=========

Base Station and doorbell are detected and installed in the Home Assistant integration and seem to be working OK

To reproduce

Set up add-on in Home Assistant

Screenshots & Logfiles

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-06-22 14:38:17.815 INFO Eufy Security server listening on host 0.0.0.0, port 3000 SyntaxError Unexpected end of JSON input error stack: • utils.ts:151 parseJSON usr/src/app/node_modules/eufy-security-client/src/utils.ts:151:21 • parameter.ts:45 readValue usr/src/app/node_modules/eufy-security-client/src/http/parameter.ts:45:41 • device.ts:132 updateRawProperty usr/src/app/node_modules/eufy-security-client/src/http/device.ts:132:45 • device.ts:64 usr/src/app/node_modules/eufy-security-client/src/http/device.ts:64:22 • device.ts:63 update usr/src/app/node_modules/eufy-security-client/src/http/device.ts:63:35 • device.ts:37 initializeState usr/src/app/node_modules/eufy-security-client/src/http/device.ts:37:14 • device.ts:45 initialize usr/src/app/node_modules/eufy-security-client/src/http/device.ts:45:14 • eufysecurity.ts:625 usr/src/app/node_modules/eufy-security-client/src/eufysecurity.ts:625:32 2023-06-22 14:38:29.423 INFO Push notification connection successfully established 2023-06-22 14:38:29.453 INFO Connected to station T8010P13204543DB on host 52.58.242.75 and port 14745 2023-06-22 14:38:30.492 ERROR JSON parse error {"r

Additional context

I have this set up on another Home Assistant install and it's working OK. This is another Home Assistant using same NUC clone hardware etc.

darkblackx commented 1 year ago

I have the same error, but with a secondary eufy account. If I use the 'primary', no error, but if I use an account (secondary account) that was added after as a 'home resident' I get this error exactly, including the parse error of 'r'.

After I logged in as that secondary account on mobile and confirmed I could see the devices on web and mobile, I tried again. I don't get the parse error now, I just get INFO Eufy Security server listening on host 0.0.0.0, port 3000 with no progression.

Still investigating, thought I'd share.

bropat commented 1 year ago

This has nothing to do with the config file of this project. The problem is in the project eufy-security-client and it is in getting the device properties from the Eufy Cloud. Some properties have the value in json format and there seems to be a parsing problem with a property of a device.

me-to-you93 commented 1 year ago

Hello, I have the exact same problem through Jeedom plugin. Posted here on eufy-security-client repo: https://github.com/bropat/eufy-security-client/issues/344

batiatto commented 1 year ago

I am having the same issue with all Homebase devices, the solo cameras are actually detected properly and working as normally.

this is what I am getting:

2023-08-30 08:12:19.232 ERROR JSON parse error { data: '{"r', error: SyntaxError: Unexpected end of JSON input at JSON.parse () at parseJSON (/usr/src/app/node_modules/eufy-security-client/build/utils.js:147:21) at ParameterHelper.readValue (/usr/src/app/node_modules/eufy-security-client/build/http/parameter.js:50:63) at Camera.updateRawProperty (/usr/src/app/node_modules/eufy-security-client/build/http/device.js:127:57) at /usr/src/app/node_modules/eufy-security-client/build/http/device.js:54:22 at Array.forEach () at Camera.update (/usr/src/app/node_modules/eufy-security-client/build/http/device.js:53:35) at EufySecurity.updateDevice (/usr/src/app/node_modules/eufy-security-client/build/eufysecurity.js:344:44) at EufySecurity.handleDevices (/usr/src/app/node_modules/eufy-security-client/build/eufysecurity.js:560:22) at HTTPApi. (/usr/src/app/node_modules/eufy-security-client/build/eufysecurity.js:167:50) } 2023-08-30 08:12:19.233 WARN Non-parsable parameter value received from eufy cloud. Will be ignored. { type: 2708, value: '{"r' } 2023-08-30 08:12:39.633 WARN Station T8124P31230354D0 - Tried all hosts, no connection could be established 2023-08-30 08:12:39.633 INFO Timeout connecting to station T8124P31230354D0 2023-08-30 08:12:53.928 INFO Connected to station T8124P31230354D0 on host 192.168.1.223 and port 23012 2023-08-30 08:13:24.097 INFO Initiated closing of connection to station T8124P31230354D0 for saving battery. 2023-08-30 08:13:24.097 INFO Disconnected from station T8124P31230354D0

I haven't been able to identify when this started happening, as I have a nightly docker update process and I lost track of it until I realized that it wasn't working properly.

any idea on what I could do to fix it?, even this is an eufy mal-formed response, I suppose there is a way for the client to be updated?

me-to-you93 commented 1 year ago

This issue should be reopened, not sure bropat sees it as it is closed. idk how to reopen it

bropat commented 1 year ago

This is an eufy cloud problem. I cannot do anything here. Only the above mentioned property is not updated, everything else works. There is no point in reopening this issue. Otherwise, I remove this error and the matter has an end ;)