NIBE Uplink API component (non S-series)

Thanks a lot @elupus !
I completely missed your second reaction 2 days later. Just installed your new version, and it works great!
‘system integer’ is indeed a bit confusing, but thanks to @Johan_Nolen I figured that out.

Great component for Home Assistant.
Works great, thanks!

Hi Joakim,

Im a new user of Home Automation, and owner of a F1245. I am really interested in using the component you wrote, but I cant get it to work.
Ive installed HA on a macbook, got the basic setup working.

Then I followed the instructions on your readme of hass_nibe, and put the folders nibe, sensor, climate etc in a newly created ‘custom_components’ folder next to the configuration.yaml in the .homeassistant folder.

I kept getting the error that the nibe component was not found, but somehow while I was typing this message, it magically started working (seems like restart wasnt working or so ?). It was not clear to me if we still need the nibeuplink module you created…

Anyhow, now I see the “Nibe Uplink authorization required” message, I can confirm that Im not a robot, and then the redirect gives me the msg :
{“message”: “An error occured during nibe authorization.”}

Here is the stack trace :

2018-09-19 23:43:15 ERROR (MainThread) [homeassistant.core] Error doing job: SSL handshake failed on verifying the certificate
Traceback (most recent call last):
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/sslproto.py”, line 625, in _on_handshake_complete
raise handshake_exc
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/sslproto.py”, line 189, in feed_ssldata
self._sslobj.do_handshake()
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py”, line 763, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1045)
2018-09-19 23:43:15 ERROR (MainThread) [homeassistant.core] Error doing job: SSL error in data received
Traceback (most recent call last):
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/sslproto.py”, line 526, in data_received
ssldata, appdata = self._sslpipe.feed_ssldata(data)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/sslproto.py”, line 189, in feed_ssldata
self._sslobj.do_handshake()
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py”, line 763, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1045)
2018-09-19 23:43:15 ERROR (MainThread) [custom_components.nibe.auth] An error occured during nibe authorization.
Traceback (most recent call last):
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/aiohttp/connector.py”, line 822, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py”, line 943, in create_connection
raise exceptions[0]
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py”, line 930, in create_connection
await self.sock_connect(sock, address)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/selector_events.py”, line 475, in sock_connect
return await fut
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/selector_events.py”, line 480, in _sock_connect
sock.connect(address)
OSError: [Errno 65] No route to host

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/Users/bram/.homeassistant/custom_components/nibe/auth.py”, line 96, in get
await self.configure(str(request.url))
File “/Users/bram/.homeassistant/custom_components/nibe/auth.py”, line 77, in configure
await self.uplink.get_access_token(code)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/nibeuplink/init.py”, line 167, in get_access_token
data=payload) as response:
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/aiohttp/client.py”, line 855, in aenter
self._resp = await self._coro
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/aiohttp/client.py”, line 370, in _request
timeout=timeout
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/aiohttp/connector.py”, line 445, in connect
proto = await self._create_connection(req, traces, timeout)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/aiohttp/connector.py”, line 757, in _create_connection
req, traces, timeout)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/aiohttp/connector.py”, line 879, in _create_direct_connection
raise last_exc
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/aiohttp/connector.py”, line 862, in _create_direct_connection
req=req, client_error=client_error)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/aiohttp/connector.py”, line 829, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host api.nibeuplink.com:443 ssl:None [No route to host]

Looks like it was unable to connect to api.nibupulink.com due to certificate issues ?

PS : I dont know what to fill in under “# required system identifier”, so I put 1.

Thanks a lot in advance.

Best Regards,
Bram

Hi,
The system identifier (a 5 digit number) could be found in the URL after logging in to https://www.nibeuplink.com/Welcome

/M

I just upgraded to 81.2 from 80.0 and now the component will not start

2018-10-30 20:24:02 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/home/hass/.homeassistant/custom_components/nibe/init.py”, line 111, in async_setup_systems
await asyncio.gather(*tasks)
File “/home/hass/.homeassistant/custom_components/nibe/init.py”, line 373, in load
await self.load_unit(unit)
File “/home/hass/.homeassistant/custom_components/nibe/init.py”, line 328, in load_unit
unit.get(CONF_CATEGORIES)))
File “/home/hass/.homeassistant/custom_components/nibe/init.py”, line 256, in load_categories
return await asyncio.gather(*tasks)
File “/home/hass/.homeassistant/custom_components/nibe/init.py”, line 228, in load_parameter_group
sensors)
File “/home/hass/.homeassistant/custom_components/nibe/init.py”, line 210, in load_sensor
return await self.load_platform(discovery_info, ‘sensor’)
File “/home/hass/.homeassistant/custom_components/nibe/init.py”, line 186, in load_platform
load_info)
TypeError: async_load_platform() missing 1 required positional argument: ‘hass_config’

