It is working now also with negative values
Thank you @nielstron
I have another problem, which I have seen starting from the time of my initial installation. BLNET runs fine most of the time, but after a few days or sometimes only after a few hours I get following error:
( error perists when restarting HA):
2021-01-10 22:57:58 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/homeassistant/.homeassistant/custom_components/blnet/__init__.py", line 98, in fetch_data
return hass.data["DATA_{}".format(DOMAIN)].update()
File "/home/homeassistant/.homeassistant/custom_components/blnet/__init__.py", line 146, in update
data = self.blnet.fetch(self.node)
File "/home/homeassistant/lib/python3.8/site-packages/pyblnet/blnet.py", line 87, in fetch
blnet_session.read_analog_values())
File "/home/homeassistant/lib/python3.8/site-packages/pyblnet/blnet_web.py", line 194, in read_analog_values
data_raw = dom.text()
AttributeError: 'NoneType' object has no attribute 'text'
I wanted to “catch” a HTML output from this situation, but after another restart of HA everything is back to normal and works. So I missed the point what triggers this error. I will deliver the relevant HTML page as soon as it occurs again
@nielstron - Have you an idea, what is going wrong ?
I think what’s happening there is that the BLNET returns something that is not parseable by the HTML parser in the python package. I’ll try to figure out how to avoid the crash since this is also happening on my side sometimes.
EDIT: The HTML itself might not be the problem. This is the relevant portion of code
if 'BL-Net Zugang verweigert' in dom.find('title').text():
return None
# get the element containing the interesting information
dom = dom.find("div.c")[1]
# filter out the text
data_raw = dom.text()
Obviously some pages neither contain a tag “div” with class “c” (“div.c”) nor show “BL-NET Zugang verweigert”. I’ll fix that to just abort if “div.c” could not be found
@nielstron - I think I have found the problem with the unparsable HTML code.
in my environment I have a 2nd CAN device(CAN-Monitor), which is on address 50, “BL-NET” is on “1”. For some time my broweser (and I expect the same for ha-blnet module) when fetching the analog value HTML page (580500.htm) of UVR1611, it does not show the values, but shows a page, where you have to choose between these two devices.
After “choosing” the right device with a browser, also the ha-blnet module starts working again.
I need to investigate in more details, when it happens again - for example how often it will happen and if it is possible to overcome it with a “curl/wget” hack
That sounds reasonable. The pyblnet package offers an option to automatically choose the Node to be used (set_node
). Could you try if you can fix the error by manually invoking this function before doing a request? In Home-Assistant you can specify the parameter can_node
in the integration settings which should do the trick.
@nielstron - Thank your for this hint - good point ! - I will try and come back with the results - need some days
Hi there!
i am really curious about this integration. Unfortunately i only have a CMI, no BL-NET device. Did someone get this to work for a CMI?
Thank you anyway for your effort to this project.
br mole
Hello,
Blnet works great for me but I need a flow sensor and I try to turn on pyblnet, installed pyblnet in the console added to custom_component (pyblnet next to blnet) and in configuration.yaml is blnet and pyblnet and still an error
Logger: homeassistant.setup
Source: setup.py:138
First occurred: 0:06:05 (1 occurrences)
Last logged: 0:06:05
Setup failed for pyblnet: No setup function defined.
what am I doing wrong?
Hi @marcinbc,
Its hard to understand what happened without seeing your configuration and setup in custom components. However, there is no component called “pyblnet”. The name of the component is “blnet” and it should be set up as described in https://github.com/nielstron/ha_blnet (the most up to date version of the component).
@mahomh: I have the same problem with my bootloader. I am getting the following error message:
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/setup.py”, line 213, in async_setup_component
result = await task
File “/usr/local/lib/python3.8/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/blnet/init.py”, line 102, in setup
data = fetch_data()
File “/config/custom_components/blnet/init.py”, line 98, in fetch_data
return hass.data["DATA{}".format(DOMAIN)].update()
File “/config/custom_components/blnet/init.py”, line 146, in update
data = self.blnet.fetch(self.node)
File “/usr/local/lib/python3.8/site-packages/pyblnet/blnet.py”, line 91, in fetch
direct = self.blnet_direct.get_latest(self.max_retries)[0]
File “/usr/local/lib/python3.8/site-packages/pyblnet/blnet_conn.py”, line 304, in get_latest
self.get_count()
File “/usr/local/lib/python3.8/site-packages/pyblnet/blnet_conn.py”, line 84, in get_count
checksum) = struct.unpack(’<5sB3s3sB’)
TypeError: unpack expected 2 arguments, got 1
I have also two network nodes. Here is my yaml config
‘’’
blnet:
resource: “http://192.168.178.222”
password: 12345
use_web: true
use_ta: true
web_port: 355
ta_port: 40000
can_node: 32
‘’’
It works if I set use_ta to false. Does anyone have an idea to overcome this situation?
(s
The only way to overcome this would be to fix my module The option use_ta
is currently not supported.
@nielstron - Maybe you have seen it already - Starting from version HA 2021.6.0 blnet stops working because of missing version key in manifest file:
2021-06-09 11:51:01 ERROR (SyncWorker_3) [homeassistant.loader] The custom integration ‘blnet’ does not have a valid version key (None) in the manifest file and was blocked from loading. See Custom integration changes | Home Assistant Developer Docs for more details
Are you able to fix it ?
Thank you !
Hi @mahomh,
thanks for the heads up. In the most up-to-date version of the tool (GitHub - nielstron/ha_blnet: BLNET custom component for Home Assistant) the manifest file should be updated accordingly.
@nielstron - Thank you very much ! Everything is working fine again.
Sorry, I missed the update you already made - my integration was “manual installation” (and the link to the repository was not immediately available to me) - now I have switched to the installation via HACS - this should display new versions more conveniently
I have managed to work around this problem by running this command via cron - as you can see: every 6 hours. this is enough for my environment:
( this sets the “active” CAN ID for a blnet query to CAN ID: 1)
5 */4 * * * curl http://<IP of BLNet>/data.htm?blaB=1
“blaB=1” is the CAN id for the UVR16xx.
@mahomh Glad to see you found a solution! Note that the HA blnet component supports an option called “can_node” which should set the can id automatically for you. I have never tried it in the field but your situations seems to be a good opportunity (it should do what your cron job does, but before every request to the system)
I installed everything.
But I only get 100% cpu load and for long time “wait until blnet is starting”.
After that no sensors or units to be seen.
I’ve a cmi on uvr16x2.
CAN node of uvr or cmi?
@nielstron I tried to upload your integration to my homeassistant server but I always get an Error when I trie to restart the Server.
Error:
Integration error: blnet - Integration ‘blnet’ not found.
Maby you can help me.
Greetings Vincent