From cb31cc73b3a9ab4b9c549f0e96e0fd3faef6196b Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Mon, 22 Sep 2025 15:18:10 +0300 Subject: [PATCH] update rules --- .vscode/settings.json | 10 ++++++++++ src/ESPEasy/cmds.md | 3 ++- src/ESPEasy/rules1.txt | 14 ++++++++++---- 3 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..47eb71a --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,10 @@ +{ + "vsmqtt.brokerProfiles": [ + { + "name": "home", + "host": "192.168.0.10", + "port": 1883, + "clientId": "vsmqtt_client_20f8" + } + ] +} \ No newline at end of file diff --git a/src/ESPEasy/cmds.md b/src/ESPEasy/cmds.md index a0fa324..08ddafe 100644 --- a/src/ESPEasy/cmds.md +++ b/src/ESPEasy/cmds.md @@ -1,2 +1,3 @@ control?cmd=event,StartWatering -# http://192.168.5.22/control?cmd=event,StartWatering \ No newline at end of file +# http://192.168.5.22/control?cmd=event,StartWatering +http://192.168.5.22/control?cmd=event,manualwatering,30 \ No newline at end of file diff --git a/src/ESPEasy/rules1.txt b/src/ESPEasy/rules1.txt index e9841ed..f668366 100644 --- a/src/ESPEasy/rules1.txt +++ b/src/ESPEasy/rules1.txt @@ -1,11 +1,16 @@ On manualwatering do - gpio,16,1 //start watering (open valve) - timerSet,8,%eventvalue% //timer 1 set for 5 sec - Publish %sysname%/Water/start,{"soil":"[Soil#RH]","temp":"[bmp#Temperature]", "eventvalue": "%eventvalue%"} + if %eventvalue% = 0 + let,1,10 // default seconds + else + let,1,%eventvalue% + endif + gpio,16,1 + timerset,8,[var#1] + Publish %sysname%/Water/start,'{"soil":"[Soil#RH]","temp":"[bmp#Temperature]","eventvalue":"[var#1]","ha":"ha"}' endon On startwatering do gpio,16,1 //start watering (open valve) - timerSet,8,10 //timer 1 set for 5 sec + timerSet,8,10 //timer 1 set for 5 s Publish %sysname%/Water/start,{"soil":"[Soil#RH]"} endon On stopwatering do @@ -15,6 +20,7 @@ On stopwatering do endon On Rules#Timer=8 do gpio,16,0 //stop watering (close valve) + Publish %sysname%/Water/stop,{"soil":"[Soil#RH]"} endOn