Helper input_datetime reset after reboot

Hi !
I’ve setup an automation to start at a specific time:

alias: "auto rug heater on "
description: ""
  - platform: time
    at: input_datetime.rug
  - platform: time
    at: input_datetime.morning_trigger
condition: []
  - service: switch.turn_on
    data: {}

This specific time is a helper input_datetime

All works fine, until I reboot/restart HA, the helper is reset to 00:00

If it’s relevant, HA is running on a raspberry pi using docker:

docker-compose file (no changes from the standard)

version: "3"
    container_name: homeassistant
    network_mode: host
      - PUID=1000
      - PGID=1000
      - TZ=Europe/London
      - /volume1/Documents/raspberrypis/docker/ha/config:/config
      - 8123:8123 #optional

    restart: unless-stopped

Is that expected behaviour?
Any workarounds?

Thanks in advance,

Do you have the initial value option set for the input datetime?

If so, remove it.

Screenshot 2023-01-30 at 13-43-02 Input Datetime

I created using the UI, and there’s no such parameter. How can I check / enforce there’s no “initial” then?

Good question. I don’t use the UI so I had no idea. I just had a look at the UI and there is indeed no initial option.

Looking in Developer Tools → States, in the right hand column, what attributes are listed for your datetime helper?

Doesn’t have an initial attribute…

has_date: false
has_time: true
editable: true
hour: 14
minute: 25
second: 0
timestamp: 51900
friendly_name: rug

It could be that the input_datetime is not being restored. Have you excluded it from the recorder database?

I didn’t change anything on this.
The odd part is that the “reset” doesn’t always happen… while chatting here, trying to reboot etc… it didn’t happened again…

Let’s pause this thread and I’ll come back when it’s reproducible ?

1 Like

I got the same issue with two input_datetime helpers.
Their values is set (and never restored) to current time when system restarts.
Did you find an solution?

The culprit of my issue was an Automation that got triggered and resulted in a setting of current time.

    - platform: numeric_state
      entity_id: sensor.<some power consumption sensor id>
      below: input_number.<some numeric helper id>
  - service: input_datetime.set_datetime
      timestamp: "{{ now().timestamp() }}"
      entity_id: input_datetime.<the timestamp helper being set at system restart>

This gets triggered every time at restart even if the sensor value hasn’t been changed.