How to find out what triggered a wake up
Moderators: grovkillen, Stuntteam, TD-er
-
- Normal user
- Posts: 66
- Joined: 16 Feb 2017, 09:23
How to find out what triggered a wake up
I have enabled deep sleep.
The device auto wakes every 10 minutes for 30 seconds.
But I also have attached a rain gauge which wakes the device.
How can I see what has waked the device? The timer or the gauge?
The device auto wakes every 10 minutes for 30 seconds.
But I also have attached a rain gauge which wakes the device.
How can I see what has waked the device? The timer or the gauge?
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: How to find out what triggered a wake up
Not currently, you could open a new request on GitHub though.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
Re: How to find out what triggered a wake up
Not sure if I can "see" what caused the wake-up, since both are seen as "boot after going to sleep".
What may be a clue is keeping track of the time when going to sleep and waking up.
If that's less than the set sleep time, then it is likely something other than the sleep timer.
You may want to store just the nr. of seconds of "today" and not the unix timestamp.
The Unix timestamp uses more bits than a float can store, so you cannot store it in a dummy variable.
Nr. of seconds in a day is max. 86400, which does fit in 17 bits.
What may be a clue is keeping track of the time when going to sleep and waking up.
If that's less than the set sleep time, then it is likely something other than the sleep timer.
You may want to store just the nr. of seconds of "today" and not the unix timestamp.
The Unix timestamp uses more bits than a float can store, so you cannot store it in a dummy variable.
Nr. of seconds in a day is max. 86400, which does fit in 17 bits.
-
- Normal user
- Posts: 66
- Joined: 16 Feb 2017, 09:23
Re: How to find out what triggered a wake up
Sounds like a plan!
How do I do that?
In rules?
How do I do that?
In rules?
Re: How to find out what triggered a wake up
Maybe it is the easiest to trigger a rule on the timeset event and then compare it.
This will make this information available almost immediately after time is known from NTP.
Just take into account that the sleep timer starts as soon as you go to sleep, so the computed sleep time may be a few seconds lower than your set sleep time.
If you let the node go to sleep from within the rules you may store the time right before going to sleep.
As long as you keep in mind that there can always be a false positive in this method.
Also starting from a cold boot (power lost) will set the dummy plugin values to 0.
This will make this information available almost immediately after time is known from NTP.
Just take into account that the sleep timer starts as soon as you go to sleep, so the computed sleep time may be a few seconds lower than your set sleep time.
If you let the node go to sleep from within the rules you may store the time right before going to sleep.
As long as you keep in mind that there can always be a false positive in this method.
Also starting from a cold boot (power lost) will set the dummy plugin values to 0.
-
- Normal user
- Posts: 66
- Joined: 16 Feb 2017, 09:23
Re: How to find out what triggered a wake up
Thanks,
will try something like this:
will try something like this:
Code: Select all
on System#Sleep do
Let,1,%unixday_sec%
endon
on Time#Initialized do
if %unixday_sec% - %v1% < 600
WAKE FROM EVENT
else
WAKE FROM timer
endif
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: How to find out what triggered a wake up
You cannot do if and formula at the same time/line.
Code: Select all
on System#Sleep do
Let,1,%unixday_sec%
endon
Time#Initialized Do
Let,2,%unixday_sec%-%v1%
Event,timeisset
EndOn
on timeisset do
if %v2% < 600
//WAKE FROM EVENT
else
//WAKE FROM timer
endif
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
Re: How to find out what triggered a wake up
Connect rain sensor to other GPIO too and after wake up check this GPIO.
If your sensor send only short pulse, which resets and wake ups ESP, you can extend pulse time, so it will be active some time after reboot on other GPIO.
Use NE555 timer for example.
GPIO active = wake up by pulse
GPIO no active = wake up by timer
If your sensor send only short pulse, which resets and wake ups ESP, you can extend pulse time, so it will be active some time after reboot on other GPIO.
Use NE555 timer for example.
GPIO active = wake up by pulse
GPIO no active = wake up by timer
Who is online
Users browsing this forum: No registered users and 92 guests