Ring Doorbell

Hello guys,

I think were able to crack the motion and ding sensor on Ring. I’ve published a new test version on my personal branch and would be awesome if you guys could test it. I’ve been running on my own house for the next 2 days and it is working fine. Today I published a new version for the 3rd library party [1] to prepare a PR to HA in case it works for you too. OK, let’s get to work. To use the new sensors, basically follow the steps below:

Ring Binary Sensor -> https://raw.githubusercontent.com/tchellomello/home-assistant/ring_binary_sensor/homeassistant/components/binary_sensor/ring.py

Ring Sensor -> https://raw.githubusercontent.com/tchellomello/home-assistant/ring_binary_sensor/homeassistant/components/sensor/ring.py

Make sure the both files are correctly placed under the custom_components directory.

(home_assistant) ↪ tree custom_components/
custom_components/
├── binary_sensor
│   └── ring.py
└── sensor
    └── ring.py

The use the configuration:

#configuration.yaml
binary_sensor:
  - platform: ring
    username: !secret ring_username
    password: !secret ring_password
    monitored_conditions:
      - ding
      - motion

sensor:
  - platform: ring
    username: !secret ring_username
    password: !secret ring_password
    monitored_conditions:
      - battery
      - last_activity
      - volume

Verify the configuration with hass --script check_config and start HA as expected.

  • new binary sensors

Please let me know any errors or good results. Thank you for your time.

mmello


[1] - https://pypi.python.org/pypi/ring-doorbell
https://github.com/tchellomello/python-ring-doorbell/releases/tag/0.1.1

1 Like

Everything seems to be working over here; I tested for a bit but due to the high winds here I have had to disable motion for the night.

But it all checks out and at this point I feel like I can remove Ring from Wink and just use HA and the native app. So thank you!

Awesome @rpitera. How was the response time? Did you try motion and ding? Did it work fine?

I’m very glad to know that it worked for you. I’m going to wait another person to test and if that works, I’ll go ahead and submit the PR to see if we can get it included to 0.40 version.

Thanks @rpitera. I really appreciate your help.

1 Like

The binary sensor has been off since the moment HA started, the last_activity hasn’t changed either. While typing this someone walked past my house and seems to have triggered the motion sensor which did update the last_activity and also the binary_sensor for motion is on so that looks fine.

Also, just tried the doorbell again and it is properly switching to on! I may have been too soon to try after restarting HA :wink:

So: it works!

In the previous version the last activity was showing on which event (ding / motion). Wouldn’t it make sense to split the last activity in one for both events? Although one could also get the last changed time of the binary sensor.

It should take about 5-15 seconds to see the sensor active. Did you see any attributes being changed on the motion binary_sensor? Did the last_activity work fine?

Seems to be working now! It just takes a bit longer than I expected.
Motion works, ding works as well! Awesome, looks like its time to write some automations based on the events :smiley:

1 Like

Nice!! PR submitted today and let’s see if we can make it to 0.40.

1 Like

@syphernl I liked your idea of splitting the last_activity sensor to cover dings and motion as well.

Maybe instead replacing the last_activity we can create 2 new ones like last_activity_motion and last_activity_ding sensors.

Inspired on your requested, I’ve submitted a PR already to the 3rd party library and the next step will be to add them on HA which probably will be present on 0.41.

Thanks!

I got compile errors on each sensor when I tried them out. I just copied the config stuff right off your post.
Downloaded the files using the links in the post.

17-03-10 18:34:19 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform ring
Traceback (most recent call last):
File “/usr/local/lib/python3.4/dist-packages/homeassistant/helpers/entity_component.py”, line 151, in _async_setup_platform
entity_platform.add_entities, discovery_info
File “/usr/lib/python3.4/asyncio/futures.py”, line 388, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.4/asyncio/tasks.py”, line 286, in _wakeup
value = future.result()
File “/usr/lib/python3.4/asyncio/futures.py”, line 277, in result
raise self._exception
File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/home/tcarlin/.homeassistant/custom_components/sensor/ring.py”, line 85, in setup_platform
sensor_type))
File “/home/tcarlin/.homeassistant/custom_components/sensor/ring.py”, line 101, in init
self._name = “{0} {1}”.format(self._data.name,
AttributeError: ‘str’ object has no attribute ‘name’
17-03-10 18:34:20 WARNING (Thread-3) [fedexdeliverymanager] totalNumberOfShipments = 0
17-03-10 18:34:26 ERROR (MainThread) [homeassistant.components.binary_sensor] Error while setting up platform ring
Traceback (most recent call last):
File “/usr/local/lib/python3.4/dist-packages/homeassistant/helpers/entity_component.py”, line 151, in _async_setup_platform
entity_platform.add_entities, discovery_info
File “/usr/lib/python3.4/asyncio/futures.py”, line 388, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.4/asyncio/tasks.py”, line 286, in _wakeup
value = future.result()
File “/usr/lib/python3.4/asyncio/futures.py”, line 277, in result
raise self._exception
File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/home/tcarlin/.homeassistant/custom_components/binary_sensor/ring.py”, line 56, in setup_platform
persist_token=True)
TypeError: init() got an unexpected keyword argument ‘persist_token’

