cereal2nd / velbus-aio

Velbus Asyncio
Apache License 2.0
15 stars 12 forks source link

HA Velbus integration halts on auto discovering #10

Closed d3claes closed 3 years ago

d3claes commented 3 years ago

Hi, This week, I updated Home Assistant to the 2021.10.0 version and I found out there was a new version of the velbus integration. I couldn't find any info in the velbus documentation on Home Assistant on how to proceed when having a setup with the old integration? So I removed the velbus line from configuration.yaml. Do I need to remove the old devices? In velbuslink I could see velbus-aio going trough all addresses and then it started scanning all modules. But at address 9 it halts. At this address, I have an older VMBLCDWB module.

When I download this project on linux and execute the example script, I get the same behavior. On exit with ctrl+C, I get the following debug information:

velbus.txt

The error message "ModuleTypeMessage needs 4 bytes of data have 3" was also present in the old integration, but it didn't stop velbus from working.

Can this be of any help?

wlcrs commented 3 years ago

Hi @d3claes , I'm also experiencing issues with the current velbus-aio implementation. It doesn't seem to receive any updates from the Velbus-system after initialisation, which makes it in effect unusable. I had already started working on my own async implementation of the python-velbus library, but hadn't gotten around to finishing it.

I've now integrated my approach in this repository, and you can find the effort here: https://github.com/wlcrs/velbus-aio/tree/asyncio-protocol

Can you please test my version on your system? The easiest way will be to run the following commands:

git clone https://github.com/wlcrs/velbus-aio.git
cd velbus-aio
git checkout async-protocol
git submodule update --init
pip3 install -e .
# now edit the file examples/load-modules.py so that it contains the proper connection string
python3 examples/load-modules.py

If this logic also works on systems with legacy modules, then I'll create a pull request so that we can get everything up and running again.

cereal2nd commented 3 years ago

Cool code change, let me test this out tomorrow. But as far as the code-reading goes this is a big improvement.

So let's get this one up and running and merged asp

wlcrs commented 3 years ago

Hi @Cereal2nd , I've gone ahead and created a Pull Request.

d3claes commented 3 years ago

Hi @wlcrs , Thank you for your feedback. I've tested your code and it works impecably! The process goes through all the addresses.

velbus_output.txt

Well done and much appreciated. Can't wait to see this in HA. Sincerely

cereal2nd commented 3 years ago

this should be fixed with https://github.com/Cereal2nd/velbus-aio/pull/11