I've recently got a handful of Nanoleaf's Sense+ remotes, which work amazingly well... With the limited number of products they support. In my office, I have both a Shapes and an older Light Panels setup. Sadly, Sense+ at this moment does not support the latter.
However HA does expose state changes for both, and I was hoping to utilise an automation to be triggered by a state change on the Shapes device, then use that state change to create a differential list of state and attribute fields that changed (e.g. if I change the effect, or the brightness, etc.), then apply those changes to the Light Panels (potentially with a 200-400ms debounce to avoid duplicate events when I control the two lights as a group).
But I can't seem to get the logic right. My idea was to create a variable and template the hell out of it to give me a dict of changed attributes, something like this:
{ 'state': { 'from': 'off', 'to': 'on'}, 'brightness': { 'from': 0, 'to': '80'}, 'effect': { 'from': 'off', 'to': 'Forest'}
I'm already at odds with Python, Jinja templating makes it even harder, and HA's limitations (e.g. no access to the various dict methods like update) just make me want to hang my head in the wall.
I really want to avoid hardcoding the attributes that I monitor, so a solution that could dynamically filter out changed attributes and map them to the above format would be the best approach for me I think.
Any ideas how this could be nicely implemented?