bropat / ioBroker.eusec

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

[Bug]: JSON parse error #374

Closed AndrewSteel closed 9 months ago

AndrewSteel commented 10 months ago

Adapter version

1.1.2 and previous

JS-Controller version

5.0.12

Node version

18.17.1

Operating System type

Linux

Operating system version

6.1.21-v8+ aarch64 GNU/Linux

Describe the bug

eusec.0 2023-09-08 17:04:19.854 warn Non-parsable parameter value received from eufy cloud. Will be ignored. [{"type":2707,"value":"{\"r"}]
eusec.0 2023-09-08 17:04:19.854 error JSON parse error [{"error":{"message":"SyntaxError: Unexpected end of JSON input","stacktrace":"SyntaxError: Unexpected end of JSON input\n at JSON.parse ()\n at parseJSON (/opt/iobroker/node_modules/eufy-security-client/build/utils.js:154:21)\n at ParameterHelper.readValue (/opt/iobroker/node_modules/eufy-security-client/build/http/parameter.js:50:63)\n at Camera.updateRawProperty (/opt/iobroker/node_modules/eufy-security-client/build/http/device.js:127:57)\n at /opt/iobroker/node_modules/eufy-security-client/build/http/device.js:54:22\n at Array.forEach ()\n at Camera.update (/opt/iobroker/node_modules/eufy-security-client/build/http/device.js:53:35)\n at EufySecurity.updateDevice (/opt/iobroker/node_modules/eufy-security-client/build/eufysecurity.js:344:44)\n at EufySecurity.handleDevices (/opt/iobroker/node_modules/eufy-security-client/build/eufysecurity.js:560:22)\n at HTTPApi. (/opt/iobroker/node_modules/eufy-security-client/build/eufysecurity.js:167:50)"},"data":"{\"r"}]
eusec.0 2023-09-08 17:04:19.853 warn Non-parsable parameter value received from eufy cloud. Will be ignored. [{"type":2708,"value":"{\"r"}]
eusec.0 2023-09-08 17:04:19.852 error JSON parse error [{"error":{"message":"SyntaxError: Unexpected end of JSON input","stacktrace":"SyntaxError: Unexpected end of JSON input\n at JSON.parse ()\n at parseJSON (/opt/iobroker/node_modules/eufy-security-client/build/utils.js:154:21)\n at ParameterHelper.readValue (/opt/iobroker/node_modules/eufy-security-client/build/http/parameter.js:50:63)\n at Camera.updateRawProperty (/opt/iobroker/node_modules/eufy-security-client/build/http/device.js:127:57)\n at /opt/iobroker/node_modules/eufy-security-client/build/http/device.js:54:22\n at Array.forEach ()\n at Camera.update (/opt/iobroker/node_modules/eufy-security-client/build/http/device.js:53:35)\n at EufySecurity.updateDevice (/opt/iobroker/node_modules/eufy-security-client/build/eufysecurity.js:344:44)\n at EufySecurity.handleDevices (/opt/iobroker/node_modules/eufy-security-client/build/eufysecurity.js:560:22)\n at HTTPApi. (/opt/iobroker/node_modules/eufy-security-client/build/eufysecurity.js:167:50)"},"data":"{\"r"}]

WARN and ERROR comes twice with type:2707 and type:2708

To reproduce

  1. Go to '...'
  2. Click on '...'
  3. Scroll down to '....'
  4. See error

Screenshots & Logfiles

No response

Additional context

My setup:

AndrewSteel commented 10 months ago

After

the error still occurs.

The incorrect data therefore probably originates from the base station.

PhilippEngler commented 10 months ago

This is not an error @bropat can solve. The API from eufy deliver from time to time for some properties wrong values. This is the case here. Your integration should work without limitations.

@bropat: Should we think to made this "error" only visible in debug-loglevel? I think, this has no effect on the user. Also, I have enhanced the readValue-funktion to show which device is affected - should I make a PR?

AndrewSteel commented 10 months ago

Thank you Philipp for this information. When you say "from time to time" it means to me every minute, which is how the polling interval is set. So if you made this "error" only visible in debug-level, the my log does not overflow permanently ;-)

PhilippEngler commented 10 months ago

With from time to time I meant that is dependable per device. The error occur each time, the properties will be retrieved from the API. If you change the corospondending value in the app, the error is gone (but at the moment I did not know what 2708 [DOORBELL_DUAL_RADAR_WD_TIME] stands for at 2C or 2kP&T).

Let's see, what bropat thinks...

firebowl commented 10 months ago

I have the same problem for a few days and permanently. Unfortunately, at the moment I can not control anything with the adapter.

bropat commented 9 months ago

@bropat: Should we think to made this "error" only visible in debug-loglevel? I think, this has no effect on the user. Also, I have enhanced the readValue-funktion to show which device is affected - should I make a PR?

@PhilippEngler Yes, I agree.

duylong commented 8 months ago

Same problem with 1.6.4. I downgraded to 1.6.0 and the problem disappeared for me. Try to see if anyone has the problem.

Home base 2 Cam model : T8142

firebowl commented 8 months ago

Same problem with 1.6.4. I downgraded to 1.6.0 and the problem disappeared for me. Try to see if anyone has the problem.

Actual version is 1.1.2, how do you come to 1.6.0 or 1.6.4?