flopp999 / NIBEUplink-Domoticz

Script for collecting data from NIBE. Support me with a coffee or use my Tibber link https://tibber.com/se/invite/8af85f51
https://www.buymeacoffee.com/flopp999
MIT License
5 stars 1 forks source link

Domoticz code not working due to refresh token (where to find, no explanation given) #32

Closed Keulma01 closed 2 years ago

Keulma01 commented 3 years ago

In the DOMOTICZ system i need to fill in a Refresh Token ... where do i find it and to my knowledge it is only generated after i have access the system for the first time ... but the system will not start without that ... what do i do wrong?

flopp999 commented 3 years ago

Hi, I have missed this issue, sorry. It should be visible in Domoticz Log. Can you try again and see if the refresh token is printed out in DZ Log.

Keulma01 commented 3 years ago

Hi Flop999, no problem, I will clean out my Raspberry this weekend and start all over again. I will record the steps that I make and tell you where things go differently ...

Like the fact that you make it a domoticz plugin, other things i think you need to steal from the original program :-) ...

Hope you can wait that long ;-) ..

have a good day !

Op wo 13 okt. 2021 om 08:16 schreef flopp999 @.***>:

Hi, I have missed this issue, sorry. It should be visible in Domoticz Log. Can you try again and see if the refresh token is printed out in DZ Log.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/flopp999/NIBEUplink-Domoticz/issues/32#issuecomment-941957819, or unsubscribe https://github.com/notifications/unsubscribe-auth/AV6HLCRDECMNU43YVI5XPTDUGUP3NANCNFSM5FPNNZ4A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

flopp999 commented 3 years ago

no problem, do that in the weekend and reply

Keulma01 commented 3 years ago

Feedback for Flopp999 on NIBEUplink plugin for Domoticz

In case of manual installing:

Put plugin.py, requirements.txt and NIBEUplink.zip in that folder.

The first time I ran this I did not have the .zip file and the plugin stopped at that point with an error message.

With the authorization, I could do the things you advised, including copying the code from the low, I however found the following errors:

021-10-17 10:55:19.630 NIBE FLOPP: (NIBE FLOPP) Systems found:2

2021-10-17 10:55:22.313 NIBE FLOPP: (NIBE FLOPP) SMO40 Updated

2021-10-17 10:55:49.239 Error: (NIBE FLOPP) Device creation failed, Hardware/Unit combination (2:222) already exists in Domoticz.

2021-10-17 10:55:50.669 NIBE FLOPP: (NIBE FLOPP) F2120 Updated

2021-10-17 10:55:50.266 Error: CPlugin:CDevice_init, illegal Unit number (256), valid values range from 1 to 255.

2021-10-17 10:55:50.267 Error: Device refresh failed, Device object is not associated with a plugin.

2021-10-17 10:56:20.527 NIBE FLOPP: (NIBE FLOPP) SMO40 Updated

2021-10-17 10:56:49.674 Error: CPlugin:CDevice_init, illegal Unit number (256), valid values range from 1 to 255.

2021-10-17 10:56:49.674 Error: (NIBE FLOPP) Device creation failed, Hardware/Unit combination (2:-1) already exists in Domoticz.

IDx 79 is weird:

79

NIBE FLOPP

-1

NIBE FLOPP - version

Interface Control

Unknown

0,

Hope this helps, I renamed the systems to what my system has (SMO40 and F2120), now I have to figure out what the error messages are …

Op wo 13 okt. 2021 om 21:03 schreef flopp999 @.***>:

no problem, do that in the weekend and reply

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/flopp999/NIBEUplink-Domoticz/issues/32#issuecomment-942626959, or unsubscribe https://github.com/notifications/unsubscribe-auth/AV6HLCXV2K6VYOFGH3GSAKDUGXJXRANCNFSM5FPNNZ4A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

flopp999 commented 3 years ago

missing ZIP-file is fixed in version 0.88 https://github.com/flopp999/NIBEUplink-Domoticz/tree/0.88

Last week I came up that there will be problem with system 2 and higher. Since there is 127 IDs for System 1 and then I just add 130 to the IDx for System 2, this creates an error since there is a risk that ID 127 + 130 will be used in System2

Would it be possible for you to send a list for all IDx you have for NIBE plugin, then I maybe can find a solution. Thanks

flopp999 commented 3 years ago

I have now updated the README, thanks for telling me this.

Do you have a list for the devices that you need?

zeebos commented 2 years ago

Hi Flopp999,

