Thanks grovkillen I saw that but it seems System#Wake and System#Boot are effectivaly equilivant.
I did some testing and when waking from deepsleep or rebooting/powering on, system#wake runs first then system#boot.
Here is how I came to that conclusion. I created 5 rules and a 'Generic - Dummy Device' called 'debug' with a value called 'x'. The idea was in System#Boot to add 1 to 'x', in System#Wake add 10, System#sleep add 100 etc. In a boot I got 11011. While it showed me which got run, it didn't tell the order so I added a second variable to 'debug' called 'n', added a new command to each ruleset (N=N+1) and changed the rules so System#Boot adds 1*n to 'x', System#Wake add 10*n so the rules are:
Code: Select all
on System#Boot do
TaskValueSet 1,2,[debug#n]+1
TaskValueSet 1,1,[debug#x]+1*[debug#n]
endon
on System#Wake do
TaskValueSet 1,2,[debug#n]+1
TaskValueSet 1,1,[debug#x]+10*[debug#n]
endon
on System#sleep do
TaskValueSet 1,2,[debug#n]+1
TaskValueSet 1,1,[debug#x]+100*[debug#n]
endon
on WiFi#Connected do
TaskValueSet 1,2,[debug#n]+1
TaskValueSet 1,1,[debug#x]+1000*[debug#n]
endon
on MQTT#Connected do
TaskValueSet 1,2,[debug#n]+1
TaskValueSet 1,1,[debug#x]+10000*[debug#n]
endon
on gosleep do
deepsleep,10
endon
on reset do
TaskValueSet 1,1,0
TaskValueSet 1,2,0
endon
the values can be reset by the http command
Code: Select all
http://your-ip/control?cmd=event,reset
and deepsleep (remember to connect D0 to RST to wake back up) can be run with
Code: Select all
http://your-ip/control?cmd=event,gosleep
With this a power on or reboot ends up with d=43012 (System#Wake, System#Boot, WiFi#Connected, MQTT#Connected) while a deepsleep ends up with d=54123 (System#sleep, System#Wake, System#Boot, WiFi#Connected, MQTT#Connected)
So System#Wake and System#Boot always run one after the other and there is no way to tell if it is a power on/reboot vrs a wake from deepsleep...sigh