Unique ID error for template sensor

Why? There are numerous options to do what you are trying to do without resorting to janky Pyscripts to overwrite states.

  • If you just want to write a state to an entity, use one of the Input Helpers like an Input Text or Input Select… that is literally the reason they exist, as places to store user-defined data.
  • You may be able to do it with just a state-based Template sensor
  • If the automation’s triggers are a necessary for the final results, use Trigger-based template sensors
  • Alternatively, there’s the Times of Day integration… not exactly what you are doing but a similar concept.
1 Like