diff --git a/nspanel-lovelace-ui/rootfs/usr/bin/mqtt-manager/ha_cards.py b/nspanel-lovelace-ui/rootfs/usr/bin/mqtt-manager/ha_cards.py index 4b60a57d..c37b1664 100644 --- a/nspanel-lovelace-ui/rootfs/usr/bin/mqtt-manager/ha_cards.py +++ b/nspanel-lovelace-ui/rootfs/usr/bin/mqtt-manager/ha_cards.py @@ -143,7 +143,6 @@ class HAEntity(panel_cards.Entity): if device_class != "temperature": value = value + " " value = value + unit_of_measurement - print(f"fuck {cardType} {value} {self.icon_overwrite}") if cardType in ["cardGrid", "cardGrid2"] and not self.icon_overwrite: icon_char = value diff --git a/nspanel-lovelace-ui/rootfs/usr/bin/mqtt-manager/main.py b/nspanel-lovelace-ui/rootfs/usr/bin/mqtt-manager/main.py index 27bbf672..97d7f9a3 100644 --- a/nspanel-lovelace-ui/rootfs/usr/bin/mqtt-manager/main.py +++ b/nspanel-lovelace-ui/rootfs/usr/bin/mqtt-manager/main.py @@ -141,11 +141,36 @@ def setup_panels(): libs.panel_cmd.page_type( settings_panel["panelSendTopic"], "pageStartup") -if __name__ == '__main__': - CONFIG_FILE = os.getenv('CONFIG_FILE') - if not CONFIG_FILE: - CONFIG_FILE = 'config.yml' - get_config(CONFIG_FILE) +#if __name__ == '__main__': +# CONFIG_FILE = os.getenv('CONFIG_FILE') +# if not CONFIG_FILE: +# CONFIG_FILE = 'config.yml' +# get_config(CONFIG_FILE) + #connect() + #loop() +import time +from watchdog.observers import Observer +from watchdog.events import FileSystemEventHandler + +class MyHandler(FileSystemEventHandler): + def on_modified(self, event): + print(f'event type: {event.event_type} path : {event.src_path}') + def on_created(self, event): + print(f'event type: {event.event_type} path : {event.src_path}') + def on_deleted(self, event): + print(f'event type: {event.event_type} path : {event.src_path}') + +if __name__ == "__main__": + event_handler = MyHandler() + observer = Observer() + observer.schedule(event_handler, path='config.yml', recursive=False) + observer.start() + + try: + while True: + time.sleep(1) + except KeyboardInterrupt: + observer.stop() + observer.join() + - connect() - loop()