Seperate setting itself into a local file
This commit is contained in:
parent
697d470d29
commit
02a882ebde
1
esp32/.gitignore
vendored
1
esp32/.gitignore
vendored
@ -7,3 +7,4 @@
|
|||||||
doc/
|
doc/
|
||||||
custom_platformio.ini
|
custom_platformio.ini
|
||||||
cppcheck-build-dir
|
cppcheck-build-dir
|
||||||
|
host/settings.json
|
||||||
|
49
esp32/host/settings.json.example
Normal file
49
esp32/host/settings.json.example
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
{
|
||||||
|
"settings": {
|
||||||
|
"sleep":600,
|
||||||
|
"nightsleep": 1200,
|
||||||
|
"pumpsleep": 5,
|
||||||
|
"tankmax": 1000,
|
||||||
|
"tankmin": 100,
|
||||||
|
"tankwarn": 200,
|
||||||
|
"tankVolume": 100,
|
||||||
|
"lipoDSAddr": "abcdefghijklmnop",
|
||||||
|
"tankDSAddr": "abcdefghijklmnop",
|
||||||
|
"ntpServer":"pool.ntp.org",
|
||||||
|
"dry0":5000,
|
||||||
|
"hourstart0":6,
|
||||||
|
"hourend0":20,
|
||||||
|
"lowLight0": false,
|
||||||
|
"delay0": 10,
|
||||||
|
"dry1":5000,
|
||||||
|
"hourstart1":6,
|
||||||
|
"hourend1":20,
|
||||||
|
"lowLight1": false,
|
||||||
|
"delay1": 10,
|
||||||
|
"dry2":5000,
|
||||||
|
"hourstart2":6,
|
||||||
|
"hourend2":20,
|
||||||
|
"lowLight2": false,
|
||||||
|
"delay2": 10,
|
||||||
|
"dry3":5000,
|
||||||
|
"hourstart3":6,
|
||||||
|
"hourend3":20,
|
||||||
|
"lowLight3": false,
|
||||||
|
"delay3": 10,
|
||||||
|
"dry4":5000,
|
||||||
|
"hourstart4":6,
|
||||||
|
"hourend4":20,
|
||||||
|
"lowLight4": false,
|
||||||
|
"delay4": 10,
|
||||||
|
"dry5":5000,
|
||||||
|
"hourstart5":6,
|
||||||
|
"hourend5":20,
|
||||||
|
"lowLight5": false,
|
||||||
|
"delay5": 10,
|
||||||
|
"dry6":5000,
|
||||||
|
"hourstart6":6,
|
||||||
|
"hourend6":20,
|
||||||
|
"lowLight6": false,
|
||||||
|
"delay6": 10
|
||||||
|
}
|
||||||
|
}
|
@ -12,60 +12,19 @@ mqttHost=$1
|
|||||||
mqttPrefix=$2
|
mqttPrefix=$2
|
||||||
homieId=$3
|
homieId=$3
|
||||||
|
|
||||||
|
settingsFile=settings.json
|
||||||
|
if [ ! -f $settingsFile ]; then
|
||||||
|
echo "$settingsFile missing"
|
||||||
|
echo "check $settingsFile.example"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
mosquitto_pub -h $mqttHost -t "${mqttPrefix}${homieId}/stay/alive/set" -m "1" -r
|
mosquitto_pub -h $mqttHost -t "${mqttPrefix}${homieId}/stay/alive/set" -m "1" -r
|
||||||
echo "Waiting ..."
|
echo "Waiting ..."
|
||||||
mosquitto_sub -h $mqttHost -t "${mqttPrefix}${homieId}/#" -R -C 1
|
mosquitto_sub -h $mqttHost -t "${mqttPrefix}${homieId}/#" -R -C 1
|
||||||
set -e
|
set -e
|
||||||
sleep 30
|
sleep 30
|
||||||
mosquitto_pub -h $mqttHost -t "${mqttPrefix}${homieId}/\$implementation/config/set" -m "{
|
mosquitto_pub -h $mqttHost -t "${mqttPrefix}${homieId}/\$implementation/config/set" -f $settingsFile
|
||||||
\"settings\": {
|
|
||||||
\"sleep\":600,
|
|
||||||
\"nightsleep\": 1200,
|
|
||||||
\"pumpsleep\": 5,
|
|
||||||
\"tankmax\": 1000,
|
|
||||||
\"tankmin\": 100,
|
|
||||||
\"tankwarn\": 200,
|
|
||||||
\"tankVolume\": 100,
|
|
||||||
\"lipoDSAddr\": \"abcdefghijklmnop\",
|
|
||||||
\"tankDSAddr\": \"abcdefghijklmnop\",
|
|
||||||
\"ntpServer\":\"pool.ntp.org\",
|
|
||||||
\"dry0\":5000,
|
|
||||||
\"hourstart0\":6,
|
|
||||||
\"hourend0\":20,
|
|
||||||
\"lowLight0\": false,
|
|
||||||
\"delay0\": 10,
|
|
||||||
\"dry1\":5000,
|
|
||||||
\"hourstart1\":6,
|
|
||||||
\"hourend1\":20,
|
|
||||||
\"lowLight1\": false,
|
|
||||||
\"delay1\": 10,
|
|
||||||
\"dry2\":5000,
|
|
||||||
\"hourstart2\":6,
|
|
||||||
\"hourend2\":20,
|
|
||||||
\"lowLight2\": false,
|
|
||||||
\"delay2\": 10,
|
|
||||||
\"dry3\":5000,
|
|
||||||
\"hourstart3\":6,
|
|
||||||
\"hourend3\":20,
|
|
||||||
\"lowLight3\": false,
|
|
||||||
\"delay3\": 10,
|
|
||||||
\"dry4\":5000,
|
|
||||||
\"hourstart4\":6,
|
|
||||||
\"hourend4\":20,
|
|
||||||
\"lowLight4\": false,
|
|
||||||
\"delay4\": 10,
|
|
||||||
\"dry5\":5000,
|
|
||||||
\"hourstart5\":6,
|
|
||||||
\"hourend5\":20,
|
|
||||||
\"lowLight5\": false,
|
|
||||||
\"delay5\": 10,
|
|
||||||
\"dry6\":5000,
|
|
||||||
\"hourstart6\":6,
|
|
||||||
\"hourend6\":20,
|
|
||||||
\"lowLight6\": false,
|
|
||||||
\"delay6\": 10
|
|
||||||
}
|
|
||||||
}"
|
|
||||||
echo "Waiting for reboot"
|
echo "Waiting for reboot"
|
||||||
sleep 1
|
sleep 1
|
||||||
mosquitto_sub -h $mqttHost -t "${mqttPrefix}${homieId}/#" -R -C 1
|
mosquitto_sub -h $mqttHost -t "${mqttPrefix}${homieId}/#" -R -C 1
|
||||||
|
Loading…
Reference in New Issue
Block a user