button work

This commit is contained in:
John Lancaster
2024-03-06 20:17:38 -06:00
parent 0939c21554
commit 17670b983e
4 changed files with 40 additions and 15 deletions

View File

@@ -9,7 +9,7 @@ from appdaemon.entity import Entity
from appdaemon.plugins.hass.hassapi import Hass
from appdaemon.plugins.mqtt.mqttapi import Mqtt
from astral import SunDirection
from console import console, setup_logging, deinit_logging
from console import console, init_logging, deinit_logging
from rich.table import Table
@@ -152,7 +152,7 @@ class RoomController(Hass, Mqtt):
def initialize(self):
if (level := self.args.get('rich', False)):
setup_logging(self, level)
init_logging(self, level)
self.rich_logging = True
self.log(f'Initializing {self}')
@@ -211,9 +211,7 @@ class RoomController(Hass, Mqtt):
if self.rich_logging:
table = self._room_config.rich_table(self.name)
console.print(table)
# for state in self.states:
# self.log(f'State: {state.time.strftime("%I:%M:%S %p")} {state.scene}')
console.log(table, highlight=False)
self.states = sorted(self.states, key=lambda s: s.time, reverse=True)