-
Hi all, I'm working on improving the Madimack Elite V3 pool heatpump definition. According to Query Things Data Model on the Tuya Developer platform, regarding fault codes, the heat pump returns the following 2 dpids:
Both data points seem to be bit flags, with more then 1 possible bit set. BTW: I did confirm that on dpid 15, value 4 (binary 0000 0100) equals error E3. (this is a no water flow error which I can easily trigger) So: how can I alter the device definition that correctly translates these bit flags to Home Assistant? Writing out all possible bit combinations is not feasible (2^30 is roughly 1 billion). |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The type The difference between So your mapping just needs to match the individual values you want to match. Since there can only be a single value at the end, the first match is used, so if you want to detect multiple values at once, use a binary_sensor for every important thing you want to detect. |
Beta Was this translation helpful? Give feedback.
The type
bitfield
is designed to handle this (I came up with the type name before I saw that Tuya uses bitmap, and I avoided that name to avoid confusion with the image type).The difference between
integer
andbitfield
is that when comparing mappings, instead of a normal = comparison, the bitfield compares only the bits that are set (current_value & mapping_value = mapping_value).So your mapping just needs to match the individual values you want to match.
Since there can only be a single value at the end, the first match is used, so if you want to detect multiple values at once, use a binary_sensor for every important thing you want to detect.