From d7665c5d9fa3ce9415e3f9335c8c1ed3492ef056 Mon Sep 17 00:00:00 2001 From: Keith Grennan Date: Wed, 27 Sep 2017 11:10:45 -0700 Subject: [PATCH] add wifi connection status property --- ring_doorbell/__init__.py | 5 +++++ tests/test_ring.py | 1 + 2 files changed, 6 insertions(+) diff --git a/ring_doorbell/__init__.py b/ring_doorbell/__init__.py index 1de6f4d1..62474b9a 100644 --- a/ring_doorbell/__init__.py +++ b/ring_doorbell/__init__.py @@ -653,3 +653,8 @@ def volume(self, value): self._ring.query(url, extra_params=params, method='PUT') self.update() return True + + @property + def connection_status(self): + """Return connection status.""" + return self._attrs.get('alerts').get('connection') diff --git a/tests/test_ring.py b/tests/test_ring.py index f3edbb2c..87f3d553 100644 --- a/tests/test_ring.py +++ b/tests/test_ring.py @@ -304,6 +304,7 @@ def test_doorbell_attributes(self, get_mock, post_mock): self.assertEqual(-70.12345, dev.longitude) self.assertEqual('America/New_York', dev.timezone) self.assertEqual(1, dev.volume) + self.assertEqual('online', dev.connection_status) self.assertIsInstance(dev.history(limit=1, kind='motion'), list)