Recently started getting my smarter devices into domoticz. After somewhat of a learning curve I now have several pieces of hardware working.
Next wanted to get the NIBE RPC python plugin working and that has been quite a challenge. I started with new PI4 and the latest domoticz, all worked except for python plugins. The few python plugins I wanted to enable all caused domoticz to stop. Eventually came to this post:
viewtopic.php?t=37376 which indicated issues with python versions and the RASPIAN bullseye version. Somewhere in here is a suggestion to build domoticz from source. Did that and now at least when I define the NIBE API python plug in it does not cause domoticz to crash.
But not yet out of the woods.
I think I followed the instructions from flopp at
https://github.com/flopp999/NIBEUplink-Domoticz
so I have uplink identifier, secret, callback url, access code. What I do not have is info on the refresh token. I left that at "Copy Refresh Token from Log to here". I guess somehow when an access is successful that the token is returned by the API and then next time found in the log?
After putting in my definitions, the HW device is added to the list of domoticz hardware. But it does not expand into devices, That is likely because the access to the NIBE API seems to fail. I get following error in the log:
2022-02-20 16:00:50.273 Error: NIBE: Status 400
2022-02-20 16:00:50.273 Error: NIBE: {'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=77f12f85c9afc4c4219e1ebcbabf3c363c124c1272c6f1766e41bee0c3ed9b13;Path=/;HttpOnly;Secure;Domain=api.nibeuplink.com', 'ARRAffinitySameSite=77f12f85c9afc4c4219e1ebcbabf3c363c124c1272c6f1766e41bee0c3ed9b13;Path=/;HttpOnly;SameSite=None;Secure;Domain=api.nibeuplink.com'], 'Date': 'Sun, 20 Feb 2022 15:00:50 GMT'}, 'Data': b'{"error":"invalid_request"}'}
Suggestions on following welcome:
a) what do I have to do with the refresh token if anything
Answer 1:
When you read this post, I did some more digging and came across some bug reports in github. So indeed you would define the NIBE plugin first with the 4 initial parameters and indeed once the plug in has started it will show the refresh token in the domoticz log.
b) any suggestions as to next steps to debug the status 400?
Answer 2:
The 400 error also has been signaled in a bug report on github before and there was no clear solution. the person reported "fiddled" around with nibe parameters and "somehow" eventually got it working. As I found more problems with the domoticz program built from source in the python area, I decided to start with a clean install based on the previous PI OS buster and add domoticz. I found this combination to be stable from a python plugin perspective. I installed among others a goodwe plugin which gave me issues on the previous bullseye setup. The goodwe one worked like a charm.
Adding the nibe plugin again I got the same 400 error. After "fiddling around" on the NIBE website and adding / deleting the NIBE Hw defintions on domoticz and with my 3rd application defined on the NIBE website, it somehow magically started to work. Saw the refresh token show up. Noticed by the way I can add / update apps on the NIBE website, but do not see an option to delete any of them.
c) Still have one small issue, adding the NIBE plugin, I have 2 recurring error messages in the log:
2022-02-26 08:56:32.351 Error: CPlugin:CDevice_init, illegal Unit number (256), valid values range from 1 to 255.
2022-02-26 08:56:32.352 Error: (NIBE) Device creation failed, Hardware/Unit combination (4:-1) already exists in Domoticz.
2022-02-26 08:56:34.058 NIBE: System 2 Updated
Curious is that I have defined a 10 minute interval to get parameters from the NIBE website. Above messages however show up more regularly. Have not yet determined the logic when these show.
Will update once I have more time to investigate.