ice987987/ioBroker.husqvarna-automower

Objects are not updated, just at start of adapter

IllegalDuke opened this issue · 11 comments

The problem

Hello,

The Objects of IOBroker are not updated, just at the start of the adapter.
-> Can be seen on the "statusTimestamp" and the battery level.
I have set the Time interval for the update of statistic values to 5 minutes.
Every 5 minutes the update takes place:

Hallo,

die Objekte des Adapters werden in IOBroker nur nach dem Start/Neustart des Adapters aktualisert.
-> Zu erkennen an dem "statusTimestamp" und z.B. dem Batteriestand.
Ich habe das Intervall für den Statistic-Update auf 5 Minuten gesetzt.
Alle 5 Minuten fordert der Adapter vom Server ein Update an:

`

husqvarna-automower.0 2022-10-03 09:59:11.015 debug Mowerstatistics updated.
husqvarna-automower.0 2022-10-03 09:59:11.014 debug [getMowerData]: response.data: {"data":[{"type":"mower","id":"!!!removed!!!","attributes":{"system":{"name":"430X","model":"HUSQVARNA AUTOMOWER® 430X","serialNumber":!!!removed!!!},"battery":{"batteryPercent":88},"mower":{"mode":"MAIN_AREA","activity":"MOWING","state":"IN_OPERATION","errorCode":0,"errorCodeTimestamp":0},"calendar":{"tasks":[{"start":1080,"duration":360,"monday":true,"tuesday":true,"wednesday":true,"thursday":true,"friday":true,"saturday":true,"sunday":true},{"start":360,"duration":480,"monday":true,"tuesday":true,"wednesday":true,"thursday":true,"friday":true,"saturday":false,"sunday":false}]},"planner":{"nextStartTimestamp":0,"override":{"action":"NOT_ACTIVE"},"restrictedReason":"NOT_APPLICABLE"},"metadata":{"connected":true,"statusTimestamp":1664783758328},"positions":[!!!removed!!!],"settings":{"cuttingHeight":6,"headlight":{"mode":"EVENING_AND_NIGHT"}},"statistics":{"numberOfChargingCycles":11,"numberOfCollisions":535,"totalChargingTime":32400,"totalCuttingTime":64800,"totalRunningTime":64800,"totalSearchingTime":0}}}]}
husqvarna-automower.0 2022-10-03 09:59:11.013 debug [getMowerData]: HTTP status response: 200 OK; config: {"transitional":{"silentJSONParsing":true,"forcedJSONParsing":true,"clarifyTimeoutError":false},"transformRequest":[null],"transformResponse":[null],"timeout":0,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"maxBodyLength":-1,"env":{},"headers":{"Accept":"application/json, text/plain, /","Authorization":"!!!removed!!!","Authorization-Provider":"husqvarna","User-Agent":"axios/0.27.2"},"method":"get","url":"https://api.amc.husqvarna.dev/v1/mowers"}; headers: {"content-type":"application/vnd.api+json","content-length":"3356","connection":"close","date":"Mon, 03 Oct 2022 07:59:11 GMT","x-amzn-requestid":"a790e49b-a4de-40d3-a441-07d1a12158e3","x-amzn-remapped-content-length":"3356","x-amzn-remapped-connection":"keep-alive","x-amz-apigw-id":"ZaxsXHjgjoEFsgg=","x-amzn-remapped-date":"Mon, 03 Oct 2022 07:59:10 GMT","x-cache":"Miss from cloudfront","via":"1.1 a4a80ac7ffee78c042728f52e3f729e0.cloudfront.net (CloudFront)","x-amz-cf-pop":"MUC50-P1","x-amz-cf-id":"KqXBlSsoxE_9t3axh-eL3PC1g5G2AY30SIgqZsW5lZKDHzRrnk7X2Q=="}; data: {"data":[{"type":"mower","id":"!!!removed!!!","attributes":{"system":{"name":"430X","model":"HUSQVARNA AUTOMOWER® 430X","serialNumber":!!!removed!!!},"battery":{"batteryPercent":88},"mower":{"mode":"MAIN_AREA","activity":"MOWING","state":"IN_OPERATION","errorCode":0,"errorCodeTimestamp":0},"calendar":{"tasks":[{"start":1080,"duration":360,"monday":true,"tuesday":true,"wednesday":true,"thursday":true,"friday":true,"saturday":true,"sunday":true},{"start":360,"duration":480,"monday":true,"tuesday":true,"wednesday":true,"thursday":true,"friday":true,"saturday":false,"sunday":false}]},"planner":{"nextStartTimestamp":0,"override":{"action":"NOT_ACTIVE"},"restrictedReason":"NOT_APPLICABLE"},"metadata":{"connected":true,"statusTimestamp":1664783758328},"positions":[!!!removed!!!],"settings":{"cuttingHeight":6,"headlight":{"mode":"EVENING_AND_NIGHT"}},"statistics":{"numberOfChargingCycles":11,"numberOfCollisions":535,"totalChargingTime":32400,"totalCuttingTime":64800,"totalRunningTime":64800,"totalSearchingTime":0}}}]}
husqvarna-automower.0 2022-10-03 09:58:41.110 debug [wss.on - pong]: WebSocket receives pong from server.
husqvarna-automower.0 2022-10-03 09:58:41.066 debug [sendPingToServer]: WebSocket sends ping to server...
`

