Page 8 of 9

Re: Domoticz RPC for NIBE Uplink

Posted: Thursday 08 April 2021 10:27
by Stefan1512
Hello guys,
I'm trying to get this plugin working for days because I would like to push the data from the NIBE Uplink site (via Domoticz) to influx to present the data in Grafana. I even tried Home Assistant with their plugin which does give me the data but I find it less user-friendly/newbie friendly.
I hope Flopp or someone else can help me get his plugin working, for now this is what the Domoticz log tells me:

Code: Select all

2021-04-08 10:21:06.624 Status: (NIBE Uplink) Started.
2021-04-08 10:21:06.625 Status: Incoming connection from: 192.168.1.128
2021-04-08 10:21:07.197 (NIBE Uplink) Refresh too short
2021-04-08 10:21:07.189 Status: (NIBE Uplink) Initialized version 0.71, author 'flopp999'
2021-04-08 10:21:07.188 Status: (NIBE Uplink) Entering work loop.
2021-04-08 10:21:07.412 Error: (NIBE Uplink) Status 401
2021-04-08 10:21:07.412 Error: (NIBE Uplink) {'error': 'invalid_client', 'error_description': 'The client secret was incorrect.'}
2021-04-08 10:21:17.401 Error: (NIBE Uplink) 'onConnect' failed 'AttributeError':''BasePlugin' object has no attribute 'reftoken''.
2021-04-08 10:21:17.401 Error: (NIBE Uplink) ----> Line 407 in '/home/pi/domoticz/plugins/NIBEUplink/plugin.py', function onConnect
2021-04-08 10:21:17.401 Error: (NIBE Uplink) ----> Line 172 in '/home/pi/domoticz/plugins/NIBEUplink/plugin.py', function onConnect

Re: Domoticz RPC for NIBE Uplink

Posted: Friday 09 April 2021 14:28
by Flopp
Hi, are you sure that the Secret is correct?

The error says invalid secret

Re: Domoticz RPC for NIBE Uplink

Posted: Saturday 10 April 2021 20:26
by Stefan1512
Yes I tried it with the Home Assistant plugin and then it does work. I don't get why the secret would be wrong. It's all copy paste from the NIBE api. I could send you the data if you DM me?

I tried to play around with the other plugin and maybe the Access Code was different via the Github link.. This time this is the error:

Code: Select all

 2021-04-10 20:49:03.719 Error: (F1155-12) Status 400
2021-04-10 20:49:03.719 Error: (F1155-12) {'error': 'invalid_request'}
2021-04-10 20:49:13.728 Error: (F1155-12) 'onConnect' failed 'AttributeError':''BasePlugin' object has no attribute 'reftoken''.
2021-04-10 20:49:13.728 Error: (F1155-12) ----> Line 407 in '/home/pi/domoticz/plugins/NIBEUplink/plugin.py', function onConnect
2021-04-10 20:49:13.728 Error: (F1155-12) ----> Line 172 in '/home/pi/domoticz/plugins/NIBEUplink/plugin.py', function onConnect
2021-04-10 20:51:19.965 Error: (F1155-12): Async Secure Read Exception: 104, Connection reset by peer

Re: Domoticz RPC for NIBE Uplink

Posted: Sunday 11 April 2021 0:06
by Flopp
I have sent a message to you

Re: Domoticz RPC for NIBE Uplink

Posted: Sunday 11 April 2021 11:56
by Stefan1512
Thanks, I see that unfortunately I'm still not able to send PM's... ***EDIT now it works, I've sent you a PM now***

Re: Domoticz RPC for NIBE Uplink

Posted: Sunday 30 May 2021 10:32
by Conehead
Hi Guts
I'm a new to Domoticz and home automation, have some switches and temp sensors installed so far and a Rasberry running the system
Recently we installed a new Nibe F2120/VVM S320 and would like to be able to get fetch data from my system via myuplink.com

You guys seem to have the knowledge to make this happen and wonder if its possible to adapt this module to the new Nibe site app.myuplink.com

