How to clear and refresh persisted sensor states in Site Controller
Abstract
It might be necessary to force a refresh of all sensor states, especially binary ones, manually. This guide will explain how to clear the local mosquitto persistence file and restart the Site Controller which will force a local re-evaluation of all states and transmission to the azeti Engine instance (MQTT broker).
Prerequisites
- Terminal access to the Site Controller instance
- root privileges (e.g. sudo permissions)
Verify if sensor states are empty or outdated
Check the sensor states in *Admin Live Table*, sensors of type boolean
will show no state and time stamp information (cells will be empty).
Clearing mosquitto persistence
Linux (Ubuntu, Rapsbian, Debian, ...)
Login to the Site Controller terminal (Linux command line), stop Site Controller and especially mosquitto
sudo "/opt/azeti/SiteController/run_SiteController.py" stop sudo "/opt/azeti/SiteController/run_SiteController.py" stop_mosquitto
Execute the below command. It will extract the mosquitto persistence path from the configuration file and rename it with a backup extension
sudo find / -name mosquitto.db -exec mv {} {}.bak \;
Restart Site Controller
sudo "/opt/azeti/SiteController/run_SiteController.py" start
You can always restore the old states file by renaming it. You might have to adjust the paths to your environment.
sudo "/opt/azeti/SiteController/run_SiteController.py" stop_mosquitto sudo find / -name mosquitto.db.bak -exec mv {} mosquitto.db \; sudo "/opt/azeti/SiteController/run_SiteController.py" start_mosquitto
Related articles