Skip to content

Commit

Permalink
Merge pull request #78 from twrecked/mqtt-backend
Browse files Browse the repository at this point in the history
Mqtt backend
  • Loading branch information
twrecked committed Nov 28, 2021
2 parents 944bfc0 + aef9c4e commit da395a2
Show file tree
Hide file tree
Showing 9 changed files with 178 additions and 154 deletions.
1 change: 1 addition & 0 deletions changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
0.8.0a12: Use new MQTT backend
0.8.0a11: Add random user agent support.
0.8.0a10: Don't request resources for Wirefree doorbells.
0.8.0a9: Support IMAP port.
Expand Down
23 changes: 19 additions & 4 deletions pyaarlo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

_LOGGER = logging.getLogger("pyaarlo")

__version__ = "0.8.0a11"
__version__ = "0.8.0a12"


class PyArlo(object):
Expand Down Expand Up @@ -238,7 +238,10 @@ def __init__(self, **kwargs):
self._st.set(["ARLO", TOTAL_BELLS_KEY], len(self._doorbells))
self._st.set(["ARLO", TOTAL_LIGHTS_KEY], len(self._lights))

# Always ping bases first!
# Subscribe to events.
self._be.start_monitoring()

# Now ping the bases.
self._ping_bases()

# Initial config and state retrieval.
Expand Down Expand Up @@ -321,7 +324,11 @@ def _refresh_bases(self, initial):
if base.has_capability(RESOURCE_CAPABILITY):
self._be.notify(
base=base,
body={"action": "get", "resource": "cameras", "publishResponse": False},
body={
"action": "get",
"resource": "cameras",
"publishResponse": False,
},
wait_for="response",
)
self._be.notify(
Expand All @@ -335,7 +342,11 @@ def _refresh_bases(self, initial):
)
self._be.notify(
base=base,
body={"action": "get", "resource": "lights", "publishResponse": False},
body={
"action": "get",
"resource": "lights",
"publishResponse": False,
},
wait_for="response",
)
else:
Expand Down Expand Up @@ -423,6 +434,10 @@ def entity_id(self):
def name(self):
return "ARLO CONTROLLER"

@property
def devices(self):
return self._devices

@property
def device_id(self):
return "ARLO"
Expand Down
Loading

0 comments on commit da395a2

Please sign in to comment.