Ring Doorbell

If anyone is interested, here’s some template sensors which displays the day and time, not just the time of both ring and motion.

sensor:
  - platform: template
    sensors:
      last_motion:
        value_template: >-
          {% set today = now().day | int %}
          {% set motion_date = (((as_timestamp(states.sensor.ring_front_door_last_motion.attributes.created_at)) | timestamp_custom("%d")) | int) %}
          {% if today == motion_date %}
            {% set day = "Today" %}
          {% elif (today - 1) == motion_date %}
            {% set day = "Yesterday" %}
          {% elif today == 1 and motion_date > 27 %}
            {% set day = "Yesterday" %}
          {% else %}
            {% set day = as_timestamp(states.sensor.ring_front_door_last_motion.attributes.created_at) | timestamp_custom("%A")%}
          {% endif %}
          {% set time = as_timestamp(states.sensor.ring_front_door_last_motion.attributes.created_at) | timestamp_custom("%l:%M %p")%}
          {{[day,time]|join(" at ")}}
      last_ring:
        value_template: >-
          {% set today = now().day | int %}
          {% set ring_date = (((as_timestamp(states.sensor.ring_front_door_last_ding.attributes.created_at)) | timestamp_custom("%d")) | int) %}
          {% if today == ring_date %}
            {% set day = "Today" %}
          {% elif (today - 1) == ring_date %}
            {% set day = "Yesterday" %}
          {% elif today == 1 and ring_date > 27 %}
            {% set day = "Yesterday" %}
          {% else %}
            {% set day = as_timestamp(states.sensor.ring_front_door_last_ding.attributes.created_at) | timestamp_custom("%A")%}
          {% endif %}
          {% set time = as_timestamp(states.sensor.ring_front_door_last_ding.attributes.created_at) | timestamp_custom("%l:%M %p")%}
          {{[day,time]|join(" at ")}}
3 Likes

i decided to try to add my ring to my HASS install today…but it just isn’t working. nothing in the logs, no sensors…nothing works. any ideas? i’m on 0.45.1. here are the relevant lines in my config:

sensor:
  - platform: ring

ring:
  username: 'myringemail'
  password: 'mypass'

i’ve tried both sensor and binary_sensor…neither one works.

edit: nevermind, apparently the monitored_conditions is not optional as the docs state. added that and it seems to work now.

monitored_conditions is optional in the latest version of HASS.

that explains it. i’m using an older version as i mentioned…haven’t gotten around to upgrading yet.

I’m kind of new at this, where would I insert this to make it work with my system. I tried putting it in the configuration.yaml but I get an error that last_motion and last_ring components can’t be found. How do I define these two?

@Michael_Grossman as I mentioned, it’s a template sensor so you have to put it in that area like this…

sensor:
  - platform: template
    sensors:

I edited my post for clarity.

1 Like

@Michael_Grossman this would work:

 sensor:
  - platform: ring
    monitored_conditions:
      - last_activity
      - last_ding
      - last_motion
      - volume
      - wifi_signal_category
      - wifi_signal_strength

@tchellomello I’m still seeing the image not available error. Was this supposed to be fixed with 0.60? Wondering why it’s still happening. Thanks

I dont know why none of my sensors appear. I am using an examples I copied from posts above. Specifically:

ring:
    username: [email protected]
    password:  **********
binary_sensor:
  - platform: ring
    monitored_conditions:
      - ding
      - motion

sensor:
  - platform: ring
    monitored_conditions:
      - battery
      - last_activity
      - last_ding
      - last_motion
      - volume

The only thing that shows up are the binary sensors (ding and motion) What am I missing??

Even tried putting everything in a group. Same results. Just binary sensors showing

  ringdoorbell:
    name: Ring Doorbell
    entities:
    - binary_sensor.ring_front_door_motion
    - binary_sensor.ring_front_door_ding
    - sensor.ring_front_door_last_activity

Hello @Jer78,
Sorry this is not fixed yet.
Work, college and daughter has kept me busy.
I’m finishing a potential fix and hopefully I post the PR by the end of the week.

@tchellomello No worries. I must have confused with another component that had a fix for 0.60. I appreciate all your hard work on this project and happy to wait patiently.

1 Like

