tchellomello / python-ring-doorbell

Python Ring Door Bell is a library written in Python 3 that exposes the Ring.com devices as Python objects.
GNU Lesser General Public License v3.0
538 stars 171 forks source link

listen -- ValueError #346

Open justin2004 opened 5 months ago

justin2004 commented 5 months ago

I got the same result running the version in pip and from the main branch of this repo.

$ python3 ring_doorbell/cli.py --version
cli.py, version 0.8.7
$ python3 ring_doorbell/cli.py list
---------------------------------
Ring CLI
Front Door (doorbell_v4)

$ python3 ring_doorbell/cli.py listen
---------------------------------
Ring CLI
INFO:firebase_messaging.fcmpushclient:Registered with FCM
New push credentials created:
INFO:firebase_messaging.fcmpushclient:Succesfully logged in to MCS endpoint
Listening, press enter to cancel

# << i walked to the front door to active the device >>

 ERROR:firebase_messaging.fcmpushclient:Unexpected exception calling notification callback
Traceback (most recent call last):
  File "/home/justin/.local/lib/python3.10/site-packages/firebase_messaging/fcmpushclient.py", line 428, in _handle_data_message
    callback(ret_val, msg.persistent_id, obj)
  File "/home/justin/.local/lib/python3.10/site-packages/ring_doorbell/listen/eventlistener.py", line 181, in on_notification
    datetime.strptime(created_at, "%Y-%m-%dT%H:%M:%S.%f%z")
  File "/usr/lib/python3.10/_strptime.py", line 568, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
  File "/usr/lib/python3.10/_strptime.py", line 349, in _strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data '2024-02-10T14:24:53Z' does not match format '%Y-%m-%dT%H:%M:%S.%f%z'
sdb9696 commented 5 months ago

I’ll look into this. Where are you based and do you know what firmware version you are running?

justin2004 commented 5 months ago

thanks @sdb9696 . I've got a Ring Video Doorbell 2. Radio-related software "14.0.25"

I am in Missouri.

AndrewMohawk commented 2 months ago

I'm seeing the same in NYC running 0.7.7 of the lib, it looks like the issue lies in the timestamp coming back from firebase

AndrewMohawk commented 2 months ago

I've made a small patch that works-for-me(tm) on 0.7.7 and applied it to the latest (I couldnt find how to do it to the older releases), but you should be able to copy/paste the changes as the code is the same!

https://github.com/tchellomello/python-ring-doorbell/pull/378

@justin2004 / @sdb9696