NIBE Uplink API component (non S-series)

I have been trying to get this working with hass 0.53 but the log keeps throwing this at me, does anyone have any suggestions?

2017-09-09 19:42:22 ERROR (MainThread) [homeassistant.setup] Error during setup of component nibe
Traceback (most recent call last):
File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/setup.py”, line 194, in _async_setup_component component.setup, hass, processed_config)
File “/usr/lib/python3.4/asyncio/futures.py”, line 388, in iter yield self # This tells Task to wait for completion.
File “/usr/lib/python3.4/asyncio/tasks.py”, line 286, in _wakeup value = future.result() File “/usr/lib/python3.4/asyncio/futures.py”, line 277, in result raise self._exception
File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run result = self.fn(*self.args, **self.kwargs)
File “/home/homeassistant/.homeassistant/custom_components/nibe.py”, line 86, in setup hass.data[DOMAIN] = NibeUplink(hass, config)
File “/home/homeassistant/.homeassistant/custom_components/nibe.py”, line 152, in init submit_caption = ‘Set Url’
File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/configurator.py”, line 79, in request_config ).result()
AttributeError: ‘str’ object has no attribute ‘loop’

I have the same issue with auth in config…

When clicking on the Authorize url I get to a page saying
Error while reading message ‘DotNetOpenAuth.OAuth2.Messages.EndUserAuthorizationRequest’ parameter ‘redirect_uri’ with value: MYURL

Pasting link in config windows gives me same error as @pgreberg.

For redirect URL I just put same dyndns url I have for HASS. Is this correct?

Your redirect url looks to be wrong. Nibe thinks you have entered the value MYURL. Not a full url. You must have a full url with http:// or https:// prefix . They must be identical in your configuration.yaml and the setup at the nibe homepage.

Added https and now it seems to work, thanks!

Hi, I’ve been trying to add this plugin to my Hass.io V0.54.0
Got the URL and everything, but the plugin doesn’t seem to start now, it gives this error:

2017-09-26 21:34:33 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform nibe
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py”, line 159, in _async_setup_platform
None, platform.setup_platform, self.hass, platform_config,
AttributeError: module ‘custom_components.sensor.nibe’ has no attribute ‘setup_platform’
2017-09-26 21:34:37 WARNING (MainThread) [aiohttp.websocket] websocket connection is closing.

Any hints on where to start looking?

Hi alwik,

Without any problems I installed it on hassio 0.55.0 just an hour ago. Since I can’t understand your error message I just tell you what I did. Maybe you will find a difference.

  1. On https:// api.nibeuplink .com I created an application with http://localhost:8123/ as the Callback URL
  2. Created the folder custom_components in hassio config folder
  3. Downloaded a zip file from https://github.com/elupus/hass_nibe and extracted it in config/custom_components
  4. Edited the configuration.yaml according to info on https:// github .com/elupus/hass_nibe
  5. Rebooted hassio
  6. The component showed up on the home screen so I clicked ‘authorize’
  7. Redirected to the nibe site I checked the captcha and clicked ok (?)
  8. I got an error page but the URL was alright so I pasted it in HA and clicked ‘Set configuration’

(Sorry for the broken links. As a new user I was only allowed to have two links in the post. :frowning: )

That’s what I did. I hope you can find the problem.

Good luck!

1 Like

I think you need to have done one more thing?

  1. Download sensor/nibe.py, and place that file in custom_components/sensor

Or you got both files in the zip file from the start?

— Mats —

I got it all in the zip file.

Hi Dansve,
Thanks for your great explanation. I copied what you did on a new installation (bought a second sd-card) to see if it would work. It did!
After checking to see what went wrong on my previous setup, I noticed I mixed up the two files, both called nibe.py. The file in the folder ‘sensor’ was the same as the one in the custom_component folder, because of directly doing a ‘git clone’ from the custom_component folder. This creates a new folder in that folder, which is not the correct setup.
Thanks again for your help!
Alwik

1 Like

Glad to hear that it worked, alwik.

Have fun!

EDIT: no longer an issue, see following post.

I’ve been trying getting this component to work for a while, and I don’t think I’ve got any errors on my side. (of course…)

Running on Ubuntu 17.04 with hass 0.56.2.

So:

  • cloned the github repo into custom_components
  • setup nibe api app with redirect_url: http://192.168.1.231:8123
  • added nibe: section with client_id, client_secret and redirect_url to configuration.yml
  • restarted hass

Here comes the issue:

  • Clicking “CONFIGURE” on the “Nibe Uplink Code” Configurator item produce the Nibe Uplink Code popup.
  • I click authorize, and get the NIBE Uplink API permission page, passes the reCAPTCHA test, copies the URL, clicks “Accept” and get returned to hass.
  • The Configurator item “Nibe Uplink Code” is still unconfigured and I click CONFIGURE again. I paste the API permission URL and click “SET URL”.

I now receive the following box with the MissingCodeError. Anyone got an idea why I receive this?

image

And I just noticed what I misunderstood. The URL to be entered is the local hass URL that follows the API permission page, which includes the requested “CODE” parameter. Oh well, retracing steps is good sometimes…

1 Like

Tried creating some kind of request at Github, not sure I did it correctly but I added electricity price so that it is identified as a sensor value instead of some kind of state and also added underscores to the device_state_attributes since it is then easier to create template sensors from those. Having spaces creates unnecessary problems in hass.

Any way to remove NIBE groups (with sensors) from default view? Now they appear on both default view and the newly created view…

Ok, used Groups to fix that.
Another question, on my Hassbian (did first try it on my Hassio) I use SSL certificate (https) and I can’t get the authorize to work, I get an error message every time.

Im no mind reader. The actual error message would be useful.

Sorry, was ment to add that as well:

An error occured: <class ‘oauthlib.oauth2.rfc6749.errors.MissingCodeError’>

Also, on Hassbian, I assume the “custom_components” folder should be created at:
/home/homeassistant/.homeassistant/
?

Sounds correct. Hos does the URL you paste look?

https://api.nibeuplink.com/oauth/authorize?response_type=code&client_id=xxxxxxxxxxxxxxxx&redirect_uri=https%3A%2F%2Fhost.domain.se%3A8123&scope=READSYSTEM&state=zzzzzzzzzzzzzzzzzzz

I have replaced client ID and State with other letters, also my FQDN is masked.