input_datetime always triggers at the earliest setup time
The problem
I use an input_datetime helper with only has_time: true to trigger an automation. The automation is successfully triggered, but always to the earliest time that the input_datetime was set.
Try (1):
- Set
input_datetimeto 8:00 - Automation triggers at 8:00
Try (2):
- Set
input_datetimeto 7:30 - Automation triggers at 7:30
Try (3):
- Set
input_datetimeto 8:00 - Automation triggers at 7:30
What version of Home Assistant Core has the issue?
core-2024.4.4
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Container
Integration causing the issue
input_datetime
Link to integration documentation on our website
https://www.home-assistant.io/integrations/input_datetime/
Diagnostics information
No response
Example YAML snippet
alias: Office
description: ""
trigger:
- platform: time
at: input_datetime.alarm_trigger
condition:
- condition: state
entity_id: cover.sonoff_1001436ec2
state: closed
enabled: true
action:
- service: automation.turn_off
data:
stop_actions: false
target:
entity_id:
- automation.alarm_office_light
- device_id: ae46f496b8fae2259607945b87c165e7
domain: cover
entity_id: cover.sonoff_1001436ec2
type: set_position
position: 70
- if:
- condition: state
entity_id: sun.sun
state: below_horizon
then:
- type: turn_on
device_id: 7ad2f00102d55da8a94aa3621253544b
entity_id: 9e7ec3253b5acfb37a49e4dc78656c51
domain: switch
mode: single
Anything in the logs that might be useful for us?
No response
Additional information
The value for the input_datetime is set in the UI using an Entity Card. Looking into the Developer Tools, the timestamp is updated accordingly.
Hey there @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration (input_datetime) you are listed as a code owner for? Thanks!
Code owner commands
Code owners of input_datetime can trigger bot actions by commenting:
@home-assistant closeCloses the issue.@home-assistant rename Awesome new titleRenames the issue.@home-assistant reopenReopen the issue.@home-assistant unassign input_datetimeRemoves the current integration label and assignees on the issue, add the integration domain after the command.@home-assistant add-label needs-more-informationAdd a label (needs-more-information, problem in dependency, problem in custom component) to the issue.@home-assistant remove-label needs-more-informationRemove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.
(message by CodeOwnersMention)
input_datetime documentation input_datetime source (message by IssueLinks)
I think I ran into this exact same problem this morning. The weird part is I have had this automation active for a few months now and don't think I have run into it before. Maybe rebooting the server (which I do every few days on average for tweaks and updates) fixes the problem or something? Not sure. My guess is that it might be something to do with the time trigger not being notified of a change to the value of the helper.
I have tried to capture as much detail as I can, with both the actual state of the helper as well as the automation's trace and actual behavior. Hope this helps! Happy to try and answer questions to support.
automation.yaml.txt
history.csv
trace automation.handler_mbr_state 2024-05-18T10 00 00.103390+00 00.json
Copied text from my post on Discord:
Hello! I have tried to find a similar problem to mine but have not (I may not know what to look for). I would like to see if anyone can help me understand my experience or agree that I may have found a bug to report. I am running 2024.5.3.
I have an automation that essentially acts as a wake-up alarm (turns on lights and opens blinds). It has worked well for me for months. This morning it woke me up at the wrong time and I am not sure why.
I have a datetime helper that I set to 0600 on weekdays and 0830 on weekends. This morning was supposed to be handled as a weekend, but it was triggered early. Looking at the history, the helper was correctly updated on Friday to 0830, so the automation should have triggered at that time on Saturday, but it triggered at 0600 instead, and the debug log indicates that it believed the value of the helper was 0600.
How did the automation trigger based on the previous time from the helper? (I have screenshots but Discord will not let me upload).
Thank you.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.