When this is entered into the template page of developer tools it produces the expected result.
But it turns out that the sensor itself is not being created. It does not appear in the entities in the states page.
It’s also not available as an option in the logbook entities.
Could any of you fine much smarter than me people point out where I’ve gone wrong ?
Thanks
Silly question: what do you mean by “it turns out”? I assume you are transferring the template into configuration.yaml (or wherever you keep your templates), then reloading template yaml?
Yes the code used in the template produces the expected result when tested in the template page, but the same code (as above) when added to configuration.yaml does not then create the entity.
HA has been restarted, yaml reloaded many times since, but the entity is not created.