Skip to content
This repository has been archived by the owner on Jul 23, 2021. It is now read-only.

Commit

Permalink
Adds on and reachable attributes
Browse files Browse the repository at this point in the history
As per a request on the forums, this commit adds the ‘on’ and
‘reachable’ attributes for the SML and RWL sensors
  • Loading branch information
robmarkcole committed Feb 6, 2018
1 parent d4611be commit d1d6081
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions custom_components/sensor/hue.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ def parse_sml(response):
'name': name,
'state': state,
'battery': response['config']['battery'],
'on': response['config']['on'],
'reachable': response['config']['reachable'],
'last_updated': response['state']['lastupdated'].split('T')}
return data

Expand Down Expand Up @@ -113,6 +115,8 @@ def parse_rwl(response):
'name': response['name'],
'state': button,
'battery': response['config']['battery'],
'on': response['config']['on'],
'reachable': response['config']['reachable'],
'last_updated': response['state']['lastupdated'].split('T')}
return data

Expand Down Expand Up @@ -218,12 +222,20 @@ def update(self):
self._hue_id]['daylight']
self._attributes['temperature'] = self._data.data[
self._hue_id]['temperature']
self._attributes['on'] = self._data.data[
self._hue_id]['on']
self._attributes['reachable'] = self._data.data[
self._hue_id]['reachable']
elif self._model == 'RWL':
self._icon = 'mdi:remote'
self._attributes['last_updated'] = self._data.data[
self._hue_id]['last_updated']
self._attributes['battery'] = self._data.data[
self._hue_id]['battery']
self._attributes['on'] = self._data.data[
self._hue_id]['on']
self._attributes['reachable'] = self._data.data[
self._hue_id]['reachable']
elif self._model == 'ZGP':
self._icon = 'mdi:remote'
self._attributes['last_updated'] = self._data.data[
Expand Down

0 comments on commit d1d6081

Please sign in to comment.