Feeds/Sleeps/TummyTime that start before midnight and end after midnight are not saved.
brylee123 opened this issue · 1 comments
service: babybuddy.add_feeding
data:
method: Bottle
type: Fortified breast milk
amount: >-
{{ (states.input_number.bottle_pre_feed.state | int) - (states.input_number.bottle_post_feed.state | int) }}
notes: Auto-Log from Smart Scale.
start: >-
{{ as_timestamp(states.input_datetime.baby_feed_start.state) | timestamp_custom('%H:%M:%S') }}
end: "{{ now().strftime('%H:%M:%S') }}"
target:
entity_id: switch.baby_timer
If a feed starts and ends on the same day, this is not an issue. It will populate the correct times for both fields. I am assuming since this service call only takes a time format instead of datetime, it assumes the times are all on the same date, which causes these issues.
My proposed solution is to use a datetime object across all the service calls. Pumping, tummy time, sleep, and feedings.
Edit: I want to point out that I am not using the timer feature as I am storing start and end times automatically in a sensor/input_datetime object. I am unsure on how to use the timer feature (via home assistant service calls) when I would need multiple timers to be simultaneously running. (sleep, feedings, etc)
I think something may be wrong with your datetime formats, because we should be able to accept that.
This works just fine:
action: babybuddy.add_feeding
data:
start: "2024-10-08 15:00:00"
end: "2024-10-09 08:10:00"
type: Breast milk
method: Bottle
amount: 1
notes: >-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur et
blandit elit. Duis in varius eros. Morbi eleifend, nulla a.
target:
entity_id: switch.test_baby_timer