a-bali/janitor

Devices not shown for topic with v1.1

Closed this issue · 4 comments

Thank you for this! I was looking for an easy way to monitor my MQTT sensors and alert me.

However, I am currently not able to get this to work, even though I don't run a special setup..

I am running this as docker. Log seems to be ok, it's connecting to my MQTT server alright - however, there are no sensors being detected. Checking this now for some time and didn't know why it won't work - maybe someone can help?

Janitor config

{
	"Debug": true,
	"LogSize": 1000,
	"Web": {
		"Host": "",
		"Port": 8080
	},
	"Alert": {
		"Telegram": {
			"Token": "",
			"Chat": 0
		},
		"Gotify": {
			"Token": "",
			"Server": ""
		},
		"Exec": "",
		"MQTT": {
			"Server": "mqtt://hostip",
			"Port": 1883,
			"User": "sensor",
			"Password": "sensorpass",
			"Topic": "/janitor/alerts"
		}
	},
	"Monitor": {
		"MQTT": {
			"Server": "mqtt://hostip",
			"Port": 1883,
			"User": "sensor",
			"Password": "sensorpass",
			"History": 10,
			"StandardTimeout": 1.5,
			"Targets": [
				{
					"Topic": "/zigbee2mqtt/#",
					"Name": "",
					"Timeout": 0
				}
			]
		},
		"Ping": {
			"Interval": 60,
			"Threshold": 2,
			"Targets": null
		},
		"HTTP": {
			"Interval": 60,
			"Timeout": 5000,
			"Threshold": 2,
			"Targets": null
		},
		"Exec": {
			"Interval": 60,
			"Timeout": 5000,
			"Threshold": 2,
			"Targets": null
		}
	}
}

docker compose file

  janitor:
    restart: always
    depends_on:
      - zigbee2mqtt
      - mosquitto
    volumes:
        - "/etc/localtime:/etc/localtime:ro"
        - "[...redacted]/janitor/config.yml:/janitor/config.yml"
    ports:
      - "7200:8080"
    container_name: janitor
    networks:
       - [...redacted]
    image: abali/janitor:v1.1

Logfile

2023-10-15T20:51:10.016978953Z [2023-10-15 22:51:10] Starting Janitor v1.1 (build date 2023-09-04T14:49:49+0000, 199fceb)
2023-10-15T20:51:10.017028395Z [2023-10-15 22:51:10] (Loaded config: [...redacted...]
2023-10-15T20:51:10.018699157Z [2023-10-15 22:51:10] Connected to MQTT server for monitoring at mqtt://localip:1883
2023-10-15T20:51:10.019611551Z [2023-10-15 22:51:10] Connected to MQTT server for alerting at mqtt://localip:1883
2023-10-15T20:51:10.019627822Z [2023-10-15 22:51:10] (Entering monitoring loop)
2023-10-15T20:51:10.019632393Z [2023-10-15 22:51:10] Launching web server at :8080
2023-10-15T20:51:10.019636255Z [2023-10-15 22:51:10] Subscribed to MQTT topics: /zigbee2mqtt/#

mqtt-explorer shows sensors with the relevant topic (zigbee2mqtt)
image

a-bali commented

You should be seeing messages in the debug log if there is traffic on the subscribed topics. Can you try subscribing to '#' (all topics) and see if anything shows up?

Thank you for this. I actually didn't set the "" around the value for topic in my config.yml (you don't need to, since it's yaml (syntax)). However, janitor is interpreting this differently. Since when I entered # it came as "" in the config I can check in the webinterface. Once I entered "#" it worked and all sensors populated.

I now wrapped my topics with "" and I can see them just fine.

Thanks for pointing this out!

a-bali commented

# is reserved for comments in yaml, so for sure you need to wrap it in quotes.

That is correct, however, it’s still parsing and not throwing an error. Someone handling yaml every day would have noticed… ;-)