jcgoette / baby_buddy_homeassistant

This custom integration provides sensors for Baby Buddy API endpoints.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Date/Time could not be in the future

kazzaw opened this issue · comments

Attempting to run a script through home assistant to log a diaper change with the press of a button. This has worked well up until now, for some reason it is no longer working. Home assistant gives the following log error

Could not create changes. error: {'time': ['Date/time can not be in the future.']}

When calling the diaper change service manually the same error appears.

Logging normally through the web page works fine.

I'm not sure this is an issue with the HA integration. Have you seen babybuddy/babybuddy#300 (reply in thread)?

I had a look at that, I'm not using iOS so I can't see what the 'shortcuts' are.

I have a widget set through home assistant app (Android), for a wet or dirty diaper. When pressed, this runs a script which

  1. Call Service - Baby Buddy: Add diaper changer
    Target - Baby
    Change time - Empty (which should use now)
    Diaper Type -Solid

  2. Call Service - Grocy: Consume product from stock

When HA tries to make an entry into Baby Buddy, it gives the error mentioned above. If I try to manually (through developer tools) attempt to call the add diaper change service with no time, it also triggers the same error. If I do the above but put the time back ~30 minutes, it works fine.

When entering through Baby buddy direct, there is no issue. This has been working for ~1 week (since I configured it) without issue however has recently just stopped working.

Log times in Home Assistant are correct, as are the entries in Baby Buddy when I log them manually.

Perhaps there is a small time difference in the 2 devices which is causing the issue?

Do you mind reading through this exchange?

"Perhaps there is a small time difference in the 2 devices which is causing the issue?"
I think this is probably the case. I looked to see if BB had been updated to default to now() if no end provided, but that is not the case. Maybe @cdubz could give that some thought?

This just started happening to me about 2 hours ago. All changes from this morning were logged normally using HA buttons but now pressing the buttons gives me that same error.

My fix for the last 2 weeks has been to create REST commands in HA for my diaper logging buttons instead of calling this service. The time is set to now-1sec and that works perfectly. I don't want to create more REST entries for every single thing I log though so I'm hoping there's a fix to get this integration back up and running.

@five2seven what's stopping you from using the same time offset with the integration?

@five2seven how do you do this? I might have to take this route, I can't seem to figure out how to put a delay in the time when calling the service

Should be fixed in BB v1.11.0 via babybuddy/babybuddy#438.

bd55b1f allows the BB update to work, but fails back to now() if user hasn't upgraded BB yet.