'simple' example to move extra_state_attributes to sensors


Does someone know where to find ‘simple’ examples where an extra_state_attribute is rewritten to a sensor? I would like to rewrite the extra_state_attributes to sensors but having difficutly finding out how to do this?

I have been rewriting my multizone thermostat custom component (github) which includes quite some internally calculated values and make those available via extra_state_attributes (such as: filtered sensor state, PID values, pwm signals) that change regularly. In the documentation it is mentioned that this should be avoided as it increases the database size and those attributes should be included by sensors.

Is anyone able to point me to some options or give me some guidance where to look? Especially how to include sensors depening the thermostat configuration and getting states from and updating to these sensors.