Skip to content

Commit

Permalink
Send real-time GPIO digital state changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jburhenn committed Aug 21, 2018
1 parent 57bf133 commit 65710c2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions myDevices/sensors/sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,12 @@ def DigitalMonitor(self):
data = []
with self.digitalMutex:
if self.currentDigitalData:
output_data = {key:self.currentDigitalData[key]['value'] for key in self.currentDigitalData}
info('self.currentDigitalData: {}'.format(output_data))
for name, item in self.currentDigitalData.items():
cayennemqtt.DataChannel.add_unique(data, cayennemqtt.DEV_SENSOR, name, value=item['value'], name=item['device']['description'], type='digital_sensor', unit='d')
try:
cayennemqtt.DataChannel.add_unique(data, cayennemqtt.SYS_GPIO, item['device']['args']['channel'], cayennemqtt.VALUE, item['value'])
except:
pass
if name in self.queuedDigitalData and self.queuedDigitalData[name]['value'] == item['value']:
del self.queuedDigitalData[name]
self.currentDigitalData = self.queuedDigitalData
Expand Down

0 comments on commit 65710c2

Please sign in to comment.