Hooking up the UVR1611 via BLNET

So there is a freely pogrammable heating controller called UVR1611 by Technische Alternative. Recently I wanted to have its data displayed in Home Assistant (already accomplished that once via “UVR1611 Data Logger”). For that you need either the BLNET device or the CLI, in this case some scripts have been developed to assist integrating UVR data via a BLNET device.

For you as a home assistant user, add this folder in to your custom_components folder (resulting in custom_components/blnet/__init__.py etc):

And add these lines to your configuration.yaml:

  # UVR1611 Data
  blnet:
    resource: your_blnet_address
    password: optional_blnet_password
    can_node: optional_can_bus_node

The result:

At the digital switches, :gear: is displayed if mode of digital output is set to “AUTO”, else showing grafik [mdi:toggle-switch] / grafik [mdi:toggle-switch-off]

If you are interested in developing that further feel free to contribute to either this component or the backend python script pyblnet.

EDIT: There was a major overhaul under the hood. Now customization is fully supported and digital outputs of the UVR1611 can be controlled. Yet from then on you have to create the groups yourself.

UPDATE: Since the integration layout in homeassistant changed a lot lately all files previously thought to be seperate are now included in one single blnet “package”. Now you only have to move one folder to your custom_components directory and you’re done! The description above was changed accordingly.

2 Likes

Hello Nielstron,
great project! Can I use this under “hassio”?
And is there a german manual? or can I contact you in German?
Greeting Juergen

Of course, you are free to use this tool. But note that by now there are no switch-components for home assistant built yet. Also not a lot of testing has went into this so it may be wise to handle it with care and to look out for exceptions and errors.

Feel free to contact me (in German), there currently is no manual besided the one on this page.

Update: Switches now included!

Hi,

The ressource, is this the BL-NET IP?

Br,
Johannes

Hi,

I have some troubles getting this solution running. I have downloaded the 3 Files to my custom-components.

But I am not able to install PyBLNET. Not sure if I am doing it right, as I am completley new in this topic.

I have installed HomeAssistant on a Raspbian installation and so far it is working. To get the UVR1611 working I was doing the follwing:

sudo su -s /bin/bash homeassistant
source bin/activate
pip3 install PyBLNET

But I am getting the following error messages:

(homeassistant) homeassistant@homeassistant:/srv/homeassistant $ pip3 install PyBLNET
Collecting PyBLNET
  Using cached https://files.pythonhosted.org/packages/6a/96/c8099b753360616fa3118a9894ca1bcc599f6725ba187fa12b457ccaea26/PyBLNET-0.4.1-py2.py3-none-any.whl
Collecting htmldom (from PyBLNET)
  Using cached https://www.piwheels.org/simple/htmldom/htmldom-2.0-py3-none-any.whl
Requirement already satisfied: requests in ./lib/python3.5/site-packages (from PyBLNET)
Collecting html (from PyBLNET)
  Using cached https://files.pythonhosted.org/packages/4a/df/0e3d22d50ee43274eb5116f49972a164d853bb3ab305a69a0540b6292252/html-1.16.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/srv/homeassistant/lib/python3.5/site-packages/setuptools/__init__.py", line 14, in <module>
        from setuptools.dist import Distribution, Feature
      File "/srv/homeassistant/lib/python3.5/site-packages/setuptools/dist.py", line 24, in <module>
        from setuptools.depends import Require
      File "/srv/homeassistant/lib/python3.5/site-packages/setuptools/depends.py", line 7, in <module>
        from .py33compat import Bytecode
      File "/srv/homeassistant/lib/python3.5/site-packages/setuptools/py33compat.py", line 11, in <module>
        from setuptools.extern.six.moves import html_parser
      File "/srv/homeassistant/lib/python3.5/site-packages/setuptools/_vendor/six.py", line 92, in __get__
        result = self._resolve()
      File "/srv/homeassistant/lib/python3.5/site-packages/setuptools/_vendor/six.py", line 115, in _resolve
        return _import_module(self.mod)
      File "/srv/homeassistant/lib/python3.5/site-packages/setuptools/_vendor/six.py", line 82, in _import_module
        __import__(name)
    ImportError: No module named 'html.parser'; 'html' is not a package

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-2nlh95py/html/

Br,
Johannes

I had the same problem. Try pip3 install html==1.0 and then installing PyBLNET again (without --upgrade or -U)

Yes, resource is the IP/ web address of your BLNET.

Hi,

One step ahead, Now I am getting the following error, when starting home assistant:

2018-04-25 09:35:33 ERROR (MainThread) [homeassistant.setup] Error during setup of component blnet
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/setup.py", line 145, in _async_setup_component
    component.setup, hass, processed_config)
  File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/blnet.py", line 46, in setup
    from pyblnet import BLNET, test_blnet
  File "/srv/homeassistant/lib/python3.5/site-packages/pyblnet/__init__.py", line 13, in <module>
    from test.test_binop import isint
ImportError: No module named 'test.test_binop'

Br,
Johannes

Fixed this, it actually was an unused import. Please try the updated components at https://github.com/nielstron/home-assistant .

