Sennevds / system_sensors

Logging of system sensor specific for the RPI and sending them to a MQTT broker
MIT License
361 stars 112 forks source link

Keeps looping setup; sensors being recreated all the time #177

Closed medivb closed 4 months ago

medivb commented 4 months ago

I installed everything according to the instructions (including the "virtual environment" steps for Bookworm) on my amd64 device, but after starting the service, it seems to be stuck in an initial look for creating the sensors in HA; I see the device and all the sensors and the values seem to be correct, but they keep being recreated in stead of being created once and then updated. Any idea what could be the issue?

System: Intel NUC running Debian 12 (Bookworm) My settings.yaml:

mqtt: hostname: {redacted} port: 1883 # defaults to 1883 user: {redacted} password: {redacted} deviceName: frigate client_id: frigate ha_status: hass # status topic for homeassistant: defaults to hass if key is omitted timezone: Europe/Amsterdam update_interval: 60 # Defaults to 60 sensors: temperature: true display: false clock_speed: false disk_use: true memory_use: false cpu_usage: true load_1m: false load_5m: falseload_15m: false net_tx: true # true for all interfaces, otherwise the name of the interface net_rx: true # true for all interfaces, otherwise the name of the interface swap_usage: true power_status: false last_boot: true hostname: true host_ip: true host_os: true host_arch: true last_message: true updates: true wifi_strength: false wifi_ssid: false external_drives:

Only add mounted drives here, e.g.:

# Drive1: /media/storage
# For ZFS Pools use the format:
# pool-name: /mount-point

If I run from console, this is what is being logged:

medi@frigate:~/system_sensors$ system_sensors_venv/bin/python3 src/system_sensors.py src/settings.yaml Unable to import rpi_bad_power library, or is incompatible on host architecture. Power supply info will not be shown. Unable to import apt package. Available updates will not be shown. /home/medi/system_sensors/src/system_sensors.py:268: DeprecationWarning: Callback API version 1 is deprecated, update to latest version mqttClient = mqtt.Client(mqtt.CallbackAPIVersion.VERSION1, client_id=settings['client_id']) Sending config message to host... Connected to broker subscribing : hass/status subscribing : system-sensors/sensor/frigate/availability subscribing : system-sensors/sensor/frigate/command Message received: setup Message received: setup Connected to broker subscribing : hass/status subscribing : system-sensors/sensor/frigate/availability subscribing : system-sensors/sensor/frigate/command Message received: setup Message received: setup Connected to broker subscribing : hass/status subscribing : system-sensors/sensor/frigate/availability

This continues until I kill the process.

Note: sorry for the crappy inclusion of the yaml. All indentations are lost. It is fine though, as app is initialising and sending all the sensors and their values I wanted.

Thanks for all your hard work!

medivb commented 4 months ago

I found the issue... I was using the same devicename as the internal process of my frigate server, which communicates with the same broker. Oh well, it might help others ;-)