But the objects are not updated by the adapter, they remain on the Timestamp of the adapter start / restart.

Can you please advise me, what I can do / check?

Aber die Objekte in IOBroker werden nicht aktualisert, sie bleiben auf dem Stand des Starts/Neustarts des Adapters.
Bitte um Hilfe, was ich prüfen/tun kann.

Thanks
Daniel

Danke Daniel

Version of Node.js

v16.16.0

Version of ioBroker js-controller

4.0.23

Version of "husqvarna-automower"-adapter

v0.3.0

Version of "admin"-adapter

v6.2.22

Operating system incl. version running ioBroker

TrueNAS-JAIL / Freebsd 12.2-RELEASE-p15

Checklist of files to include below

  • iobroker.current.log (Please share the logs in debug mode and check that there are no personal information)
  • Contents of the JavaScript browser console (always include in cases of issues with the user interface)

Additional information & file uploads

current.log

Hello,

I installed the development version "v0.3.1-beta.1" and uploaded a new log-file including installation of dev-version.
It seems that the "statusTimestamp" is now updated regularly, but the other objects like "batteryPercent" not.

In the Log-File the battery-level is received regularly!

Thank you.
BR
Daniel
current_2.log

it seems like your WebSocket connection is connected, but gets no data:

2022-10-03 19:03:11.460 - info: husqvarna-automower.0 (27266) Connection to "Husqvarna WebSocket" established. Ready to get data... 2022-10-03 19:03:11.460 - debug: husqvarna-automower.0 (27266) [sendPingToServer]: WebSocket sends ping to server... 2022-10-03 19:03:11.503 - debug: husqvarna-automower.0 (27266) [wss.on - pong]: WebSocket receives pong from server. 2022-10-03 19:03:11.571 - debug: husqvarna-automower.0 (27266) [wss.on - message]: {"ready":true,"connectionId":"ZcBYbfS7joECF7w="} ... 2022-10-03 19:12:41.463 - debug: husqvarna-automower.0 (27266) [sendPingToServer]: WebSocket sends ping to server... 2022-10-03 19:12:41.507 - debug: husqvarna-automower.0 (27266) [wss.on - pong]: WebSocket receives pong from server.

all the DP's should be updated via the WebSocket connection, except the DP's under statistics. They are updated via the interval with the value you entered in the admin-panel.

could you please try to remove/delete your "Authentication API" and "Automower Connect API" under https://developer.husqvarnagroup.cloud/applications and create new ones, with a new connection to ioBroker?

Hello,

I have renewed the application secret, but it did not work.
After that, I deleted the whole application in the husqvarna portal and created a new application with two connected APIs:
Autentication API and Automower Connect API.

One question, if this could be the root cause... What do I have to enter in the field "Redirect URLs" in the Application creation?
I entered http://localhost:5000 and https://example.com like in the documentation. Is this correct?

The result in the log file is the same:
`

husqvarna-automower.0 2022-10-05 19:30:30.418 debug [wss.on - pong]: WebSocket receives pong from server.
husqvarna-automower.0 2022-10-05 19:30:30.373 debug [sendPingToServer]: WebSocket sends ping to server...
husqvarna-automower.0 2022-10-05 19:21:00.459 debug [wss.on - message]: {"ready":true,"connectionId":"Zip3cfkdDoECIhA="}
husqvarna-automower.0 2022-10-05 19:21:00.412 debug [wss.on - pong]: WebSocket receives pong from server.
husqvarna-automower.0 2022-10-05 19:21:00.369 debug [sendPingToServer]: WebSocket sends ping to server...
husqvarna-automower.0 2022-10-05 19:21:00.368 info Connection to "Husqvarna WebSocket" established. Ready to get data...
`

What else can we try?

are the values f.ex. in the iphone husqvarna app up to date?

Yes, the iphone is updated regularly... I would say every minute or 2 minutes.

If you want to, I can send you my husqvarna key and shared secret, so that I allow you for the next 10 minutes to check it yourself... After that I would renew the key for security reasons...

i just checked, i can't reproduce this issue wity my mower. if you want, you can share your credentials.

You have a Mail... Please notify me, when you are finished with testing...

As discussed: testing finished. Please let me if there are new/additional information available.

Hello,
I was in contact with the husqvarna dev-support and they found out, that their backend received data from my mower, but somehow the server did not send out websocket status updates.
Now it is working, it was not a bug of this adapter. -> issue closed!

Thank you very much for your great help!

BR
Daniel