Chris-656 / ioBroker.fitbit-fitness

Retrieves Fitbit data
https://forum.iobroker.net/topic/52852/fitbit-adapter-new
MIT License
3 stars 5 forks source link

Adapter seems to fail when used with js-controller 5 #13

Closed mcm1957 closed 11 months ago

mcm1957 commented 1 year ago

This adapter seems to be incompatible with js-controller 5

See https://forum.iobroker.net/topic/68328/fitbit-app-l%C3%A4uft-mit-js-controller-5-0-12-nicht-mehr

mcm1957 commented 1 year ago

According zu other feedback the adapter seems to work

https://forum.iobroker.net/topic/68290/js-controller-5-0-x-jetzt-f%C3%BCr-alle-user-im-stable/86

Ilovegym66 commented 1 year ago

Hi, I tested and make some try with different and no data incoming.. The adapter crash here too, if no data from the Fitbit is coming, example: I have no Fitbit device, but select the option on in the settings, than the adapter crash with the faults above..

So as a workaround for everybody, select in the adapter settings only what you have on devices and data can be coming in... ( in my config is only weight selected, this works fine)

boergegrunicke commented 1 year ago

For me, it crashes, as soon as I enable syncing the activity data. I have a device and the battery state is shown correctly, even my weight is synced and this is imported from another service. But without the actual activity data, it is failed the main goal for my understanding. I would be thankful for a fix.

BenAhrdt commented 1 year ago

Es scheint an den "Aktivitäten" zu liegen. Deaktiviert man diese. image Läuft es. Sobald man sie wieder rein nimmt:

`

fitbit-fitness.0 | 2023-09-26 07:35:05.299 | error | undefined is not a valid state value -- | -- | -- | -- fitbit-fitness.0 | 2023-09-26 07:35:05.299 | error | Error: undefined is not a valid state value at Object.maybeCallbackWithError (/opt/iobroker/node_modules/@iobroker/js-controller-common/build/lib/common/maybeCallback.js:35:17) at FitBit._setState (/opt/iobroker/node_modules/@iobroker/js-controller-adapter/build/lib/adapter/adapter.js:5439:49) at FitBit.setState (/opt/iobroker/node_modules/@iobroker/js-controller-adapter/build/lib/adapter/adapter.js:5400:21) at FitBit.setActivityStates (/opt/iobroker/node_modules/iobroker.fitbit-fitness/main.js:321:9) at FitBit.getActivityRecords (/opt/iobroker/node_modules/iobroker.fitbit-fitness/main.js:305:15) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async FitBit.getFitbitRecords (/opt/iobroker/node_modules/iobroker.fitbit-fitness/main.js:87:5) fitbit-fitness.0 | 2023-09-26 07:35:05.297 | error | unhandled promise rejection: undefined is not a valid state value fitbit-fitness.0 | 2023-09-26 07:35:05.297 | error | Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch().

`

boergegrunicke commented 1 year ago

