quality of life improvements

This commit is contained in:
Denis-Cosmin Nutiu 2024-02-07 21:24:03 +02:00
parent 18ed759c6c
commit b9822b33e7
4 changed files with 13 additions and 7 deletions

View file

@ -1,3 +1,5 @@
import logging
import pprint
import signal import signal
from prometheus_client import start_http_server from prometheus_client import start_http_server
@ -28,7 +30,10 @@ def get_bridge(accessory_driver: AccessoryDriver, settings: Settings):
if __name__ == "__main__": if __name__ == "__main__":
logging.basicConfig(level="INFO")
settings = Settings() settings = Settings()
logging.info("Running with settings:")
logging.info(pprint.pformat(settings.model_dump()))
# Start prometheus metrics server. Any metrics will be registered automatically. # Start prometheus metrics server. Any metrics will be registered automatically.
if settings.prometheus.enabled: if settings.prometheus.enabled:
start_http_server(settings.prometheus.port) start_http_server(settings.prometheus.port)

View file

@ -3,7 +3,7 @@ prometheus:
port: 8000 port: 8000
hap: hap:
port: 51826 port: 51826
persist_file: /home/pi/bme680-homekit/sensors/accessory.state persist_file: /home/denis/bme680-homekit/sensors/accessory.state
bridge: bridge:
display_name: Bridge display_name: Bridge
bme680: bme680:

View file

@ -6,12 +6,12 @@ After=network-online.target
[Service] [Service]
Restart=on-failure Restart=on-failure
RestartSec=5s RestartSec=5s
User=pi User=denis
Restart=on-failure Restart=on-failure
ExecStart=/home/pi/bme680-homekit/prometheus/prometheus-2.36.1.linux-armv6/prometheus \ ExecStart=/home/denis/bme680-homekit/prometheus/prometheus-2.36.1.linux-armv6/prometheus \
--config.file=/home/pi/bme680-homekit/prometheus/prometheus.yml \ --config.file=/home/denis/bme680-homekit/prometheus/prometheus.yml \
--storage.tsdb.path=/home/pi/bme680-homekit/prometheus/data --storage.tsdb.path=/home/denis/bme680-homekit/prometheus/data
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View file

@ -3,10 +3,11 @@ Description=Bme680 Homekit service
After=local-fs.target network-online.target After=local-fs.target network-online.target
[Service] [Service]
WorkingDirectory=/home/pi/bme680-homekit/ Environment="HOMEKIT_CONFIG=/home/denis/bme680-homekit/config.yaml"
WorkingDirectory=/home/denis/bme680-homekit/
Restart=on-failure Restart=on-failure
RestartSec=5s RestartSec=5s
User=pi User=denis
ExecStart=/usr/bin/python3 -m app.main ExecStart=/usr/bin/python3 -m app.main
[Install] [Install]