I've been trying to get your script working and i manage to get the initial reading working and getting the values from my nibe system. But the problem i have is it will not refresh the data, and I'm not sure where to find the refresh token?

The log file states the following:

2021-12-10 03:27:27.160522 ===onStart=== 2021-12-10 03:27:27.160656 Refresh too short 2021-12-10 03:27:37.092566 onHeartbeat 2021-12-10 03:27:37.242625 onConnect 2021-12-10 03:27:37.242969 Entered CheckInternet 2021-12-10 03:27:37.243092 Ping 2021-12-10 03:27:37.369153 Internet is OK 2021-12-10 03:27:37.369473 Get Token 2021-12-10 03:27:37.420691 Status = 400 2021-12-10 03:27:37.421414 onDisconnect called for connection 'Get Token'.

I've set something random in the refresh filed to get it to start, but i just can't seem to get my head around where the refresh token is, could you please help me out?

regards, Z

flopp999 commented 2 years ago

Hi zeebos,

what version do you use? When you start the plugin it should print the Refresh token in the DZ log.

zeebos commented 2 years ago

Hi flopp999,

Thank you for answering, I'm running 0.89 version. And thank you for point out the obvious, if you look you find...appologies for my lack of eye sight. Thank you for great work, very appriciated!

Lundmatt commented 2 years ago

Hi @flopp999, I can ont find the refresh token in the DZ log... What should I look for?

2022-01-07 19:49:49.682 Error: NIBEUplink: (NIBEUplink) Status 400 2022-01-07 19:49:49.683 Error: NIBEUplink: (NIBEUplink) {'Status': '400', 'Headers': {'Cache-Control': 'no-cache, no-store, max-age=0, must-revalidate', 'Pragma': 'no-cache', 'Content-Length': '27', 'Content-Type': 'application/json; charset=utf-8', 'Server': 'Microsoft-IIS/10.0', 'X-AspNetMvc-Version': '5.2', 'X-AspNet-Version': '4.0.30319', 'X-Powered-By': 'ASP.NET', 'Set-Cookie': ['ARRAffinity=65ae3a5d9eea21abf7c1467a88d0de16bfb107af58080e2103c4141da03474d1;Path=/;HttpOnly;Secure;Domain=api.nibeuplink.com', 'ARRAffinitySameSite=65ae3a5d9eea21abf7c1467a88d0de16bfb107af58080e2103c4141da03474d1;Path=/;HttpOnly;SameSite=None;Secure;Domain=api.nibeuplink.com'], 'Date': 'Fri, 07 Jan 2022 18:49:48 GMT'}, 'Data': b'{"error":"invalid_request"}'}

flopp999 commented 2 years ago

Hi Did you follow all steps? Did you get a long token when you get the token in the address bar?

Lundmatt commented 2 years ago

Hi @flopp999, I would say yes. I followed all the steps it is only the refresh token that is missing. I would say?

Any suggestion on what could be wrong?

Thanks.

mccwdev commented 2 years ago

Same here, I got the access code from the address bar, and the module does retrieve data.

But I couldn't find and refresh token in the logs. And when Domoticz is restarted the connection is lost.

flopp999 commented 2 years ago

it is working for me image

Do you get any error codes that would be helpful

mccwdev commented 2 years ago

Hi, thanks for your fast reply!

This is a copy-paste from the logs.

2022-01-09 21:50:16.204 Status: Nibe: (Nibe) Started. 2022-01-09 21:50:16.204 Status: Nibe: (Nibe) Entering work loop. 2022-01-09 21:50:17.568 Status: Nibe: (Nibe) Initialized version 0.89, author 'flopp999' 2022-01-09 21:51:57.604 Error: CPlugin:CDevice_init, illegal Unit number (256), valid values range from 1 to 255. 2022-01-09 21:51:57.615 Error: Device refresh failed, Device object is not associated with a plugin. 2022-01-09 21:52:07.814 Error: CPlugin:CDevice_init, illegal Unit number (256), valid values range from 1 to 255. 2022-01-09 21:52:07.815 Error: (Nibe) Device creation failed, Hardware/Unit combination (18:-1) already exists in Domoticz.

There is a device added with idx -1 and the subtype and data field seem incorrect: 32563 Nibe -1 Nibe - version Interface Control Unknown 0,

Lundmatt commented 2 years ago

Hi @flopp999 , I got it working but I do not know what I made so it started working... I changed owner and access rights on some of the files in the NIBElink directory. I also fiddles with the settings in the plugin especially the last three parameters. Then at one place I got the refresh token in the log. Thanks for the support