import logging import logging.config import re from abc import ABC from dataclasses import asdict, dataclass from typing import Optional from appdaemon.logging import AppNameFormatter from rich.console import Console from rich.highlighter import RegexHighlighter from rich.logging import RichHandler from rich.theme import Theme console = Console( width=100, theme=Theme( { 'log.time': 'none', # 'logging.level.info': 'none', 'room': 'italic bright_cyan', 'component': 'dark_violet', 'friendly_name': 'yellow', 'light': 'light_slate_blue', 'sensor': 'green', 'time': 'yellow', 'z2m': 'bright_black', 'topic': 'chartreuse2', 'true': 'green', 'false': 'red', } ), log_time_format='%Y-%m-%d %I:%M:%S %p', # highlighter=RCHighlighter(), ) class RCHighlighter(RegexHighlighter): highlights = [ r'(?P(light|switch)\.\w+)', r'(?P