Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

time data does not match format #381

Open
jubishop opened this issue May 14, 2024 · 2 comments
Open

time data does not match format #381

jubishop opened this issue May 14, 2024 · 2 comments

Comments

@jubishop
Copy link

from running the listen command, on every event i get on the command line:

Ring CLI
INFO:firebase_messaging.fcmpushclient:Registered with FCM
INFO:firebase_messaging.fcmpushclient:Succesfully logged in to MCS endpoint
Listening, press enter to cancel
 ERROR:firebase_messaging.fcmpushclient:Unexpected exception calling notification callback
Traceback (most recent call last):
  File "/Users/jubi/Library/Python/3.9/lib/python/site-packages/firebase_messaging/fcmpushclient.py", line 425, in _handle_data_message
    callback(ret_val, msg.persistent_id, obj)
  File "/Users/jubi/Library/Python/3.9/lib/python/site-packages/ring_doorbell/listen/eventlistener.py", line 250, in _on_notification
    re = self._get_ding_event(gcm_data)
  File "/Users/jubi/Library/Python/3.9/lib/python/site-packages/ring_doorbell/listen/eventlistener.py", line 207, in _get_ding_event
    datetime.strptime(created_at, "%Y-%m-%dT%H:%M:%S.%f%z")
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/_strptime.py", line 568, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/_strptime.py", line 349, in _strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data '2024-05-14T19:29:28Z' does not match format '%Y-%m-%dT%H:%M:%S.%f%z'
@jubishop
Copy link
Author

so at least on my machine, line 207 of eventlistener.py needs to become:

datetime.strptime(created_at, "%Y-%m-%dT%H:%M:%SZ")

@jubishop
Copy link
Author

sorry i'm too much of a python noob to know how to run your tests to make a proper git commit here. i just know changing that line makes it work for me. my guess is, looking at the format that was failing, that for whatever reason my device is not providing milliseconds (thus no .%f at the end of the strptime format). You could check for that using a regex and then run the right one, or put this first one in a try and then run the second in a catch (or whatever the equivalent is in python). in any case, thanks for this library! once i fixed that line, it's working great for me to listen for events and then trigger a recording with a different security camera via ZoneMinder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant