diff --git a/app/main.py b/app/main.py index 8fd445f..ad8454e 100644 --- a/app/main.py +++ b/app/main.py @@ -1,3 +1,5 @@ +import logging +import pprint import signal from prometheus_client import start_http_server @@ -28,7 +30,10 @@ def get_bridge(accessory_driver: AccessoryDriver, settings: Settings): if __name__ == "__main__": + logging.basicConfig(level="INFO") settings = Settings() + logging.info("Running with settings:") + logging.info(pprint.pformat(settings.model_dump())) # Start prometheus metrics server. Any metrics will be registered automatically. if settings.prometheus.enabled: start_http_server(settings.prometheus.port) diff --git a/config.yaml b/config.yaml index c90b785..f1fef35 100644 --- a/config.yaml +++ b/config.yaml @@ -3,7 +3,7 @@ prometheus: port: 8000 hap: port: 51826 - persist_file: /home/pi/bme680-homekit/sensors/accessory.state + persist_file: /home/denis/bme680-homekit/sensors/accessory.state bridge: display_name: Bridge bme680: diff --git a/prometheus/prometheus.service b/prometheus/prometheus.service index 2a185a1..edaf487 100644 --- a/prometheus/prometheus.service +++ b/prometheus/prometheus.service @@ -6,12 +6,12 @@ After=network-online.target [Service] Restart=on-failure RestartSec=5s -User=pi +User=denis Restart=on-failure -ExecStart=/home/pi/bme680-homekit/prometheus/prometheus-2.36.1.linux-armv6/prometheus \ - --config.file=/home/pi/bme680-homekit/prometheus/prometheus.yml \ - --storage.tsdb.path=/home/pi/bme680-homekit/prometheus/data +ExecStart=/home/denis/bme680-homekit/prometheus/prometheus-2.36.1.linux-armv6/prometheus \ + --config.file=/home/denis/bme680-homekit/prometheus/prometheus.yml \ + --storage.tsdb.path=/home/denis/bme680-homekit/prometheus/data [Install] WantedBy=multi-user.target \ No newline at end of file diff --git a/systemd/bme680-homekit.service b/systemd/bme680-homekit.service index 8e4aeb1..a2a3b2d 100644 --- a/systemd/bme680-homekit.service +++ b/systemd/bme680-homekit.service @@ -3,10 +3,11 @@ Description=Bme680 Homekit service After=local-fs.target network-online.target [Service] -WorkingDirectory=/home/pi/bme680-homekit/ +Environment="HOMEKIT_CONFIG=/home/denis/bme680-homekit/config.yaml" +WorkingDirectory=/home/denis/bme680-homekit/ Restart=on-failure RestartSec=5s -User=pi +User=denis ExecStart=/usr/bin/python3 -m app.main [Install]