Template Time
The template time platform allows you to create a real time clock whose value is computed by a
lambda. A common use is deriving a new time source by
applying an offset to an already-synchronized time source.
The computed time is only seen by components that use this time source, for example through a
time_id option. It is never written to the device’s system clock, so the rest of the device keeps using the
real time.
# Example configuration entrytime: - platform: sntp id: sntp_time
- platform: template id: offset_time lambda: |- return id(sntp_time).timestamp_now() + 3600;Configuration variables
Section titled “Configuration variables”-
lambda (Required, lambda): Lambda that returns the current time as a UNIX timestamp (an integer number of seconds since 1970-01-01 00:00:00 UTC). It is evaluated every time this time source’s current time is read, for example by calling
.now()on it in a lambda. Return{}if a value isn’t currently available. -
All other options from Base Time Configuration. The time is computed whenever it is read, so
update_intervalhas no effect.