andrewjfreyer / monitor

Distributed advertisement-based BTLE presence detection reported via mqtt
1.62k stars 193 forks source link

Can I stop the very frequent MQTT connects/disconnects without impacting performance? #387

Open Eeeeeediot opened 3 years ago

Eeeeeediot commented 3 years ago

How would I do this please? Also, why is the MQTT client_id different every time it connects.

Screenshot_20210323-201308_Home Assistant

nateww commented 3 years ago

Why do you care? This is the way the mosquitto_pub works. The only way to avoid doing this is to greatly increase the complexity of the application and try to create a background MQTT client process that receives messages and publishes them, which would be more work for virtually no gain other than to make your MQTT logs a tiny bit quieter.

It has virtually zero effect on performance, and is how many/most MQTT clients behave in IoT applications in order to save on batter life.