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:
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.
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
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
@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.
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’
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.
@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.
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
@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.
@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
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.