Hi i have a project in the forest and the internet connection is very bad there. so i work out a new rule and only whant to know if this can work or not.
on System#Wake do
If %vcc% < 2.2
deepSleep,3600
else
on WiFi#Connected do
SendToHTTP,url.com,80,/up.php?s=%unit%&b=%ip%&ti=[t#t]&ta=[t2#t]&lu=[l#l]&h=[t2#h]&p=[t2#p]&g=[g#g]&u=[s#u]&r=[s#r]&v=%vcc%&lo=[s#l]
endon
endif
endon
The idee is if the Battery level is under 2.2 thath the esp go again sleep and dont send anything over internet. The battery is conected to a solar cell so the esp can wait until the cell is loaded.
Maybe is it possible to activate and deactivate WIFI in a rule?
It is important to save so much enery as possible.
Thank you very much
Rules If & ON
Moderators: grovkillen, Stuntteam, TD-er
Re: Rules If & ON
2.2 Volt is too low, the ESP will not even boot, so this rule will never trigger.
Also it probably has already started to connect to WiFi, so if the battery is too low, it probably enters boot loop.
Also it probably has already started to connect to WiFi, so if the battery is too low, it probably enters boot loop.
-
- Normal user
- Posts: 15
- Joined: 21 Feb 2020, 17:33
Re: Rules If & ON
ok thank you very much for the voltage i can set 3.0 to but the code is right? and i can place the same rule on boot to.
Code: Select all
on System#Boot do
If %vcc% < 3.0
deepSleep,3600
else
on WiFi#Connected do
SendToHTTP,url.com,80,/up.php?s=%unit%&b=%ip%&ti=[t#t]&ta=[t2#t]&lu=[l#l]&h=[t2#h]&p=[t2#p]&g=[g#g]&u=[s#u]&r=[s#r]&v=%vcc%&lo=[s#l]
deepSleep,3600
endon
endif
endon
on System#Wake do
If %vcc% < 3.0
deepSleep,3600
else
on WiFi#Connected do
SendToHTTP,url.com,80,/up.php?s=%unit%&b=%ip%&ti=[t#t]&ta=[t2#t]&lu=[l#l]&h=[t2#h]&p=[t2#p]&g=[g#g]&u=[s#u]&r=[s#r]&v=%vcc%&lo=[s#l]
deepSleep,3600
endon
endif
endon
Re: Rules If & ON
The "on <trigger> do" parts cannot be nested.
Those are the entry-points in the rules, as rules act on events (the trigger).
But you can refer to the event value if needed.
If you need to store a state for next rules calls, you can store them in variables.
See: https://espeasy.readthedocs.io/en/lates ... skvalueset
Those are the entry-points in the rules, as rules act on events (the trigger).
But you can refer to the event value if needed.
If you need to store a state for next rules calls, you can store them in variables.
See: https://espeasy.readthedocs.io/en/lates ... skvalueset
Re: Rules If & ON
A tip from me: Maybe %vcc% has no valid value directly after booting. The AD-conversion takes a few seconds in my tests.
Re: Rules If & ON
I don't think that nested ON will work as it is the reaction on an event.
Nevertheless, you should not connect the esp to a battery like this if it is a liion battery, which I suppose. If the voltag gets below 3.2 Volt it will drain the battery very fast because the voltage regulator will take too much current.
Better solution is to add a TP4056 circuit between solar panel, battery and esp to prevnt deep discharge. So then you are shure that the battery will not be discharged under 2.5V. And you will not need the nested ON.
Nevertheless, you should not connect the esp to a battery like this if it is a liion battery, which I suppose. If the voltag gets below 3.2 Volt it will drain the battery very fast because the voltage regulator will take too much current.
Better solution is to add a TP4056 circuit between solar panel, battery and esp to prevnt deep discharge. So then you are shure that the battery will not be discharged under 2.5V. And you will not need the nested ON.
Code: Select all
pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $
Who is online
Users browsing this forum: No registered users and 100 guests