ps5-mqtt icon indicating copy to clipboard operation
ps5-mqtt copied to clipboard

SyntaxError: Unexpected end of JSON input

Open chrisdothtml opened this issue 2 years ago • 8 comments

Description of the issue

This line seems to be getting an invalid JSON response: https://github.com/FunkeyFlo/ps5-mqtt/blob/184421f4dbcb0f8efd0ecba58245c91439fa373c/ps5-mqtt/server/src/redux/sagas/check-devices-state.ts#L31

This has caused my ps5 entity to always show as unavailable. I tried re-setting up my ps5 through the Web UI and restarting HASS, but nothing has fixed it.

Not sure if this is related to https://github.com/FunkeyFlo/ps5-mqtt/issues/282, but it doesn't seem like it is. Looks like https://github.com/FunkeyFlo/ps5-mqtt/issues/304 has the same issue but it was closed as stale

Addon version

1.3.3

Platform

Core: 2024.4.2 Supervisor: 2024.04.0 Operating System: 12.1

Logs of the issue (if applicable)

Starting PS5-MQTT...
2024-04-11T02:51:09.146Z @ha:ps5:mqtt MQTT Message received ps5-mqtt/[redacted]
2024-04-11T02:51:09.189Z @ha:ps5:webserver Server listening on PORT: 65231
2024-04-11T02:51:12.202Z @ha:ps5:mqtt MQTT Message received ps5-mqtt/[redacted]
2024-04-11T02:51:32.537Z @ha:ps5:error SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at /app/server/dist/redux/sagas/check-devices-state.js:78:38
    at step (/app/server/dist/redux/sagas/check-devices-state.js:35:23)
    at Object.next (/app/server/dist/redux/sagas/check-devices-state.js:16:53)
    at next (/app/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:1161:27)
    at currCb (/app/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:1255:7)
    at runSelectEffect (/app/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:735:5)
    at runEffect (/app/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:1208:7)
    at digestEffect (/app/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:1275:5)
    at next (/app/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:1165:9)
2024-04-11T02:51:32.562Z @ha:ps5:mqtt MQTT Message received ps5-mqtt/[redacted]
2024-04-11T02:51:41.408Z @ha:ps5:checkDevicesState Update HA
2024-04-11T02:51:41.422Z @ha:ps5:mqtt MQTT Message received ps5-mqtt/[redacted]

chrisdothtml avatar Apr 11 '24 03:04 chrisdothtml

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

github-actions[bot] avatar May 12 '24 00:05 github-actions[bot]

I'm stuck on the same problem - MQTT seems to be connected and powering on the PS5 works. Just no sensor from the PS Account API, but the stated error in log

totti4ever avatar May 16 '24 20:05 totti4ever

Yeah this started happening to me again (about 2 months later). It's strange because in the web UI, it shows the correct state of my PS5, but for some reason the sensor isn't updating

chrisdothtml avatar Jun 13 '24 22:06 chrisdothtml

@chrisdothtml, @totti4ever,

Have you tried refreshing your npsso?

Taken from docs:

NOTE 2: Unfortunatly, NPSSO tokens expire after two months which means you'll have to periodically get a new one.

FunkeyFlo avatar Jun 14 '24 00:06 FunkeyFlo

How is the addon still able to show the correct state of the PS5 in the web UI if the token has expired, though?

chrisdothtml avatar Jun 14 '24 00:06 chrisdothtml

Because two seperate api's are being used. One to track device state. And one for tracking account state.

The web-ui only shows the former. Which does not require the NPSSO.

Account activity is not visible in the web-ui.

Also, the error from the log sometimes occurs when checking device state. It is not a problem and should automatically recover.

FunkeyFlo avatar Jun 14 '24 00:06 FunkeyFlo

Might be a dumb question but if you can detect the device status without the auth couldn't you just use that API so I never have to auth? For my use case I only care about the device status

chrisdothtml avatar Jun 25 '24 05:06 chrisdothtml

There looks to be a refresh token flow in the psn-api .. am I misunderstanding how this works re needing to refresh npsso?

hdsheena avatar Jul 22 '24 22:07 hdsheena