HI,
Just noticed this in my HA Log. I looked back and it has only started happening int he last few days. Prior to that Ring Binary sensor was working well and trigger some automation. But that has stopped working. Was this a change on Rings API?
The IOS app works fine so I know my credentials are good

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/lib/python3.6/site-packages/urllib3/util/retry.py", line 388, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.ring.com', port=443): Max retries exceeded with url: /clients_api/doorbots/2903653/health?api_version=9&auth_token=p7ogTG3s3dV8UYYbuuPj&limit=20 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x6de072d0>: Failed to establish a new connection: [Errno -3] Try again',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 199, in async_update_ha_state
    yield from self.async_device_update()
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 306, in async_device_update
    yield from self.hass.async_add_job(self.update)
  File "/usr/lib/python3.6/asyncio/futures.py", line 332, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
    future.result()
  File "/usr/lib/python3.6/asyncio/futures.py", line 245, in result
    raise self._exception
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/binary_sensor/ring.py", line 109, in update
    self._data.check_alerts()
  File "/usr/lib/python3.6/site-packages/ring_doorbell/doorbot.py", line 41, in check_alerts
    self.update()
  File "/usr/lib/python3.6/site-packages/ring_doorbell/generic.py", line 45, in update
    self._get_health_attrs()
  File "/usr/lib/python3.6/site-packages/ring_doorbell/generic.py", line 92, in _get_health_attrs
    self._health_attrs = self._ring.query(url).get('device_health')
  File "/usr/lib/python3.6/site-packages/ring_doorbell/__init__.py", line 172, in query
    req = self.session.get((url), params=urlencode(params))
  File "/usr/lib/python3.6/site-packages/requests/sessions.py", line 521, in get
    return self.request('GET', url, **kwargs)
  File "/usr/lib/python3.6/site-packages/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3.6/site-packages/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3.6/site-packages/requests/adapters.py", line 508, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.ring.com', port=443): Max retries exceeded with url: /clients_api/doorbots/2903653/health?api_version=9&auth_token=p7ogTG3s3dV8UYYbuuPj&limit=20 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x6de072d0>: Failed to establish a new connection: [Errno -3] Try again',))
2018-01-10 22:38:57 ERROR (SyncWorker_10) [ring_doorbell] Error!! HTTPSConnectionPool(host='api.ring.com', port=443): Max retries exceeded with url: /clients_api/ring_devices?api_version=9&auth_token=p7ogTG3s3dV8UYYbuuPj&limit=20 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7555ddf0>: Failed to establish a new connection: [Errno -3] Try again',))
2018-01-10 22:38:57 ERROR (MainThread) [homeassistant.helpers.entity] Update for binary_sensor.ring_front_door_ding fails
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/urllib3/connection.py", line 141, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "/usr/lib/python3.6/site-packages/urllib3/util/connection.py", line 60, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/lib/python3.6/socket.py", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Try again

I am facing same issue. Did anything change to Ring API?

I was able to get it to show up but it wont display the values. Just says “Today At”. Verified that my door bell has the same name as yours.

@tchellomello

Has the Ring component been fixed yet? Still getting errors in the log about timeouts and too many connections. Just wondering if its just me.

Thank you for all your efforts.

@rparikian that’s odd. Can you check you ring sensors to make sure the attributes are showing the timestamps correctly?

The default sensors show the time stamps correctly.

Here is what i added. Did i get it right?

  • platform: template
    sensors:
    last_motion:
    value_template: >-
    {% set today = now().day | int %}
    {% set motion_date = (((as_timestamp(states.sensor.ring_front_door_last_motion.attributes.created_at)) | timestamp_custom("%d")) | int) %}
    {% if today == motion_date %}
    {% set day = “Today” %}
    {% elif (today - 1) == motion_date %}
    {% set day = “Yesterday” %}
    {% elif today == 1 and motion_date > 27 %}
    {% set day = “Yesterday” %}
    {% else %}
    {% set day = as_timestamp(states.sensor.ring_front_door_last_motion.attributes.created_at) | timestamp_custom("%A")%}
    {% endif %}
    {% set time = as_timestamp(states.sensor.ring_front_door_last_motion.attributes.created_at) | timestamp_custom("%l:%M %p")%}
    {{[day,time]|join(" at “)}}
    last_ring:
    value_template: >-
    {% set today = now().day | int %}
    {% set ring_date = (((as_timestamp(states.sensor.ring_front_door_last_ding.attributes.created_at)) | timestamp_custom(”%d")) | int) %}
    {% if today == ring_date %}
    {% set day = “Today” %}
    {% elif (today - 1) == ring_date %}
    {% set day = “Yesterday” %}
    {% elif today == 1 and ring_date > 27 %}
    {% set day = “Yesterday” %}
    {% else %}

@rparikian It’s hard to see when the code is not formatted properly. Can you use the </> in the toolbar please?

timestamp_custom("%l:%M %p") 

should be changed to

timestamp_custom("%I:%M %p")
1 Like

Hassio 0.63.3. My logs are still constantly spammed by this. Not sure how to set the interval longer under the sensors: and binary_sensors:.

Updating ring sensor took longer than the scheduled update interval 0:00:30
12:41 AM helpers/entity_platform.py (WARNING)
Updating ring binary_sensor took longer than the scheduled update interval 0:00:05
12:41 AM helpers/entity_platform.py (WARNING)
Updating ring binary_sensor took longer than the scheduled update interval 0:00:05
12:41 AM helpers/entity_platform.py (WARNING)

Appreciate if anyone can help.

4 Likes