The myuplink api also seems to support simpler authentication, you just need to supply the client id and client secret to get a authorization token (no need for a complete oauth flow) so it should be possible to implement just using rules with the sendHttp*Request actions (or if using jsr223 rules a http library from the script language).
Used documentation on Swagger UI
This is the call & result. Mobile app has a lot more data - had hoped that is accessible through API
curl -X GET “https://api.myuplink.com/v2/devices/xxxxxxxx-xxxx-xx-xx-xx-x-xx/points” -H “accept: text/plain” -H “Authorization: Bearer xxxxx”
[{“category”:“NIBE S1155-12 EM 3X230V”,“parameterId”:“4”,“parameterName”:“Current outdoor temperature (BT1)”,“parameterUnit”:“°C”,“writable”:false,“timestamp”:“2021-03-25T21:36:54+00:00”,“value”:9.6,“strVal”:""},{“category”:“NIBE S1155-12 EM 3X230V”,“parameterId”:“8”,“parameterName”:“Supply line (BT2)”,“parameterUnit”:“°C”,“writable”:false,“timestamp”:“2021-03-25T21:47:12+00:00”,“value”:29.6,“strVal”:""},{“category”:“NIBE S1155-12 EM 3X230V”,“parameterId”:“10”,“parameterName”:“Return line (BT3)”,“parameterUnit”:“°C”,“writable”:false,“timestamp”:“2021-03-25T21:45:52+00:00”,“value”:26.1,“strVal”:""},{“category”:“NIBE S1155-12 EM 3X230V”,“parameterId”:“12”,“parameterName”:“Hot water charging (BT6)”,“parameterUnit”:“°C”,“writable”:false,“timestamp”:“2021-03-25T21:43:37+00:00”,“value”:50.0,“strVal”:""},{“category”:“NIBE S1155-12 EM 3X230V”,“parameterId”:“13”,“parameterName”:“Brine in (BT10)”,“parameterUnit”:“°C”,“writable”:false,“timestamp”:“2021-03-25T18:13:04+00:00”,“value”:0.5,“strVal”:""},{“category”:“NIBE S1155-12 EM 3X230V”,“parameterId”:“14”,“parameterName”:“Brine out (BT11)”,“parameterUnit”:“°C”,“writable”:false,“timestamp”:“2021-03-25T21:48:05+00:00”,“value”:-2.2,“strVal”:""},{“category”:“NIBE S1155-12 EM 3X230V”,“parameterId”:“54”,“parameterName”:“Average temperature (BT1)”,“parameterUnit”:“°C”,“writable”:false,“timestamp”:“2021-03-24T15:38:49+00:00”,“value”:11.0,“strVal”:""},{“category”:“NIBE S1155-12 EM 3X230V”,“parameterId”:“781”,“parameterName”:“Degree minutes”,“parameterUnit”:“DM”,“writable”:true,“timestamp”:“2021-03-25T21:45:06+00:00”,“value”:-93.0,“strVal”:""},{“category”:“NIBE S1155-12 EM 3X230V”,“parameterId”:“1708”,“parameterName”:“Calculated supply climate system 1”,“parameterUnit”:“°C”,“writable”:false,“timestamp”:“2021-03-25T21:41:13+00:00”,“value”:29.3,“strVal”:""}]
I know virtually nothing about OAuth etc. How exactly does one obtain the needed client_id and secret? I see alot of stuff in the swagger docs but can’t figure out how to get the tokens.
The client id and secret should be provided to you when you register an application at myUplink Developer Web. Then you need to make a post request to /oauth/token (the documentation doesn’t specify how, but I guess www-form formatted) to get a token. This in turn needs to be provided in the Authorization http header for the rest of the requests. The token is only valid for a short time, so it needs to be renewed periodically.
Edit: after examining the network traffic to the api via swagger, the client id and secret should be passed via http basic auth. and the request body should be grant_type=client_credentials&scope=READSYSTEM+WRITESYSTEM
.
You then get a json response with the token, and the expire time (1 hour).
If you try the /v2/systems/{systemId}/categories
endpoint, do you get more data? The json you posted seems to be comparable to the STATUS
category in the v1 api, where only some general info is shown, but there are other categories with parameter relating to the different subsystems (compressor, ventilation, different heating circuits etc.)
Thank you!
I somehow, honesty I don’t know how, managed to get an access token using the Swagger documentation (no idea how to actually use curl to get a token).
Anyway, when querying /points I seem to get a somehat longer list:
[
{
"category":"NIBE S1255-6 R EM 3X400V",
"parameterId":"4",
"parameterName":"Current outdoor temperature (BT1)",
"parameterUnit":"°C",
"writable":false,
"timestamp":"2021-03-26T08:13:17+00:00",
"value":3.4,
"strVal":""
},
{
"category":"Muu talo",
"parameterId":"7",
"parameterName":"Supply line (EP21-BT2)",
"parameterUnit":"°C",
"writable":false,
"timestamp":"2021-03-26T07:43:07+00:00",
"value":26.7,
"strVal":""
},
{
"category":"NIBE S1255-6 R EM 3X400V",
"parameterId":"8",
"parameterName":"Supply line (BT2)",
"parameterUnit":"°C",
"writable":false,
"timestamp":"2021-03-26T07:44:49+00:00",
"value":28.4,
"strVal":""
},
{
"category":"NIBE S1255-6 R EM 3X400V",
"parameterId":"10",
"parameterName":"Return line (BT3)",
"parameterUnit":"°C",
"writable":false,
"timestamp":"2021-03-26T07:43:29+00:00",
"value":26.4,
"strVal":""
},
{
"category":"NIBE S1255-6 R EM 3X400V",
"parameterId":"11",
"parameterName":"Hot water top (BT7)",
"parameterUnit":"°C",
"writable":false,
"timestamp":"2021-03-26T08:14:17+00:00",
"value":40.5,
"strVal":""
},
{
"category":"NIBE S1255-6 R EM 3X400V",
"parameterId":"12",
"parameterName":"Hot water charging (BT6)",
"parameterUnit":"°C",
"writable":false,
"timestamp":"2021-03-26T07:43:59+00:00",
"value":39.8,
"strVal":""
},
{
"category":"NIBE S1255-6 R EM 3X400V",
"parameterId":"13",
"parameterName":"Brine in (BT10)",
"parameterUnit":"°C",
"writable":false,
"timestamp":"2021-03-25T21:06:24+00:00",
"value":4.3,
"strVal":""
},
{
"category":"NIBE S1255-6 R EM 3X400V",
"parameterId":"14",
"parameterName":"Brine out (BT11)",
"parameterUnit":"°C",
"writable":false,
"timestamp":"2021-03-26T07:57:45+00:00",
"value":0.5,
"strVal":""
},
{
"category":"NIBE S1255-6 R EM 3X400V",
"parameterId":"15",
"parameterName":"Condenser (BT12)",
"parameterUnit":"°C",
"writable":false,
"timestamp":"2021-03-26T07:43:48+00:00",
"value":28.5,
"strVal":""
},
{
"category":"NIBE S1255-6 R EM 3X400V",
"parameterId":"16",
"parameterName":"Discharge (BT14)",
"parameterUnit":"°C",
"writable":false,
"timestamp":"2021-03-26T08:10:01+00:00",
"value":49.1,
"strVal":""
},
{
"category":"NIBE S1255-6 R EM 3X400V",
"parameterId":"17",
"parameterName":"Liquid line (BT15)",
"parameterUnit":"°C",
"writable":false,
"timestamp":"2021-03-26T07:47:05+00:00",
"value":26.3,
"strVal":""
},
{
"category":"NIBE S1255-6 R EM 3X400V",
"parameterId":"19",
"parameterName":"Suction gas (BT17)",
"parameterUnit":"°C",
"writable":false,
"timestamp":"2021-03-26T08:22:11+00:00",
"value":7.8,
"strVal":""
},
{
"category":"NIBE S1255-6 R EM 3X400V",
"parameterId":"54",
"parameterName":"Average temperature (BT1)",
"parameterUnit":"°C",
"writable":false,
"timestamp":"2021-03-25T16:02:24+00:00",
"value":3.6,
"strVal":""
},
{
"category":"NIBE S1255-6 R EM 3X400V",
"parameterId":"58",
"parameterName":"Flow sensor (BF1)",
"parameterUnit":"l/m",
"writable":false,
"timestamp":"2021-03-26T08:19:12+00:00",
"value":9.1,
"strVal":""
},
{
"category":"NIBE S1255-6 R EM 3X400V",
"parameterId":"64",
"parameterName":"Current (BE1)",
"parameterUnit":"A",
"writable":false,
"timestamp":"2021-03-26T05:24:41+00:00",
"value":1.0,
"strVal":""
},
{
"category":"NIBE S1255-6 R EM 3X400V",
"parameterId":"65",
"parameterName":"Current (BE2)",
"parameterUnit":"A",
"writable":false,
"timestamp":"2021-03-26T07:15:55+00:00",
"value":0.8,
"strVal":""
},
{
"category":"NIBE S1255-6 R EM 3X400V",
"parameterId":"66",
"parameterName":"Current (BE3)",
"parameterUnit":"A",
"writable":false,
"timestamp":"2021-03-26T08:18:05+00:00",
"value":2.6,
"strVal":""
},
{
"category":"Muu talo",
"parameterId":"98",
"parameterName":"Return line (EP21-BT3)",
"parameterUnit":"°C",
"writable":false,
"timestamp":"2021-03-26T07:42:59+00:00",
"value":25.4,
"strVal":""
},
{
"category":"NIBE S1255-6 R EM 3X400V",
"parameterId":"781",
"parameterName":"Degree minutes",
"parameterUnit":"DM",
"writable":true,
"timestamp":"2021-03-26T08:22:24+00:00",
"value":-91.0,
"strVal":""
},
{
"category":"Muu talo",
"parameterId":"1707",
"parameterName":"Calculated supply climate system 2",
"parameterUnit":"°C",
"writable":false,
"timestamp":"2021-03-26T06:29:39+00:00",
"value":26.2,
"strVal":""
},
{
"category":"NIBE S1255-6 R EM 3X400V",
"parameterId":"1708",
"parameterName":"Calculated supply climate system 1",
"parameterUnit":"°C",
"writable":false,
"timestamp":"2021-03-26T05:57:38+00:00",
"value":28.2,
"strVal":""
},
{
"category":"NIBE S1255-6 R EM 3X400V",
"parameterId":"1965",
"parameterName":"Operating mode compressor",
"parameterUnit":"",
"writable":false,
"timestamp":"2021-03-25T12:34:44+00:00",
"value":60.0,
"strVal":""
},
{
"category":"NIBE S1255-6 R EM 3X400V",
"parameterId":"1975",
"parameterName":"Heating medium pump speed (GP1)",
"parameterUnit":"%",
"writable":false,
"timestamp":"2021-03-26T07:41:22+00:00",
"value":49.0,
"strVal":""
},
{
"category":"NIBE S1255-6 R EM 3X400V",
"parameterId":"1977",
"parameterName":"Brine pump speed (GP2)",
"parameterUnit":"%",
"writable":false,
"timestamp":"2021-03-26T07:59:33+00:00",
"value":19.0,
"strVal":""
},
{
"category":"Heat meter",
"parameterId":"2716",
"parameterName":"Hot water, including int. add. heat",
"parameterUnit":"kWh",
"writable":false,
"timestamp":"2021-03-26T07:38:11+00:00",
"value":668.0,
"strVal":""
},
{
"category":"Heat meter",
"parameterId":"2717",
"parameterName":"Heating, including int. add. heat",
"parameterUnit":"kWh",
"writable":false,
"timestamp":"2021-03-26T08:21:29+00:00",
"value":8432.1,
"strVal":""
},
{
"category":"Heat meter",
"parameterId":"2720",
"parameterName":"Hot water, compressor only",
"parameterUnit":"kWh",
"writable":false,
"timestamp":"2021-03-26T07:38:11+00:00",
"value":667.9,
"strVal":""
},
{
"category":"Heat meter",
"parameterId":"2721",
"parameterName":"Heating, compressor only",
"parameterUnit":"kWh",
"writable":false,
"timestamp":"2021-03-26T08:21:29+00:00",
"value":8432.2,
"strVal":""
},
{
"category":"Muu talo",
"parameterId":"3670",
"parameterName":"Heating offset climate system 2",
"parameterUnit":"",
"writable":true,
"timestamp":"2021-03-25T12:19:52+00:00",
"value":0.0,
"strVal":""
},
{
"category":"NIBE S1255-6 R EM 3X400V",
"parameterId":"3671",
"parameterName":"Heating offset climate system 1",
"parameterUnit":"",
"writable":true,
"timestamp":"2021-03-22T14:23:42+00:00",
"value":0.0,
"strVal":""
},
{
"category":"NIBE S1255-6 R EM 3X400V",
"parameterId":"5927",
"parameterName":"Current compressor frequency",
"parameterUnit":"Hz",
"writable":false,
"timestamp":"2021-03-26T07:39:39+00:00",
"value":21.0,
"strVal":""
},
{
"category":"NIBE S1255-6 R EM 3X400V",
"parameterId":"7086",
"parameterName":"More hot water",
"parameterUnit":"",
"writable":true,
"timestamp":"2021-03-17T14:42:44+00:00",
"value":0.0,
"strVal":""
},
{
"category":"NIBE S1255-6 R EM 3X400V",
"parameterId":"10845",
"parameterName":"Season overview, brine in (EB100-BT10)",
"parameterUnit":"°C",
"writable":false,
"timestamp":"2021-03-25T17:21:59+00:00",
"value":3.5,
"strVal":""
},
{
"category":"NIBE S1255-6 R EM 3X400V",
"parameterId":"10863",
"parameterName":"Season overview, brine out (EB100-BT11)",
"parameterUnit":"°C",
"writable":false,
"timestamp":"2021-03-26T07:57:32+00:00",
"value":-0.1,
"strVal":""
},
{
"category":"NIBE S1255-6 R EM 3X400V",
"parameterId":"10905",
"parameterName":"Pump: Heating medium (GP1)",
"parameterUnit":"",
"writable":false,
"timestamp":"2021-03-17T14:42:44+00:00",
"value":1.0,
"strVal":""
},
{
"category":"NIBE S1255-6 R EM 3X400V",
"parameterId":"10906",
"parameterName":"Pump: Brine (GP2)",
"parameterUnit":"",
"writable":false,
"timestamp":"2021-03-25T12:34:24+00:00",
"value":1.0,
"strVal":""
},
{
"category":"NIBE S1255-6 R EM 3X400V",
"parameterId":"55000",
"parameterName":"Priority",
"parameterUnit":"",
"writable":false,
"timestamp":"2021-03-26T07:39:22+00:00",
"value":30.0,
"strVal":""
},
{
"category":"NIBE S1255-6 R EM 3X400V",
"parameterId":"55027",
"parameterName":"Int elec add heat",
"parameterUnit":"",
"writable":false,
"timestamp":"2021-03-17T14:42:44+00:00",
"value":5.0,
"strVal":""
}
]
querying /categories gives me an empty response.
The curl command to get the token would be:
curl -X POST "https://api.myuplink.com/oauth/token" -u '<client id>:<client secret>' -d 'grant_type=client_credentials&scope=READSYSTEM+WRITESYSTEM'
Then for subsequent requests you use:
curl -H 'Authorization: Bearer <your token>' ...
Aah, now I’m starting to understand!
So I can now reliably poll the points using the token I get. That works perfectly.
Querying the systems/xxxx/categories gives the following:
The subject does not belong to any of the allowed group roles ‘Viewer’
Not going to pretend I understand anything, but could it be that getting that data requires further authentication?
I know that in the v1 api, some things are only available for “select partners”, might be something similar here. It seems they have limited the api quite a bit sadly.
are you using /v2/devices/{deviceId}/points ?
I get different output what you have there is what I was hoping for
Yes, that’s what I’m querying.
Could it have something to do with subscription?
Quick Update - got in touch with a super helpful person of Nibe in the Netherlands. He provided me a voucher for the subscription, and turns out it is indeed this explains the reduced set of params I got!.
So, where I’m at is that or the newer Nibe (v2 API) , I’m able to get the authorization, get the status info and will test over the weekend but am reasonable sure I can send commands to change some settings on the heatpump.
Would be great if we could get that into a binding for the v2 API. Have 0 experience with developing bindings but perhaps we can combine forces to get this going. Compared to the v1 questions I have are:
does that use oAuth or how do we manage that
- for v2 you need to poll system to get device-id
- (relatively) simple poll to get json for all details
- not sure whether v1 supports sending commands to heatpump.
Lot of connection problems (or actually problems getting fresh/updated data) lately with uplink and on multiple days. No maintenance notification either.
I haven’t had any problems for a while. Do you get any errors in the log, or the bridge marked as offline, possibly flipping between offline/online every few minutes? In that case what’s the status message when it goes offline?
As I clarified, the problem is actually in getting fresh data. I have a logic setup where it monitors multiple values (e.g. air speed, compressor frequency), and if these values haven’t changed within 45 minutes, a warning is sent.
So technically the connection is most likely ok (haven’t looked at logs though).
Lately I’ve been getting these warnings 4-8 times a day.
The air speed should change quite frequently, but now in the summer the compressor in my system can be off for hours at a time since it only turns on when it needs to fill up the hot water. Do you have the status#lastUpdate
channel connected? What does that show? If you look in the log, can you see updates for any of the channels you have connected?
That’s true that e.g. compressor is off almost all of the time now, but I have other values to be checked as well. “lastUpdate” is connected and seems to refresh/update quite reliably and confirming that connection itself is up.
Still seems that this is not API or openHAB (binding) problem, as I’m seeing old or not updated data in the Nibe uplink app as well. E.g. in the history section, hot water temp chart sometimes shows flat line for last 2 hours, and obviously that is not the case.