Clean up garage
This commit is contained in:
parent
1047effcb8
commit
39eba9b6f5
|
@ -15,13 +15,13 @@ class GarageDisplay:
|
||||||
self.openFillColor = colors.WHITE
|
self.openFillColor = colors.WHITE
|
||||||
self.garageFile = 'data/garage.json'
|
self.garageFile = 'data/garage.json'
|
||||||
|
|
||||||
|
self.symbolDisplay.clearRow(self.topRow, rowHeight=4)
|
||||||
|
|
||||||
def showGarageState(self):
|
def showGarageState(self):
|
||||||
state = self.getGarageState()
|
state = self.getGarageState()
|
||||||
|
|
||||||
# TODO - only update the changed door so the other one doesn't flicker
|
|
||||||
if state != self.currentState:
|
if state != self.currentState:
|
||||||
self.currentState = state
|
self.currentState = state
|
||||||
self.symbolDisplay.clearRow(self.topRow, rowHeight=4)
|
|
||||||
|
|
||||||
if self.isGarageStateValid(state):
|
if self.isGarageStateValid(state):
|
||||||
self.showState(state)
|
self.showState(state)
|
||||||
|
@ -39,31 +39,27 @@ class GarageDisplay:
|
||||||
|
|
||||||
def showState(self, state):
|
def showState(self, state):
|
||||||
if state["west-door"] == "closed":
|
if state["west-door"] == "closed":
|
||||||
self.symbolDisplay.displaySquare(
|
self.showClosedDoor(self.westDoorStartColumn)
|
||||||
x=self.westDoorStartColumn,
|
|
||||||
y=self.topRow,
|
|
||||||
outlineColor=self.closedOutlineColor,
|
|
||||||
fillColor=self.closedFillColor
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
self.symbolDisplay.displaySquare(
|
self.showOpenDoor(self.westDoorStartColumn)
|
||||||
x=self.westDoorStartColumn,
|
|
||||||
y=self.topRow,
|
|
||||||
outlineColor=self.openOutlineColor,
|
|
||||||
fillColor=self.openFillColor
|
|
||||||
)
|
|
||||||
|
|
||||||
if state["east-door"] == "closed":
|
if state["east-door"] == "closed":
|
||||||
self.symbolDisplay.displaySquare(
|
self.showClosedDoor(self.eastDoorStartColumn)
|
||||||
x=self.eastDoorStartColumn,
|
|
||||||
y=self.topRow,
|
|
||||||
outlineColor=self.closedOutlineColor,
|
|
||||||
fillColor=self.closedFillColor
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
self.symbolDisplay.displaySquare(
|
self.showOpenDoor(self.eastDoorStartColumn)
|
||||||
x=self.eastDoorStartColumn,
|
|
||||||
y=self.topRow,
|
def showOpenDoor(self, column):
|
||||||
outlineColor=self.openOutlineColor,
|
self.symbolDisplay.displaySquare(
|
||||||
fillColor=self.openFillColor
|
x=column,
|
||||||
)
|
y=self.topRow,
|
||||||
|
outlineColor=self.closedOutlineColor,
|
||||||
|
fillColor=self.closedFillColor
|
||||||
|
)
|
||||||
|
|
||||||
|
def showClosedDoor(self, column):
|
||||||
|
self.symbolDisplay.displaySquare(
|
||||||
|
x=column,
|
||||||
|
y=self.topRow,
|
||||||
|
outlineColor=self.closedOutlineColor,
|
||||||
|
fillColor=self.closedFillColor
|
||||||
|
)
|
||||||
|
|
|
@ -12,6 +12,7 @@ class GarageUpdater:
|
||||||
self.uri = config['garage'].get('uri')
|
self.uri = config['garage'].get('uri')
|
||||||
self.garageTempFile = 'data/garage.tmp'
|
self.garageTempFile = 'data/garage.tmp'
|
||||||
self.garageFile = 'data/garage.json'
|
self.garageFile = 'data/garage.json'
|
||||||
|
|
||||||
self.persistGarageState('{"error": "init"}')
|
self.persistGarageState('{"error": "init"}')
|
||||||
|
|
||||||
def updateGarageState(self):
|
def updateGarageState(self):
|
||||||
|
|
Loading…
Reference in New Issue