Support for Velbus Home Automation

Hi @Cereal2nd

I have to apologize! I was a bit too quick with my statement that the simulate button press feature does not work, because it does…!
It works for all push button devices - VMB2PBN, VMB6PBN, VMBELO, …
The reason why I flagged it as non working was because I’m trying to use the virutal buttons on my VMBELO’s in the higher numbers, buttons above nr 8 and that does not work yet, probably because it is assumed there are no more than 8 buttons? The VMBELO has up to 32 buttons :smiley:
I’ve tested and everything works untill button 8, 9 no longer works.

Kind regards,
Jeroen

1 Like

aha, that explains it i had been testing here and it worked.

this is probably because of the submodules, i did not think of this part

2 Likes

starting out with this integration for Velbus, I’ve run into a bug involving a VMBMETEO regularly sending a memo_text message (AC) with just a linefeed char, causing an exception in memo_text.py as follows:

2022-09-05 21:29:41.455 DEBUG (MainThread) [velbus-protocol] RX: RawMessage(priority=fb, address=fe, rtr=False, command=229, data=b'e5 04 00')
2022-09-05 21:29:41.455 DEBUG (MainThread) [velbus-packet] Received {"name": "SensorTempRequest", "priority": 251, "address": 254, "rtr": false, "data": ""}
2022-09-05 21:29:41.481 DEBUG (MainThread) [velbus-protocol] RX: RawMessage(priority=fb, address=fe, rtr=False, command=169, data=b'a9 03 04 00 03 00 00')
2022-09-05 21:29:41.481 DEBUG (MainThread) [velbus-packet] Received {"name": "MeteoRawMessage", "priority": 251, "address": 254, "rtr": false, "data": "", "rain": 2.4125, "light": 0.09375, "wind": 0.0}
2022-09-05 21:29:41.497 DEBUG (MainThread) [velbus-protocol] RX: RawMessage(priority=fb, address=fe, rtr=False, command=172, data=b'ac 04 00 20 20 20 20 20')
2022-09-05 21:29:41.497 DEBUG (MainThread) [velbus-packet] Received {"name": "     ", "priority": 251, "address": 254, "rtr": false, "data": "", "start": 0, "memo_text": ""}
2022-09-05 21:29:41.506 DEBUG (MainThread) [velbus-protocol] RX: RawMessage(priority=fb, address=fe, rtr=False, command=229, data=b'e5 00')
2022-09-05 21:29:41.506 DEBUG (MainThread) [velbus-packet] Received {"name": "SensorTempRequest", "priority": 251, "address": 254, "rtr": false, "data": ""}
2022-09-05 21:29:41.512 DEBUG (MainThread) [velbus-protocol] RX: RawMessage(priority=fb, address=fe, rtr=False, command=172, data=b'ac 04 05 33 20 6c 75 78')
2022-09-05 21:29:41.512 DEBUG (MainThread) [velbus-packet] Received {"name": "3 lux", "priority": 251, "address": 254, "rtr": false, "data": "", "start": 5, "memo_text": ""}
2022-09-05 21:29:41.538 DEBUG (MainThread) [velbus-protocol] RX: RawMessage(priority=fb, address=fe, rtr=False, command=230, data=b'e6 23 a8 15 0a 5c 07')
2022-09-05 21:29:41.538 DEBUG (MainThread) [velbus-packet] Received {"name": "SensorTemperatureMessage", "priority": 251, "address": 254, "rtr": false, "data": "", "cur": 17.828125, "min": 10.51953125, "max": 46.013671
875}
2022-09-05 21:29:41.551 DEBUG (MainThread) [velbus-protocol] RX: RawMessage(priority=fb, address=fe, rtr=False, command=172, data=b'ac 04 0a 00')
2022-09-05 21:29:41.551 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/velbusaio/protocol.py", line 169, in _process_message
    await self._message_received_callback(msg)
  File "/usr/local/lib/python3.10/site-packages/velbusaio/controller.py", line 55, in _on_message_received
    await self._handler.handle(msg)
  File "/usr/local/lib/python3.10/site-packages/velbusaio/handler.py", line 83, in handle
    msg.populate(priority, address, rtr, data)
  File "/usr/local/lib/python3.10/site-packages/velbusaio/messages/memo_text.py", line 30, in populate
    self.needs_data(data, 7)
  File "/usr/local/lib/python3.10/site-packages/velbusaio/message.py", line 214, in needs_data
    self.parser_error(
  File "/usr/local/lib/python3.10/site-packages/velbusaio/message.py", line 134, in parser_error
    raise ParserError(self.__class__.__name__ + " " + message)

This is preventing the VMBMETEO module from fully loading and the velbus integration from completing it’s startup (it keeps waiting 15 seconds for 5 minutes when it finally gives up).
This error also keeps repeating as this message keeps comming back on the bus.

Would it be possible to fix this please?
Or alternatively let me know how to convince the VMBMETEO not to send this empty message in the first place?

Thanks!

@Cereal2nd

Hi

According to page 9 of the VMBMETEO protocol document, 0xAC message from a Meteo is the light / rain / wind level as a string


You’ll have to check, but I think you can configure the Metro to not send light / rain / wind updates.
(You might have to look at the advanced options. I’m not near my office for a few days, I’ll try to remember to look when I get back)

shorter text stings must be ended with a zero value

i have the impresison that this message that you are receicing from your vmbmeteo is invallid …

looking at the docu i think at least the first message should be filled up with all zero values

Hey can you get me the hass diagnostics of this device?
looking at the code it should handle the submoduels correct.

what do you mean exactly :slight_smile: how do i get that?

never mind :stuck_out_tongue: found it.

{
  "home_assistant": {
    "installation_type": "Home Assistant Container",
    "version": "2022.7.7",
    "dev": false,
    "hassio": false,
    "virtualenv": false,
    "python_version": "3.10.5",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Europe/Brussels",
    "os_name": "Linux",
    "os_version": "5.4.0-124-generic",
    "run_as_root": true
  },
  "custom_components": {
    "reolink_dev": {
      "version": "0.30",
      "requirements": [
        "reolink==0.0.34"
      ]
    },
    "hacs": {
      "version": "1.26.2",
      "requirements": [
        "aiogithubapi>=22.2.4"
      ]
    },
    "afvalbeheer": {
      "version": "4.9.6",
      "requirements": [
        "rsa",
        "pycryptodome"
      ]
    },
    "midea_ac": {
      "version": "0.1.35",
      "requirements": [
        "msmart==0.1.35",
        "pycryptodome",
        "pycryptodomex",
        "click"
      ]
    },
    "alexa_media": {
      "version": "3.10.10",
      "requirements": [
        "alexapy==1.25.1",
        "packaging>=20.3",
        "wrapt~=1.12.1"
      ]
    },
    "arris_dcx960": {
      "version": "1.0.8",
      "requirements": [
        "arris-dcx960==0.1.5"
      ]
    }
  },
  "integration_manifest": {
    "domain": "velbus",
    "name": "Velbus",
    "documentation": "https://www.home-assistant.io/integrations/velbus",
    "requirements": [
      "velbus-aio==2022.6.2"
    ],
    "config_flow": true,
    "codeowners": [
      "@Cereal2nd",
      "@brefra"
    ],
    "dependencies": [
      "usb"
    ],
    "iot_class": "local_push",
    "usb": [
      {
        "vid": "10CF",
        "pid": "0B1B"
      },
      {
        "vid": "10CF",
        "pid": "0516"
      },
      {
        "vid": "10CF",
        "pid": "0517"
      },
      {
        "vid": "10CF",
        "pid": "0518"
      }
    ],
    "loggers": [
      "velbusaio"
    ],
    "is_built_in": true
  },
  "data": {
    "type": "VMBELO",
    "address": [
      34,
      45,
      46
    ],
    "name": "Glass Pannel Zolder",
    "sw_version": "61043-2.71.0",
    "is_loaded": true,
    "channels": {
      "1": {
        "num": 1,
        "name": "Zolder-P1",
        "is_loaded": true,
        "address": 34
      },
      "2": {
        "num": 2,
        "name": "Zolder-Zolder",
        "is_loaded": true,
        "address": 34,
        "led_state": "off",
        "closed": false
      },
      "3": {
        "num": 3,
        "name": "Zolder-P3",
        "is_loaded": true,
        "address": 34
      },
      "4": {
        "num": 4,
        "name": "Zolder-TechnRuim",
        "is_loaded": true,
        "address": 34,
        "led_state": "off",
        "closed": false
      },
      "5": {
        "num": 5,
        "name": "Zolder-Override",
        "is_loaded": true,
        "address": 34
      },
      "6": {
        "num": 6,
        "name": "Zolder-P6",
        "is_loaded": true,
        "address": 34
      },
      "7": {
        "num": 7,
        "name": "Zolder-P7",
        "is_loaded": true,
        "address": 34
      },
      "8": {
        "num": 8,
        "name": "Zolder-P8",
        "is_loaded": true,
        "address": 34
      },
      "9": {
        "num": 9,
        "name": "Zolder-P9",
        "is_loaded": true,
        "address": 34
      },
      "10": {
        "num": 10,
        "name": "Zolder-P10",
        "is_loaded": true,
        "address": 34
      },
      "11": {
        "num": 11,
        "name": "Zolder-P11",
        "is_loaded": true,
        "address": 34
      },
      "12": {
        "num": 12,
        "name": "Zolder-P12",
        "is_loaded": true,
        "address": 34
      },
      "13": {
        "num": 13,
        "name": "Zolder-Off",
        "is_loaded": true,
        "address": 34,
        "closed": false
      },
      "14": {
        "num": 14,
        "name": "Zolder-Clear",
        "is_loaded": true,
        "address": 34,
        "closed": false
      },
      "15": {
        "num": 15,
        "name": "Zolder-Wakeup",
        "is_loaded": true,
        "address": 34,
        "closed": false
      },
      "16": {
        "num": 16,
        "name": "Zolder-Sleep",
        "is_loaded": true,
        "address": 34,
        "closed": false
      },
      "33": {
        "num": 33,
        "name": "Temp Zolder",
        "is_loaded": true,
        "address": 34,
        "thermostat": true,
        "cur": 27.0,
        "target": 5.0,
        "cmode": "safe",
        "cstatus": "run",
        "min": 19.234375,
        "max": 30.21875
      },
      "34": {
        "num": 34,
        "name": "Heater",
        "is_loaded": true,
        "address": 34
      },
      "35": {
        "num": 35,
        "name": "Boost",
        "is_loaded": true,
        "address": 34
      },
      "36": {
        "num": 36,
        "name": "Pump",
        "is_loaded": true,
        "address": 34
      },
      "37": {
        "num": 37,
        "name": "Cooler",
        "is_loaded": true,
        "address": 34
      },
      "38": {
        "num": 38,
        "name": "Alarm 1",
        "is_loaded": true,
        "address": 34
      },
      "39": {
        "num": 39,
        "name": "Alarm 2",
        "is_loaded": true,
        "address": 34
      },
      "40": {
        "num": 40,
        "name": "Alarm 3",
        "is_loaded": true,
        "address": 34
      },
      "41": {
        "num": 41,
        "name": "Alarm 4",
        "is_loaded": true,
        "address": 34
      },
      "42": {
        "num": 42,
        "name": "Output Zolder",
        "is_loaded": true,
        "address": 34
      },
      "97": {
        "num": 97,
        "name": "Edge Lit",
        "is_loaded": true,
        "address": 34
      },
      "98": {
        "num": 98,
        "name": "Memo Text",
        "is_loaded": true,
        "address": 34
      }
    }
  }
}

First of all, @MDAR thanks for the protocol spec. This clears up a few things…

@Cereal2nd

The text message is clearly made up of three packets as seen here in velbuslink:

image

so the string is made up of 10 characters and a zero at the end as described in the protocol, because it’s shorter than 15 characters.
I don’t see a requirement that all databytes need to filled in in the last packet, just that the string ends with a zero value, which it does.
So I don’t realy get why needs_data() in the memo_text.py is set to 7 when the minimum observed in a packet is actually 3 (one byte for the sensor type, one for the position which is 10, and the zero)

I’ve tried disabling this “Sensor readout in text string command” from being sent by the module, but it seems to just send it along whenever a sensor value request is received.
The module can be configured to send these values anyway without requests, but that function is still turned off as by default.
Anyway, it seems a scan triggers it as well, so it will always be there during hass startup, blocking the module from loading properly.

Thanks again for for your help on this.

1 Like

correct i just fixed it

what channel number are you using for this test?

I think it was channel 13, I currently have enabled in velbus button channels untill 16. All above 8 don’t work in HA.
1-8 use ID 22, where 9-16 are 2D.

I’ll look into it this weekend. It will probably be a stupid bug in velbusaio.

The vmbmeteo set memo t XT message is fixed in 2022.9.2

Maikel

1 Like

I would expect that the current code can cause problems because you wait exactly 1 second. This is also the threshold between a ‘short press’ and a ‘long press’

I would suggest changing that value 1 to 0.2, and maybe also implement a long_press function that is identical with the sleep-time set to 1.5 seconds instead ? (Or make the press-time configurable in that function? Because a long-press is also configuable in Velbus, and theoretically users can need longer button press-times than 1.5 seconds…)

1 Like

FYI

Long_Press is a different command in Velbus.

It’s the sender that defines the timings, rather than the listening device waiting.

A short press is made up of

  • Short_Press
  • Release

Whereas a Long_Press looks like this

  • Short_Press
    {Wait}
  • Long_Press
    {Wait until user releases button}
  • Release

In theory, software like HA could just send the Long_Press and Release packets without upsetting the listening device.
(It’s certainly possible to do this within the timers section of Velbus modules)

1 Like

the button press is fixed

2 Likes

Hi,

Could someone tell me what is the cause of these error messages?

Logger: homeassistant
Source: /usr/src/homeassistant/homeassistant/runner.py:96
First occurred: 21:05:39 (12 occurrences)
Last logged: 21:08:08

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/local/lib/python3.10/site-packages/velbusaio/protocol.py”, line 169, in _process_message
await self._message_received_callback(msg)
File “/usr/local/lib/python3.10/site-packages/velbusaio/controller.py”, line 55, in _on_message_received
await self._handler.handle(msg)
File “/usr/local/lib/python3.10/site-packages/velbusaio/handler.py”, line 90, in handle
address, command_value, “:”.join(format(x, “02x”) for x in data)
TypeError: ‘NoneType’ object is not iterable

1 Like

Hi all,

I’ve installed the newest Home Assistant 2022.9.4. After this, my Velbus installation was broken again as happened before when installing a new version. All entities are loaded, but none work (e.g. when enabling a light, the light does not go on and it gets disabled again in Home Assistant without an action happening).

Previous fix for this was to fully delete the Velbus integration and delete the velbus cache folder; and then re-install the integration.
I’ve tried this, but when installing the Velbus integration again, it gives me an “Unknown Error” message when trying to add the integration (on the screen where you need to provide a name and a connection string).

Name: Velbus
Connection string: 127.0.0.1:6000 (I’m using Velserv locally on that same machine).

Any ideas someone? Maybe @MDAR , @Cereal2nd ?
Thanks!

The error log states the following:

Logger: aiohttp.server
Source: components/velbus/config_flow.py:24
First occurred: 12:04:27 PM (7 occurrences)
Last logged: 12:08:08 PM

Error handling request
Traceback (most recent call last):
  File "/home/homeassistant/.pyenv/versions/3.9.8/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/home/homeassistant/.pyenv/versions/3.9.8/lib/python3.9/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/home/homeassistant/.pyenv/versions/3.9.8/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/home/homeassistant/.pyenv/versions/3.9.8/lib/python3.9/site-packages/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/home/homeassistant/.pyenv/versions/3.9.8/lib/python3.9/site-packages/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
  File "/home/homeassistant/.pyenv/versions/3.9.8/lib/python3.9/site-packages/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
  File "/home/homeassistant/.pyenv/versions/3.9.8/lib/python3.9/site-packages/homeassistant/components/http/ban.py", line 82, in ban_middleware
    return await handler(request)
  File "/home/homeassistant/.pyenv/versions/3.9.8/lib/python3.9/site-packages/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
  File "/home/homeassistant/.pyenv/versions/3.9.8/lib/python3.9/site-packages/homeassistant/components/http/view.py", line 136, in handle
    result = await result
  File "/home/homeassistant/.pyenv/versions/3.9.8/lib/python3.9/site-packages/homeassistant/components/config/config_entries.py", line 178, in post
    return await super().post(request, flow_id)
  File "/home/homeassistant/.pyenv/versions/3.9.8/lib/python3.9/site-packages/homeassistant/components/http/data_validator.py", line 73, in wrapper
    result = await method(view, request, data, *args, **kwargs)
  File "/home/homeassistant/.pyenv/versions/3.9.8/lib/python3.9/site-packages/homeassistant/helpers/data_entry_flow.py", line 110, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/home/homeassistant/.pyenv/versions/3.9.8/lib/python3.9/site-packages/homeassistant/data_entry_flow.py", line 280, in async_configure
    result = await self._async_handle_step(
  File "/home/homeassistant/.pyenv/versions/3.9.8/lib/python3.9/site-packages/homeassistant/data_entry_flow.py", line 367, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/home/homeassistant/.pyenv/versions/3.9.8/lib/python3.9/site-packages/homeassistant/components/velbus/config_flow.py", line 66, in async_step_user
    if not self._prt_in_configuration_exists(prt):
  File "/home/homeassistant/.pyenv/versions/3.9.8/lib/python3.9/site-packages/homeassistant/components/velbus/config_flow.py", line 56, in _prt_in_configuration_exists
    return prt in velbus_entries(self.hass)
  File "/home/homeassistant/.pyenv/versions/3.9.8/lib/python3.9/site-packages/homeassistant/components/velbus/config_flow.py", line 23, in velbus_entries
    return {
  File "/home/homeassistant/.pyenv/versions/3.9.8/lib/python3.9/site-packages/homeassistant/components/velbus/config_flow.py", line 24, in <setcomp>
    entry.data[CONF_PORT] for entry in hass.config_entries.async_entries(DOMAIN)
KeyError: 'port'

1 Like

are you running HA in a container? with HAOS or any other version?

Did you upgrade the rest of the dependencies as well?

I’m on Home Assistant 2022.9.4, Supervisor 2022.09.1, Operating System 9.0, Frontend 20220907.2 -

and for me its still working…

Hey,

I’m on Home Assistant 2022.9.4, Frontend 20220907.2. I’m running Home Assistant Core on a DietPi installation.

As an experiment, I just tried manually adding a Velbus integration in the core.config_entries, and after a restart of HA, it is showing up as an installed integration. Since I also deleted the velbuscache folder, it’s now doing a full scan. We’ll see what the result is of this; it might fix it, but is a workaround of course for the initial issue.

Update:
Manually adding the integration to the core.config_entries en rebooting / full re-scan seems to have done the trick for my installation.
All modules seem to have loaded and interaction with lights and switches is working as expected as far as I can see right now.
I still can’t add a new one though, getting that same error message; not an issue for my installation anymore, but might be a bug somewhere when trying to add the tcp interface key into this config file.