Wenn einer der Werte noch leer ist (zum Beispiel die Stockwerke), dann crasht es. Scheinbar sendet Fitbit die Daten in dem Fall einfach nicht. In meinem Pull request (#14) ist das Problem abgefangen

BenAhrdt commented 1 year ago

Ok. Wie bekommt man den zum Test auf sein System? Github Installation vom Adapter?

boergegrunicke commented 1 year ago

Du müsstest ihn direkt aus der URL (https://github.com/boergegrunicke/ioBroker.fitbit-fitness/tree/main) installieren können, denke ich.

Chris-656 commented 1 year ago

Hallo zusammen, Ich werde mir das ansehen. Werde alsbald neue Release mit den Korrekturen absetzen. lG Chris

Chris-656 commented 1 year ago

New version 0.4.11 released please check, thx to @boergegrunicke

mcm1957 commented 1 year ago

Thanks for release. Should be available at latrs repo this afternoon.

Please create a stable PR if tests are successful and mention js-controller 5 fix to process it at fadt kane if desired.

BenAhrdt commented 1 year ago

@Chris-656 0.4.11 will be in stable soon, or have i to install it from the github link in iobroker?

mcm1957 commented 1 year ago

Please comment if problem still exists with 0.4.11. Oterhwise I will close this issue in end of october.

BenAhrdt commented 1 year ago

Problem still existent with 0.4.11

boergegrunicke commented 1 year ago

@BenAhrdt In this case, please post some logs, to make understandable, what is going wrong. For me, everything is fine now.

BenAhrdt commented 1 year ago

`

fitbit-fitness.0 | 2023-10-25 04:49:43.469 | error | Adapter Connection: Error: AxiosError: Request failed with status code 401 -- | -- | -- | -- fitbit-fitness.0 | 2023-10-25 04:49:43.177 | info | starting. Version 0.4.11 in /opt/iobroker/node_modules/iobroker.fitbit-fitness, node: v18.18.2, js-controller: 5.0.12 fitbit-fitness.0 | 2023-10-25 04:49:42.811 | debug | States connected to redis: 127.0.0.1:9000 fitbit-fitness.0 | 2023-10-25 04:49:42.748 | debug | States create User PubSub Client fitbit-fitness.0 | 2023-10-25 04:49:42.747 | debug | States create System PubSub Client fitbit-fitness.0 | 2023-10-25 04:49:42.734 | debug | Redis States: Use Redis connection: 127.0.0.1:9000 fitbit-fitness.0 | 2023-10-25 04:49:42.704 | debug | Objects connected to redis: 127.0.0.1:9001 fitbit-fitness.0 | 2023-10-25 04:49:42.700 | debug | Objects client initialize lua scripts fitbit-fitness.0 | 2023-10-25 04:49:42.658 | debug | Objects create User PubSub Client fitbit-fitness.0 | 2023-10-25 04:49:42.657 | debug | Objects create System PubSub Client fitbit-fitness.0 | 2023-10-25 04:49:42.655 | debug | Objects client ready ... initialize now fitbit-fitness.0 | 2023-10-25 04:49:42.585 | debug | Redis Objects: Use Redis connection: 127.0.0.1:9001

`

mcm1957 commented 1 year ago

I do not see an error.

BenAhrdt commented 1 year ago

@mcm1957 doch der erste Eintrag. Axios error 401. Es werden keine Daten aktualisiert, der Adapter bleibt gelb. Die ist seit js. 5.x so

mcm1957 commented 1 year ago

Ups richtig. Das ist aber offensichtlich ein anderer Fehler als in 0.4.10. Mal abwarten was @boergegrunicke dazu sagt. 4xx sind normalerweise Berechtigungsfehler.

boergegrunicke commented 1 year ago

401 ist nicht autorisiert und deutet wohl darauf hin, dass die Anmeldung nicht mehr gültig ist. In den Adaptereinstellungen einmal "Update Token" sollte das Problem beheben.

BenAhrdt commented 1 year ago

@boergegrunicke ich habe es schon mal aktualisiert. Lief ca. 3 Tag…. Habe es jetzt wieder gemacht. Adapter ohne Fehler…. Allerdings immer noch kein Eintrag beim Puls… ich weiß anderes issue. ![Uploading 7D05F976-DB1F-47C4-AB98-89CA407DB598.jpeg…]()

mcm1957 commented 11 months ago

Ist diese Problem mit 0.5.0 gefixet ?

mcm1957 commented 11 months ago

Feedback at PR https://github.com/ioBroker/ioBroker.repositories/pull/2960

In my environment:
starting. Version 0.4.10 in /opt/iobroker/node_modules/iobroker.fitbit-fitness, node: v16.20.2, js-controller: 5.0.12
it works fine without any issues
regards Chris

So lets close here

BenAhrdt commented 11 months ago

Scheint gefixt zu sein, aber wurde auch deinstalliert