I can see that the latest commit was 3 month ago so nothing should have changed in the component?

Something like https://github.com/home-assistant/home-assistant/pull/17236 is needed.

So the component is broken currently due to this?

Seams so. A pull request fixing it would be accepted. Otherwise you’ll have to wait untill I get some spare time

1 Like

Downgraded to 0.80.3 until you get time to fix it.
Thanks for a really great component.

Btw, have you thought about getting it merged into Homeassistant as an official module? That would probably make it easier to catch stuff like this earlier, instead of after the fact.

I have. just got shut down on two pull requests on other things, so at the moment not that keen.

Should be fixed now

3 Likes

Thanks elupus! Your effort is really appreciated!

Thanks for update. Working fine now with 0.80.x versions.

It shows up really nice in a Picture-elements card in Lovelace

Nice, Want to share that card?

Sure. As below…

    type: picture-elements
    image: /local/nibe5.jpg
    elements:
      - type: state-label
        entity: sensor.nibe_xxxx_40004
        style:
          top: 36%
          left: 9%
          text-align: center
          font-size: 20px
          color: white
          font-family: Helvetica
      - type: state-label
        entity: sensor.nibe_xxxx_40033
        style:
          top: 56%
          left: 25%
          text-align: center
          font-size: 20px
          color: white
          font-family: Helvetica
      - type: state-label
        entity: sensor.nibe_xxxx_40012
        style:
          top: 53%
          left: 75%
          text-align: center
          font-size: 17px
          color: white
          font-family: Helvetica
      - type: state-label
        entity: sensor.nibe_xxxx_40008
        style:
          top: 53%
          left: 89%
          text-align: center
          font-size: 17px
          color: white
          font-family: Helvetica
      - type: state-label
        entity: sensor.nibe_xxxx_40013
        style:
          top: 55%
          left: 51%
          text-align: center
          font-size: 20px
          color: white
          font-family: Helvetica
      - type: state-icon
        entity: switch.nibe_xxxx_hot_water_boost
        tap_action: toggle
        style:
          top: 92%
          left: 93%

image

2 Likes

so i gave this a go…but i cant seam too get it right…

18-11-06 23:38:51 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/config/custom_components/nibe/init.py”, line 111, in async_setup_systems
await asyncio.gather(*tasks)
File “/config/custom_components/nibe/init.py”, line 374, in load
await self.load_unit(unit)
File “/config/custom_components/nibe/init.py”, line 329, in load_unit
unit.get(CONF_CATEGORIES)))
File “/config/custom_components/nibe/init.py”, line 248, in load_categories
data = await self.uplink.get_categories(self.system_id, True, unit)
File “/config/deps/lib/python3.6/site-packages/nibeuplink/init.py”, line 368, in get_categories
‘systemUnitId’: unit_id})
File “/config/deps/lib/python3.6/site-packages/nibeuplink/init.py”, line 218, in get
headers= {},
File “/config/deps/lib/python3.6/site-packages/nibeuplink/init.py”, line 240, in _request
await raise_for_status(response)
File “/config/deps/lib/python3.6/site-packages/nibeuplink/init.py”, line 74, in raise_for_status
headers=response.headers)
aiohttp.client_exceptions.ClientResponseError: 404, message=’{
“httpStatusCode”: 404,
“errorCode”: 9,
“timestamp”: “2018-11-06T22:38:47.2564739Z”,
“details”: [
“The resource was not found”
],
“data”: null
}’

I dont know why i get 404 message.
//Crall

Likely wtonc unit nu or system

Wtonc unit nu?


The system is the 5 digit from https://www.nibeuplink.com/Welcome
The system is a vvm325 and a f2120-16.
I downloaded the master and unzipped it in my custom folder. I did the captcha again for write access. Did the reboot.

You can find the systemid in the url on nibeuplink: https://www.nibeuplink.com/System/XXXXXXXXX/Status/Overview

The unit should be 0 unless you have multiple units.