Thanks,

Somehow I still have troubles. Getting now:

2018-04-26 09:17:24 ERROR (Thread-7) [homeassistant.util.package] Unable to install package pyblnet==0.4.2: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-u5qv0930/html/
2018-04-26 09:17:24 ERROR (MainThread) [homeassistant.requirements] Not initializing blnet because could not install requirement pyblnet==0.4.2
2018-04-26 09:17:24 ERROR (MainThread) [homeassistant.setup] Setup failed for blnet: Could not install all requirements.

Br,
Johannes

I got it working.

I installed with
pip3 install pyblnet
which installed 0.4.1

I installed now 0.4.2 by running
pip3 install pyblnet==0.4.2

Hi,

I have two a last questions:

  1. Is it possible to show also other values in addition to input and outputs? E.g. Counters (Power) ?
  2. How can I change the mode of an Output between “Manual” and “Auto”?

Br,
Johannes

  1. If you can tell me where those values arr shown in the web interface (i.e. navigating there through the node menue) I think this can be implemented. By default PyBLNET should parse all analogous anders digital in- answer outputs.

  2. This is not yet supported. The digital sensors would have to be represented by a input with three values instead of a switch, I already thought about implementing this.

Hi,

Ad 1:
As far as I know the UVR1611 supports 2 frames on the CAN Bus, each frame supports 16 analog and 16 digital ports, but also 4 speed, 2 power and 2 energy ports.

speed1
speed2
speed3
speed4
power1
power2
energy1
energy2

I am using from frame1 speed1, power1, power2, energy1 and energy2.
From frame2 I am using power1 and energy1

Ad 2: No issue on that as I anyhow do not want to change that via Home Assistant.

Br,
Johannes

Hi,

I have often the problem, that the connection to the BLNET stops working, especially, when I am doing many hass restarts due to testing.

Then I have to log into the BLNET, doing a restart, waiting some time and then it is working again.

Anyone else with similar issues?

Br,
Johannes

Ok, I found the issue. It happens when doing restart of homeassistant instead of stop - wait - start.

Br,
Johannes

Hi,

I have now another issue: It is running perfectly on my Raspberry, but I wanted to move now Home Assistant to my UnRaid Server with a Home-Assistant Docker.

I downloaded the files and stored them into a custom_components directory.

What I was not sure is on how I should install html and byblnet. Do I do this in the main Linux or somehow within the docker?

I did it on the main Linux (same for a different component as well, this one is working) but when I start home assistant I am getting the following error:

2018-05-10 08:20:46 ERROR (SyncWorker_4) [homeassistant.util.package] Unable to install package pyblnet==0.4.2: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-goivl1cr/html/
2018-05-10 08:20:46 ERROR (MainThread) [homeassistant.requirements] Not initializing blnet because could not install requirement pyblnet==0.4.2
2018-05-10 08:20:46 ERROR (MainThread) [homeassistant.setup] Setup failed for blnet: Could not install all requirements.

Installed byblnet:

root@UnRaid:/mnt/user/appdata# pip3 install pyblnet==0.4.2
Requirement already satisfied: pyblnet==0.4.2 in /usr/lib64/python3.6/site-packages
Requirement already satisfied: requests in /usr/lib64/python3.6/site-packages (from pyblnet==0.4.2)
Requirement already satisfied: htmldom in /usr/lib64/python3.6/site-packages (from pyblnet==0.4.2)
Requirement already satisfied: html in /usr/lib64/python3.6/site-packages (from pyblnet==0.4.2)
Requirement already satisfied: idna<2.7,>=2.5 in /usr/lib64/python3.6/site-packages (from requests->pyblnet==0.4.2)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/lib64/python3.6/site-packages (from requests->pyblnet==0.4.2)
Requirement already satisfied: certifi>=2017.4.17 in /usr/lib64/python3.6/site-packages (from requests->pyblnet==0.4.2)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in /usr/lib64/python3.6/site-packages (from requests->pyblnet==0.4.2)

Installed html:

root@UnRaid:/mnt/user/appdata# pip3 install html==1.0
Requirement already satisfied: html==1.0 in /usr/lib64/python3.6/site-packages

Br,
Johannes

I also tried now your solution with “UVR1611 Data Logger” as I have this anyhow running.

I created the “uvr1611.php” file in the webroot of the Data-Logger.
I also added the sensor under custom_components.

But I only get one sensor named “sensor.uvr1611_data_logger” which is empty.

If I try to browse the uvr1611.php I get a “error 500”. If I create a test.php with “Hello World” it is working.

@nielstron: Any ideas why the BLNET-Option is not working within the docker?
Do I need to install the blnet within the docker?

Br,
Johannes

You have to install the PyBLNET package inside the docker, inside the virtual environment of home assistant (if there is none, simply inside the docker).

Although the logs you included show that PyBLNET was successfully installed somewhere in the docker, it is not the directory that home assistant accesses.
The only explanation I can think of is that there is a venv. If there is a python virtual environment around your home assistant installation try to install PyBLNET there. (cd /srv/homeassistant; source bin/activate; pip install PyBLNET==0.4.2)