At the momemnt, i’m not very familiar with the more advanced functions of home assistant.
My current situation is, that I have 4 binary signals from a KNX binary input.
So there are 4 entities at home assistant which can be on or off.
With these 4 entites I would like to build an integer value which represents the values from 0 to 10.
Entity 1 = Bit 1 = Int 1
Entity 2 = Bit 2 = Int 2
Entity 3 = Bit 3 = Int 4
Entity 4 = Bit 4 = Int 8
When the signal is on I would like to sum up the values or use bitwise functions.
My aim is to display the value and also use the value for automations but right now I have no idea where I have to start from.
Maybe someone can give me a hint on this.
Thanks and kind regards
Alex
Maybe with a template sensor, which checks the state of each entity and gives it a value based on the bit and state of the entity and then sum up the values.
I don’t know if it can be done in native ha automation or in templates.
But for sure it can be done in NodeRed, for example using build-in JavaScript. Possible NR offers some fancy node which could do the same, but using JS will be efficient in this case too.
from implementation point, you have to monitor change of any of those sensors. When at least one changes, collect states of all of them and map into bits of integer value
Then result could be send to a sensor also created by NR