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