Add stubbed HASS mode

This commit is contained in:
Erik Stambaugh 2024-03-28 19:57:25 -07:00
parent 0b19603b13
commit e39656686e

View file

@ -161,6 +161,10 @@ class Inkybot:
def button_d(self): def button_d(self):
print("Button D") print("Button D")
# same applies to the loop
def loop(self):
pass
def set_image(self, image): def set_image(self, image):
draw = ImageDraw.Draw(image) draw = ImageDraw.Draw(image)
@ -193,6 +197,7 @@ class Inkybot:
return decorator return decorator
def change_state(self, state): def change_state(self, state):
print(f"Changing state to: {state}")
if self.state: if self.state:
self.state.exit() self.state.exit()
self.state = self.states[state] self.state = self.states[state]
@ -228,6 +233,9 @@ class PictureMode(inkybot.StateClass):
self.next_img = True self.next_img = True
self.time_target = 0.0 self.time_target = 0.0
def button_b(self):
self.change_state('hass')
def button_d(self): def button_d(self):
print("changing image...") print("changing image...")
self.next_img = True self.next_img = True
@ -260,6 +268,24 @@ class PictureMode(inkybot.StateClass):
self.set_image(resizedimage) self.set_image(resizedimage)
@inkybot.State('hass')
class HassMode(inkybot.StateClass):
button_text = [
" ",
"",
" ",
" "
]
def button_b(self):
self.change_state('picture')
def enter(self):
image = Image.new("RGB", self.parent.inky.resolution, (255,0,0))
self.set_image(image)
if __name__ == "__main__": if __name__ == "__main__":
inkybot.start('picture') inkybot.start('picture')