Rules %sunset% and more Problems

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Obstsalat
Normal user
Posts: 20
Joined: 06 May 2023, 12:03

Rules %sunset% and more Problems

#1 Post by Obstsalat » 06 May 2023, 12:29

Hello,

actually i tried my best on the Rules but i didnt find a way to get my Rule Working.
I stuck at beginning and tried many thing with searches on Google but didnt find a way to get following working. This my last actual try to get it working.

Code: Select all

On feucht#igkeit Do
If [feucht#igkeit] > 120 And Clock#Time=All,%sunrise%-%sunset%

  GPIO,17,1
  TimerSet,1,60
  Endif
 endon
 
 On Rules#Timer=1 do
  GPIO,17,0
  
Endon
When i delete the Clocktime it works but i want the following feature:

When ESP starts it should look if the soil is enough Watered under the condition that it is Sunrise.
If it is Sunrise the controller should to this testing for about an Half hour and then stop.

The same for Sunset.

Another Explain What it should do

If Soil is not wet enough and it is sunrise
Then turn Pump on for 1 min wait 1min an test again until Sun was Rising and a half Hour is gone. Yeah i know these function are not integrated yet in my code beacause i failed on Sunrise feature and on the AND function.

Debug says:

Code: Select all

5779112 : Info   : WD   : Uptime 96 ConnectFailures 0 FreeMem 206744 WiFiStatus WL_CONNECTED 3 ESPeasy internal wifi status: Conn. IP Init
5779114 : Debug More : UDP  : Send Sysinfo message
5779119 : Debug More : UDP  : Send Sysinfo message
5780000 : Debug  : LoopStats: shortestLoop: 42 longestLoop: 2343330 avgLoopDuration: 153.75 loopCounterMax: 714285 loopCounterLast: 193076
5780002 : Debug  : Scheduler stats: (called/tasks/max_length/idle%) 193076/2132/8/88.55
5783695 : Info   : EVENT: Clock#Time=Sat,12:28
5783699 : Debug  : EVENT: Clock#Time=Sat,12:28 Processing time:4 milliSeconds
5787293 : Info   : ADC  : Analog value: 0 = 0.00 (1 samples)
5787302 : Info   : EVENT: feucht#igkeit=0.00
RuleDebug Processing:rules1.txt
     flags CMI  parse output:
5787308 : Debug dev : RuleDebug: 001: On feucht#igkeit Do
5787310 : Debug  : ReplacementString SunTime: %sunrise% offset: 0
5787311 : Debug  : ReplacementString SunTime: %sunset% offset: 0
5787315 : Debug dev : DEBUG DEV: Parsed String='If 0.00'
5787317 : Debug dev : RuleDebug: 000: If 0.00 > 120 And Clock#Time=All,5:57-20:53
5787318 : Debug  : timeStringToSeconds: "0" --> invalid
5787318 : Debug  : timeStringToSeconds: "120" --> invalid
5787321 : Debug  : conditionMatch: "0.00 > 120 and clock#time=all,5:57-20:53" --> "0.00" > "120" --> false (0 > 120)
5787322 : Debug  : conditionMatchExtended: false "0.00 > 120 and clock#time=all,5:57-20:53"
5787322 : Debug  : timeStringToSeconds: "" --> invalid
5787322 : Debug  : timeStringToSeconds: "" --> invalid
5787324 : Error  : Calculate: Unknown token input: clock#time = 0
5787324 : Debug  : conditionMatchExtended: false && false "clock#time=all,5:57-20:53"
5787324 : Debug  : Lev.1: [if false && false]=false
5787326 : Debug dev : RuleDebug: 000: GPIO,17,1
5787328 : Debug dev : RuleDebug: 000: TimerSet,1,20
5787329 : Debug dev : RuleDebug: 000: Endif
5787333 : Debug  : EVENT: feucht#igkeit=0.00 Processing time:31 milliSeconds
Greets Obstsalat

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Rules %sunset% and more Problems

#2 Post by TD-er » 06 May 2023, 13:51

Clock#Time is an event, not a system variable.

So you could check for %systime% > %sunrise% and %systime% < %sunset%
See also the documentation: https://espeasy.readthedocs.io/en/lates ... .html#time

Obstsalat
Normal user
Posts: 20
Joined: 06 May 2023, 12:03

Re: Rules %sunset% and more Problems

#3 Post by Obstsalat » 06 May 2023, 15:55

Hello,
OMG it works. Thank you so much. I tried so many combinations but that it will be so EASY.......
Is there an feature for Sunrise where i can set a Range ?
Like:
%sunrise% - %sunrise+30m%
So that the controller will work only in the time range
05.34 (sunrise) till 06:04 automaticly? Because Sunrise changes every Day or should i have to go with an Timer?

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Rules %sunset% and more Problems

#4 Post by TD-er » 06 May 2023, 16:20

See the tools->System Variables page
There are all the system variables, including some examples for adding an offset to sunset/sunrise.

See: https://espeasy.readthedocs.io/en/lates ... -variables

So the check would be something like this:

Code: Select all

if %systime% > %sunrise% and %systime% < %sunrise+30m%
  ...
endif

Obstsalat
Normal user
Posts: 20
Joined: 06 May 2023, 12:03

Re: Rules %sunset% and more Problems

#5 Post by Obstsalat » 18 May 2023, 11:46

Hello,

actual i got it running, Thank you. It is not to easy to understand all functions for a beginner but i will make progress.

Post Reply

Who is online

Users browsing this forum: No registered users and 50 guests