Proposal: Extend replaceDisabled logic to DT_ENUM and DT_BITS to prevent stale values in Home Assistant #816
Replies: 3 comments 1 reply
|
Hi @makroground interesting read. Most of the basic parameters HA integration support don't have this issue. But as I am extending the capabilities I have to keep this in mind. |
|
Hi @liudger and @makroground, just to clarify the meaning of That's why we allowed the |
|
Thanks @fredlcore for the clear explanation. I have todo some rewrite of bsblan library to handle regards WJ |
Uh oh!
There was an error while loading. Please reload this page.
Hi @fredlcore and all other contributors on this great project!
With the recently released version 5.1, I recompiled the firmware and noticed the Home Assistant-specific configuration variables in BSB_LAN_config.h thanks to the detailed changelog (#Breaking changes#). My Home Assistant history is finally free of conversion errors caused by the '---' string being interpreted as a number. This is a great improvement!
However, among the parameters I currently transmit to Home Assistant (via MQTT), there are also non-numeric ones, and I noticed an unexpected behavior there. Due to how Home Assistant handles data, it also struggles with processing '---' values for certain non-numeric data types. I researched a bit and found the issue #732 which introduced the config parameter (and the underlying logic) as solution for this specific case in the first place. After some old school code reseach (scrolling through BSB_LAN.ino) I understood, that the logic was only implemented for numeric parameters. In fact, Home Assistant only reports this conversion error only for numeric entities, because there are serios issues within the Home Assistant internal database. For other entities those conversion errors won't reported - even - they - exist - .
Specifically, this affects parameter "8304 Diagnose Erzeuger - Zustand Kesselpumpe (Q1)" on my Brötje heating system. This parameter is not of type DT_VALS but DT_ENUM. When the pump turns off, the value changes to '---' instead of '0' (for "Off"). This is just how the Brötje internal logic works, which is completely fine. We have to deal with it.
The issue in Home Assistant: Because '---' cannot be parsed into the expected state, Home Assistant keeps the last known valid state (e.g., '1' / 'On'). As a result, it looks like the pump is running endlessly, even though it is actually off.
My Idea / Proposal:
I completely understand that we probably shouldn't blindly apply the replaceDisabled logic to all data types (especially strings, where it might cause unwanted side effects). However, would it be possible to include a few less critical, discrete data types in the replacement logic? I am specifically thinking of DT_ENUM and DT_BITS.
I am none of the cool new vibe coders out there or have an coding agent like Codex or Claude Code. Neither I am familiar with the whole project and BSB bus magic on byte level. So it would be great if some could look deeper into this, if there is any way to use replaceDisabled value also for DT_ENUM and DT_BITS (and maybe more).
PS: I want to use MQTT and not the Home Assistant Integration BSB-LAN which uses HTTP API calls. Even if the Integration is maybe more optimized for Home Assistant and maybe handles conversions of '---' slightly better.
Have a nice summer day, Ricardo.
All reactions