Temperature sensor template log TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'

A little explanation on what @Tediore said. last_changed will either be None or a datetime object. Neither of those objects can be converted to a float.

The method as_timestamp() handles both of those objects. So just remove the |float after the fact.

Also, please take the time to learn how to properly format your posts. Follow step 11.

1 Like