$ sudo pip3 install git+https://github.com/tchellomello/python-ring-doorbell@dev --upgrade
Collecting git+https://github.com/tchellomello/python-ring-doorbell@dev
Cloning https://github.com/tchellomello/python-ring-doorbell (to dev) to /tmp/pip-27mr_dbo-build
Requirement already up-to-date: requests in /usr/local/lib/python3.4/dist-packages (from ring-doorbell==0.1.1)
Requirement already up-to-date: pytz in /usr/local/lib/python3.4/dist-packages (from ring-doorbell==0.1.1)
Installing collected packages: ring-doorbell
Found existing installation: ring-doorbell 0.1.1
Uninstalling ring-doorbell-0.1.1:
Successfully uninstalled ring-doorbell-0.1.1
Running setup.py install for ring-doorbell … done
Successfully installed ring-doorbell-0.1.1

Forget my last post. I found there was an old version of ring-doorbell left over from some early testing. When I removed it, both sensors came up just fine. Sorry 'bout that.

1 Like

Yes, based on the error it seems that you were using the old version probably under deps directory.

@syphernl I’m already testing a separated sensor as you suggested. Check it out:

One that reports any activity, one only for dings and another for motions. I don’t think this change can make into 0.40, so I’ll submit the PR next week.

Thanks

1 Like

Hi All,

I setup as explained with one exception. UI have a seperate sensors.yaml file which I include in my main config. In the main config I did however add the binary sensor. I am not sure if this woudl have thrown something, HOwever, I received this error in my log:

17-03-11 21:17:19 ERROR (MainThread) [homeassistant.components.binary_sensor] Error while setting up platform ring
Traceback (most recent call last):
File “/usr/src/app/homeassistant/helpers/entity_component.py”, line 151, in _async_setup_platform
entity_platform.add_entities, discovery_info
File “uvloop/future.pyx”, line 230, in iter (uvloop/loop.c:110600)
File “uvloop/future.pyx”, line 432, in uvloop.loop.BaseTask._fast_wakeup (uvloop/loop.c:113980)
File “uvloop/future.pyx”, line 101, in uvloop.loop.BaseFuture._result_impl (uvloop/loop.c:108900)
File “/usr/local/lib/python3.5/concurrent/futures/thread.py”, line 55, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/binary_sensor/ring.py”, line 56, in setup_platform
persist_token=True)
File “/config/deps/ring_doorbell/init.py”, line 51, in init
self._authenticate()
File “/config/deps/ring_doorbell/init.py”, line 85, in _authenticate
req.raise_for_status()
File “/usr/local/lib/python3.5/site-packages/requests/models.py”, line 909, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://api.ring.com/clients_api/session

Any ideas as to where I may be going wrong?

Thanks

@uiguy Judging from the error it looks like your credentials aren’t valid. Did you provide the right credentials (email and password) and do they work if you login at ring.com?

You need to provide the credentials to both components: sensor & binary sensor.

yes, I use the same details for both the binary and normal sensor

@uiguy OK, and do they work on ring.com?

ah… hold on a minute… i’m such a dumbass…

@tchellomello binary_sensors work great here! Very nice! (Using Ring Pro and two Chimes)
Now all we need is livestream (camera) and recorded video playback support :grinning:

1 Like

Would be nice if when the video recording goes to ready state, to have some trigger in automation, and be able to display recording url in its device attribute, so i can open it via pushover.

@tchellomello Great work, is it possible to get directly the date stamp as well? With last activity, we see only the time stamp… Maybe like:

sensor.ring_frontdoor_last_activity_time
sensor.ring_frontdoor_last_activity_date