fixed bug in logic
This commit is contained in:
@@ -8,12 +8,17 @@ def sync():
|
||||
local = File(config.STATE_FILE)
|
||||
server_state = server.get_state()
|
||||
|
||||
|
||||
|
||||
if local.present():
|
||||
local.load()
|
||||
print "local present: " + local.data
|
||||
else:
|
||||
local.data = server_state
|
||||
print "local not present, server: " + local.data
|
||||
local.save()
|
||||
|
||||
|
||||
local_state = local.data
|
||||
|
||||
changer = Changer(local_state, server_state)
|
||||
|
||||
@@ -19,10 +19,9 @@ class Changer(object):
|
||||
|
||||
def process_change(self):
|
||||
self.validate_states()
|
||||
if self.local_state['out_valve'] != self.remote_state['out_valve']:
|
||||
change = self.states.get(self.remote_state['out_valve'], None )
|
||||
if change is not None:
|
||||
change()
|
||||
change = self.states.get(self.remote_state['out_valve'], None )
|
||||
if change is not None:
|
||||
change()
|
||||
return self.local_state
|
||||
|
||||
def open_valve():
|
||||
|
||||
Reference in New Issue
Block a user