File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env python
2- import urllib2 , subprocess , requests
2+ import urllib2 , subprocess , requests , time
3+ timestamp = time .strftime ("Time: %H:%M, Date: %Y%m%d, " )
4+ print timestamp
35for device in requests .get ('http://localhost/api/devices' ).json ():
46 if device ['offUrl' ].find ('heyu' ) != - 1 :
57 url = "http://localhost/api/c/lights/%s/bridgeupdatestate" % device ['id' ]
6- heyu = device ['offUrl' ].replace ("foff" , "dimlevel" ).replace ("off" ,"dimlevel" )
7- if heyu .find ('dimlevel' ) != - 1 :
8- proc = subprocess .Popen ([heyu ], stdout = subprocess .PIPE , shell = True )
8+ chtxt = device ['offUrl' ].replace ("foff" , "dimlevel" ).replace ("off" ,"dimlevel" )
9+ if chtxt .find ('dimlevel' ) != - 1 :
10+ proc = subprocess .Popen ([chtxt ], stdout = subprocess .PIPE , shell = True )
911 (dimlevel , err ) = proc .communicate ()
1012 dimlevel = int (dimlevel )
1113 if dimlevel > 0 :
You can’t perform that action at this time.
0 commit comments