It uses an API similar but not the same as for the (older) nibeuplink.com site, some info can be found here https://dev.myuplink.com/
Login is needed to see more

Can you look into this or is it to much work to be done to help?
I cannot figure out how to get data from this site, my knowledge on API/oAuth2/Json is near to zero

Can you help me and possible others with this?


Here is some parts from the site, not so much info... :
-------------------------
The myUplink API is a RESTful api, relying on established conventions from the HTTP specification. As an example, the API relies on the client to use HTTP methods such as GET, POST, PUT, DELETE to describe the action to perform on a resource and it indicates the success or failure of that action by returning a HTTP status code.

All access is over HTTPS, and is provided over the api.myuplink.com domain.

Data Format
All data is sent and received as JSON. The client needs to specify the Content-Type and Accept headers as either application/json or text/json.

Blank fields are included as null instead of being omitted. All timestamps are returned with the ISO-8601 format (YYYY-MM-DDTHH:MM:SSZ) in UTC.

Parameters
API functions have both required and optional parameters. For GET requests, parameters not specified in the request URL, no matter if they are required or optional, should be provided as query paramaters. For POST, PUT and DELETE requests, the same parameters should be provided as JSON in the request body.

Parameter example
The following API functions has one parameter specified in the request URL (systemId and type), and a couple of required and optional parameters which are not (type, active, page and itemsPerPage)

GET /v2/systems/{systemId}/notifications

And can therefore be called either with only the mandatory parameters or with any of the optional parameters

GET /v2/systems/435/notifications
GET /v2/systems/435/notifications?page=1&itemsPerPage=2

............................................

Thanks in advance

Re: Domoticz RPC for NIBE Uplink

Posted: Tuesday 12 October 2021 21:47
by Musky
Flopp wrote: Tuesday 23 March 2021 23:43
Timothy wrote:
@Timothy
thank you very much @Timothy for your help and patience while I was checking the plugin.

We found some bugs which now shall be fixed

If more people can try the plugin I would be glad.

I will continue to develop the plugin after I get information from you users.
Dear Flopp,

Thanks a million for your software, I like the fact that it is a plug in for Domoticz
Installed your software and got it running after some tweaks with the authorisation codes.
However, the software stops by itself after a while, first one day, now three days … unfortunately no error codes in Domoticz

Suggestion for the software:
Use the same mechanism of storing and retrieving the authorisation codes as in RPC code, much more elegant
Update your installing guide with telling people to copy the Nibe pictures as well, this caused an error with me
Your system is different from any other Nibe system and your system_2 parameters are different from mine, hence I guess you need to automate the Nibe parameter link to Domoticz idx sensors … fixed numbers and parameters as you have today requires quite some changes in the code for everyone …

Also personally I think every 5 or 15 minutes a download of the information is more than enough … maybe enhancement?

Happy to converse more, but as novice I am not allowed to send you a direct message.

Regards, musky

Re: Domoticz RPC for NIBE Uplink

Posted: Wednesday 13 October 2021 8:02
by Flopp
Musky wrote: Tuesday 12 October 2021 21:47 However, the software stops by itself after a while, first one day, now three days … unfortunately no error codes in Domoticz
Have you activate Debug for the plugin? If yes, please see NibeUplink.log for more details. If not please activate Debug. You will find it in plugin settings.
Musky wrote: Tuesday 12 October 2021 21:47 Suggestion for the software:
Use the same mechanism of storing and retrieving the authorisation codes as in RPC code, much more elegant
i will check how it was done
Musky wrote: Tuesday 12 October 2021 21:47 Update your installing guide with telling people to copy the Nibe pictures as well, this caused an error with me
what picture? please reply with link or example
Musky wrote: Tuesday 12 October 2021 21:47 Your system is different from any other Nibe system and your system_2 parameters are different from mine, hence I guess you need to automate the Nibe parameter link to Domoticz idx sensors … fixed numbers and parameters as you have today requires quite some changes in the code for everyone
Maybe I have set it wrong, please tell me what you need to change and maybe I can change this in the code
Musky wrote: Tuesday 12 October 2021 21:47 Also personally I think every 5 or 15 minutes a download of the information is more than enough … maybe enhancement?
will see if I can make a setting for this

