Replies: 2 comments 9 replies
-
Yeah this also came to my mind when I was refactoring Alarm sensor for the SG0??P3 😉 and added during that period masking according index using |
Beta Was this translation helpful? Give feedback.
-
My Solis inverter uses a lot of bit fields, in theory each bit should be mapped to a binary sensor which is what I've done although I've only mapped the bits that I need rather than the 100s available though. However, I've discovered several of the bits are mutually exclusive so could be combined into one sensor. For instance the running normally bit is never set at the same time as the initialising bit nor the standby bit which makes sense but anither model may work differently. I currently read the whole bit field and then decode the individual bits like this.
a more efficient syntax could be as follows, the binary sensor is assumed as it couldn't be anything else. device_class, state_class, icon being optional and used as needed.
|
Beta Was this translation helpful? Give feedback.
-
Hi,
In the KSTAR Hybrid integration, I have several alarm/error codes that come from a bitmap lookup. For example, the
DSP alarm code
sensor is a U32 value which has a lookup table like the following:Currently I read the value as bits with
rule: 6
, so in the last couple of days, it has had the following values:During the night it has value
0x2090
, which translates to codesW04
,W07
andW13
. In the morning it moves to0x2080
(W07
andW13
), then to0x80
(W07
) and finally to no alarm (0x0
) when it is properly producing in the morning.I have several bitmap lookup tables like this. What would be the best way of setting this in the profile definition? I don't want to add 100+ sensors for each different bit on each of the different sensors that have this kind of lookup.
Beta Was this translation helpful? Give feedback.
All reactions