Exploding one property into multiple properties

Use Calculated Properties to decode compactly-represented data for easier use

Devices which have very constrained networking may encode multiple properties into bitfields of a single property to save data. For example, a device might send a status byte where bit0 is 1 if there's an error, bits 1..3 indicate a packet count etc.

With CPs you can use maths and bitwise operators to select and extract those fields into separate properties again:


status & 1


status & 1 ? "bit zero is set" : "bit zero is clear"


(status / 4) % 16

(Dividing by 4 shifts-off the bottom two bits, then modulo 16 selects the next 4 bits)