You can always upload an issue here
https://github.com/flopp999/NIBEUplink-Domoticz

Re: Domoticz RPC for NIBE Uplink

Posted: Sunday 24 October 2021 9:58
by Musky
Flopp wrote: Wednesday 13 October 2021 8:02
Musky wrote: Tuesday 12 October 2021 21:47 However, the software stops by itself after a while, first one day, now three days … unfortunately no error codes in Domoticz
Have you activate Debug for the plugin? If yes, please see NibeUplink.log for more details. If not please activate Debug. You will find it in plugin settings.

Thanks Flop999, discovered the debug lines and working with them all got working :-) ... so happy man now !!
Musky wrote: Tuesday 12 October 2021 21:47 Suggestion for the software:
Use the same mechanism of storing and retrieving the authorisation codes as in RPC code, much more elegant
i will check how it was done
Musky wrote: Tuesday 12 October 2021 21:47 Update your installing guide with telling people to copy the Nibe pictures as well, this caused an error with me
what picture? please reply with link or example

Flop999, these are the pictures you supplied, but saw you have updated the manual install, so all is fine :-)
Musky wrote: Tuesday 12 October 2021 21:47 Your system is different from any other Nibe system and your system_2 parameters are different from mine, hence I guess you need to automate the Nibe parameter link to Domoticz idx sensors … fixed numbers and parameters as you have today requires quite some changes in the code for everyone
Maybe I have set it wrong, please tell me what you need to change and maybe I can change this in the code

Flop999, i will send you the information per email, but it is quite some work, some sensors are not used, some are used differently (specially the AUX ones). Hence to automate all of that is a hell of a job if you want the code to be working for every possible NIBE configuration. I think your code is good enough for people who know Python to start working and ammend it for their own system ... like i did :-)
Musky wrote: Tuesday 12 October 2021 21:47 Also personally I think every 5 or 15 minutes a download of the information is more than enough … maybe enhancement?
will see if I can make a setting for this

Thanks, i now get updates every 30 seconds .. nice but in my case not needed (others may want that however to debug/optimize their systems). The total system is rather slow (it takes some time to heat things up) hence one does not need to sample quickly in my opinion.

You can always upload an issue here
https://github.com/flopp999/NIBEUplink-Domoticz
Have put the bugs in the github ... and once again THANK YOU VERY MUCH for the superb work ....

Could not figure out how to comment on your comments on my comments ... hence it all got a bit "strange" ... sorry!

Re: Domoticz RPC for NIBE Uplink

Posted: Sunday 20 February 2022 16:53
by hans2022
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.

Re: Domoticz RPC for NIBE Uplink

Posted: Sunday 20 February 2022 18:13
by waltervl
There is currently an issue with python plugins on RPi Buster OS. It is worked on and first solution seems to come after the weekend. For more info check topic viewtopic.php?t=37376

Re: Domoticz RPC for NIBE Uplink

Posted: Wednesday 18 May 2022 12:01
by moi427
I described my problems in topic viewtopic.php?p=289838#p289838.
NibeUplink RPC stopped working at May 11th (11-05-2022) and I haven't been able to get it properly working again (not being a Linux or Python programmer). Also couldn't get flopp999/NIBEUplink-Domoticz working, a pitty.
For me yesterday the final solution was restoring an image from May 1st of the entire SD card and now it is working again.
So I don't know if the cause still are Python problems or not, but until I read more about successes I won't perform further updates.

