Add mqtt_uns_structure configuration and uninstall functionality (#196)
- Prompt user for mqtt_uns_structure during installation and update src/config.py accordingly. - Implement uninstall function in remote_install.sh to remove the rpi-mqtt-monitor directory, cron job, and systemd service. - Update rpi-cpu2mqtt.py to utilize mqtt_uns_structure for state topics, ensuring proper MQTT topic structure. - Modify config.py.example to include mqtt_uns_structure with a default empty value. Co-authored-by: Sam Blackman <sam@samuelblackman.com>
This commit is contained in:
@@ -107,6 +107,13 @@ mqtt_configuration(){
|
||||
TOPIC=rpi-MQTT-monitor
|
||||
fi
|
||||
sed -i "s/rpi-MQTT-monitor/${TOPIC}/" src/config.py
|
||||
|
||||
printf "Enter mqtt_uns_structure (default is empty): "
|
||||
read UNS
|
||||
if [[ -n "$UNS" && ! "$UNS" =~ /$ ]]; then
|
||||
UNS="${UNS}/"
|
||||
fi
|
||||
sed -i "s/mqtt_uns_structure = .*/mqtt_uns_structure = '${UNS}'/" src/config.py
|
||||
|
||||
printf "Do you need to control your monitors? (default is No): "
|
||||
read CONTROL
|
||||
|
||||
Reference in New Issue
Block a user