I am looking for history tracking of the brightness values for all my Zwave devices. Is there an integration, blueprint, or something I can leverage? This is so basic, I’ve been searching and cannot seem to find anything that makes it easy to just add a list of devices to log their brightness values.
Create a template sensor. Settings → devices and services → helpers → create a helper → template → sensor
Use this as a state template:
{{ (state_attr('light.my_dimmable_light', 'brightness') | int(0) / 255) | round(2) }}
That will give you a number between 0-100. You’ll need a helper for each light you want to track.
Thanks, that generally works but is inaccurate – probably because the device is Zwave, and the brightness value is 0-99 – which means when HA shows the light at 50% this template returns 51.
It’s not inaccurate, it shows what HA believes the brightness to be. The brightness value for any dimmable light is represented as a value from 0-255 in HA, and in each dimmable light entity it is stored as an attribute called brightness. Go to developer tools → states, search for your light entity, and find out what the value is for the brightness attribute as you adjust the dimmer to different settings.
For my zwave devices, even if I open up zwave-js-ui, and directly send a zwave command to set my light to 50%, when I go into HA it will show the light at 51% and the brightness attribute will be 129. If I try within HA to set it to 50%, it will jump to 51% after I let go of the slider. I can even programmatically set it to 50% with the light.turn_on action and it will still jump to 51%.