==>UPDATE: curiously this worked for about half a day or so, then the Nibeuplink didn't update the values anymore. I'm getting entirely unhappy of this and can't get it working, despite getting new secret values etc. etc.. :(
I also reinstalled plugin manager, but didn't get a tab etc., so changed the type to the first version and that shows the tab "Eigen" with Plugins-Manager for the plugins. It also doesn't mention in the log that some plugins can't be managed by PP-MANAGER, like "NIBEUplink cannot be managed with PP-Manager", but that's obvious: Nibeuplink isn't mentioned in this dropdown so unknown. So changed the type to the "Python Plugin Manager" and the log again shows a.o. "PP-Manager: Plugin:NIBEUplink cannot be managed with PP-Manager!!.". The tab "Eigen" that was created with the former version remains this way, but only show "Loading", no plugins.

When changing the plugin type, I looked if Nibe was there: there's indeed a plugin mentionedNibe Uplink 0.90 :o With that you can enter the values for secret etc. in the hardware specs, so II'll try that to see what happens since this differs from the Nibe plugin that runs for some years "Dummy (Does nothing, use for virtual switches only)". That script works via /home/pi/domoticz/scripts/NibeUplink/config.json specs running every 5 minutes via cron. Interesting, I haven't found updates about the nibeuplink script (or missed the new approach), so perhaps this will hopefully be the clue of my problems!
I'll try this later on.

UPDATE 01-06-2022
Quit a while later due to other work. The problem seems to be solved: Flop's plugin is finally running and the "old" RPC is deleted.

Re: Domoticz RPC for NIBE Uplink

Posted: Wednesday 14 September 2022 22:09
by riob
I have changed IP scope on my network, since then Nibe uplink does not run..... Whats the easy fix for that?

Regards Rickard

Re: Domoticz RPC for NIBE Uplink

Posted: Wednesday 14 September 2022 22:42
by Flopp
riob wrote: Wednesday 14 September 2022 22:09 I have changed IP scope on my network, since then Nibe uplink does not run..... Whats the easy fix for that?

Regards Rickard
Check that the IP in Nibe plugin is correct for your Nibe system

Re: Domoticz RPC for NIBE Uplink

Posted: Thursday 15 September 2022 6:41
by riob
Flopp wrote: Wednesday 14 September 2022 22:42
riob wrote: Wednesday 14 September 2022 22:09 I have changed IP scope on my network, since then Nibe uplink does not run..... Whats the easy fix for that?

Regards Rickard
Check that the IP in Nibe plugin is correct for your Nibe system
Can you pls point me in right direction for where / how change ip!?

Re: Domoticz RPC for NIBE Uplink

Posted: Thursday 15 September 2022 6:56
by Flopp
Sorry I was wrong.
If you check in your Nibe system, does it say that you have internet?
Did you use static IP before you change your range in router?

Re: Domoticz RPC for NIBE Uplink

Posted: Thursday 15 September 2022 16:24
by riob
Flopp wrote: Thursday 15 September 2022 6:56 Sorry I was wrong.
If you check in your Nibe system, does it say that you have internet?
Did you use static IP before you change your range in router?
Nibe heatpump is connected to Internet and Nibe uplink, probably fixed ip on heat pump before

Re: Domoticz RPC for NIBE Uplink

Posted: Wednesday 21 September 2022 22:39
by riob
My current ip of the raspberry pi is 192.168.68.70
Before it was as below (copy from Putty console)

pi@raspberrypi:~ $ python /home/pi/domoticz/scripts/NibeUplink/nibeuplink.py
(u"Can not open domoticz URL: 'http://192.168.1.60:8080/json.htm'", <class 'requests.exceptions.ConnectionError'>)
pi@raspberrypi:~ $


what to do?

Regards Rickard

Re: Domoticz RPC for NIBE Uplink

Posted: Wednesday 21 September 2022 23:51
by waltervl
You probably have to modify the config file with the correct op adress
/home/pi/domoticz/scripts/NibeUplink/config.json

Re: Domoticz RPC for NIBE Uplink

Posted: Thursday 22 September 2022 7:24
by riob
waltervl wrote: Wednesday 21 September 2022 23:51 You probably have to modify the config file with the correct op adress
/home/pi/domoticz/scripts/NibeUplink/config.json
Found it!! Thanks!!

I have three Nibe F370 in my system, quite hard to separate them.....