Instantly share code, notes, and snippets.
Why not map all on_states into a 'combined' state first? (just make each attribute into a list of values, order is not important right?)
So you would work with:
on_states: { 'brightness': [255, 232, 200] 'xy_color': [[1.0, 1.0],[1.2, 1.2],[1.5, 1.1], 'rgb_color': [[255, 255, 255],[255, 255, 255],[255, 255, 255]] 'white_value': [0, 0, 0.1] 'supported_features': [1, 2, 345] })
Then you only need to iterate the states once and can just pass each attributes list to your reduce function.
Oh, and that first (and faster) function a A LOT more readable. (that counts too imo)
Sorry, something went wrong.
Why not map all on_states into a 'combined' state first?
(just make each attribute into a list of values, order is not important right?)
So you would work with:
Then you only need to iterate the states once and can just pass each attributes list to your reduce function.
Oh, and that first (and faster) function a A LOT more readable. (that counts too imo)