Mercurial > code > home > repos > homeauto
comparison service/frontDoorLock/front_door_lock.py @ 575:1209229cd56e
faster keepalive from esp chip. report aliveness into the graph. more programming tasks in tasks.py
Ignore-this: f8fca86291d3082cb309524fbd5baf1c
author | drewp@bigasterisk.com |
---|---|
date | Mon, 06 May 2019 21:06:08 -0700 |
parents | 2d8a5532f1b5 |
children | 150aa09c9723 |
comparison
equal
deleted
inserted
replaced
574:ae023f60f761 | 575:1209229cd56e |
---|---|
169 log.info('mqtt->graph %r', payload) | 169 log.info('mqtt->graph %r', payload) |
170 masterGraph.patchObject(ctx, ROOM['frontDoorLock'], ROOM['state'], | 170 masterGraph.patchObject(ctx, ROOM['frontDoorLock'], ROOM['state'], |
171 stateFromMqtt(payload)) | 171 stateFromMqtt(payload)) |
172 | 172 |
173 mqtt.subscribe(espName + b"/switch/strike/state").subscribe(on_next=toGraph) | 173 mqtt.subscribe(espName + b"/switch/strike/state").subscribe(on_next=toGraph) |
174 | |
175 def setEspState(payload): | |
176 log.info('esp state change %r', payload) | |
177 masterGraph.patchObject(ctx, ROOM['frontDoorLock'], ROOM['espMqttConnection'], | |
178 ROOM['mqtt' + payload.decode('ascii').capitalize()]) | |
179 | |
180 mqtt.subscribe(espName + b"/status").subscribe(on_next=setEspState) | |
181 | |
174 port = 10011 | 182 port = 10011 |
175 reactor.listenTCP(port, cyclone.web.Application( | 183 reactor.listenTCP(port, cyclone.web.Application( |
176 [ | 184 [ |
177 (r"/()", cyclone.web.StaticFileHandler, | 185 (r"/()", cyclone.web.StaticFileHandler, |
178 {"path": ".", "default_filename": "index.html"}), | 186 {"path": ".", "default_filename": "index.html"}), |