Unavailable / Unknown Entity Monitoring - Template Sensor

That’s a long-winded discussion that has taken place in this thread (deep within its bowels) and I don’t want to repeat it here.

It almost doesn’t matter if you do or don’t include sensor.time because 0.115 handles that template quite differently.

Because the template begins with states (as seen in {% set count = states|selectattr( ...) 0.115 will assign listeners to each and every entity in your system. That means the moment any entity changes state, the template will be evaluated. That’s more frequently than is needed but that’s how it now works in 0.115.

To prevent it, either don’t use states in a template (given the purpose of this particular Template Sensor, that’s not a practical option) or replace the entire Template Sensor with a completely different solution. That’s what’s happening in this thread: