Tried to figure this out, but can’t find any approach to solve this… Hope the collective brain can help
Idea: Have a WS2812b / Neopixel strip with 8 LEDs for visual indication on the status of some of my Home Assistant binary sensors (Heating, Utility Meter, NAS, Solar inverter, Internet-connection cpu, disk and memory in HA - Probably more to come) Each LED represent a sensor - If everything is OK, all green, if Heating-sensor and NAS is disconnected (Boolean=FALSE), the LEDs would read: Red-Green-Red-Green-Green-Green-Green-Green
The initial idea is to use a binary representation like 01011111 (representing Red-Green-Red-Green-Green-Green-Green-Green) then use an logical OR when status is TRUE, and a XOR if FALSE
Example:
10000000 Heating
01000000 Utility Meter
00100000 NAS
00010000 Solar inverter
00001000 Internet
00000100 cpu
00000010 disk
00000001 memory
Start - All status unknown, assume FALSE: Status=00000000
NAS becomes available (TRUE) : 00000000 OR 00100000 = 00100000
Solar becomes available (TRUE): 00100000 OR 00010000 = 00110000
Mem becomes available (TRUE): 00110000 OR 00000001 = 00110001
NAS is UNavailable (FALSE) : 00110001 XOR 00100000= 00010001
How do i reflect this with the LEDs - Could I use Fastled, or another thing ??? an example would be GREAT
(For version 2: gradient color for Power consumption etc.)
Had a little problem with Home Assistant not discovered new ESPhome devices, but luckily the update was there after an hour of search…
Thanks again @tom_l - This is the result… Works great. I used 16 LEDs, because they exactly fit the with of a 19" rack, and my leftover strip was exactly 16 LEDs
Implemented and Tested version of ESPhome code: