Mercurial > code > home > repos > homeauto
comparison service/environment/environment.py @ 1524:13b7e4de3824
whitespace
Ignore-this: c727f388f197a6fae88595fe6d455c7d
darcs-hash:971e4474b4dbd35a722be670f5599298fb5ec83f
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Wed, 05 Feb 2020 00:29:13 -0800 |
parents | 0da337780f22 |
children | 23b972df1856 |
comparison
equal
deleted
inserted
replaced
1523:0da337780f22 | 1524:13b7e4de3824 |
---|---|
26 ) | 26 ) |
27 | 27 |
28 @STATS.update.time() | 28 @STATS.update.time() |
29 def update(masterGraph): | 29 def update(masterGraph): |
30 stmt = lambda s, p, o: masterGraph.patchObject(ROOM.environment, s, p, o) | 30 stmt = lambda s, p, o: masterGraph.patchObject(ROOM.environment, s, p, o) |
31 | 31 |
32 now = datetime.datetime.now(tzlocal()) | 32 now = datetime.datetime.now(tzlocal()) |
33 | 33 |
34 stmt(DEV.environment, ROOM.localHour, Literal(now.hour)) | 34 stmt(DEV.environment, ROOM.localHour, Literal(now.hour)) |
35 stmt(DEV.environment, ROOM.localTimeToMinute, | 35 stmt(DEV.environment, ROOM.localTimeToMinute, |
36 Literal(now.strftime("%H:%M"))) | 36 Literal(now.strftime("%H:%M"))) |
51 stmt(DEV.calendar, ROOM.daysToLastFridayOfMonth, Literal(offset)) | 51 stmt(DEV.calendar, ROOM.daysToLastFridayOfMonth, Literal(offset)) |
52 | 52 |
53 stmt(DEV.calendar, ROOM.twilight, | 53 stmt(DEV.calendar, ROOM.twilight, |
54 ROOM['withinTwilight'] if isWithinTwilight(now) else ROOM['daytime']) | 54 ROOM['withinTwilight'] if isWithinTwilight(now) else ROOM['daytime']) |
55 | 55 |
56 | 56 |
57 def main(): | 57 def main(): |
58 arg = docopt(""" | 58 arg = docopt(""" |
59 Usage: environment.py [options] | 59 Usage: environment.py [options] |
60 | 60 |
61 -v Verbose | 61 -v Verbose |
87 reactor.listenTCP(9075, Application()) | 87 reactor.listenTCP(9075, Application()) |
88 reactor.run() | 88 reactor.run() |
89 | 89 |
90 if __name__ == '__main__': | 90 if __name__ == '__main__': |
91 main() | 91 main() |
92 |