Reboot tracking

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
marstu
Normal user
Posts: 37
Joined: 29 May 2021, 02:15

Reboot tracking

#1 Post by marstu » 13 Jun 2021, 20:28

Hi all,

I have a new idea, and would like to track the reboots of my ESPs on a daily basis (clear variable right before midnight) in a dummy device due to this rule, which is working very well:

Code: Select all

on System#Boot do
  timerSet,1,60  // Set timer 1
endon

on WiFi#Disconnected do
  timerSet,1,60  // Set timer 1
endon

on WiFi#Connected do
  timerSet,1,0  // Clear timer 1
endon

On Rules#Timer=1 do
  Reboot
endOn
My idea was the following:

Code: Select all

on Clock#Time=All,23:59 do //will run once a day at noon
 Let,16,0
endon

On System#Boot do 
  TaskValueSet 6,1,[var#16]+1 //will this survive a reboot?
endon
I guess there is a slight mistake and this

Code: Select all

On System#Boot do 
should ready as

Code: Select all

On System#Reboot do 
Please correct me if I am wrong?


Merci already and kind regards
marstu
--
ESP8266, ESPEasy (always latest mega release in use :D ), and Domoticz (only beta versions :) )

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

Re: Reboot tracking

#2 Post by TD-er » 13 Jun 2021, 20:38

Variables do not survive a reboot, but task variables do.
So you could store something in a dummy task and try to read it at boot.

N.B. This is somewhat unreliable on ESP32, but on ESP8266 it does work, as long as you don't power cycle the node.

marstu
Normal user
Posts: 37
Joined: 29 May 2021, 02:15

Re: Reboot tracking

#3 Post by marstu » 13 Jun 2021, 20:58

TD-er wrote: 13 Jun 2021, 20:38 Variables do not survive a reboot, but task variables do.
So you could store something in a dummy task and try to read it at boot.
Ok, again not thought out correctly. Next try is something like that:

Code: Select all

on Clock#Time=All,23:59 do //will run once a day at noon
 TaskValueSet 6,1,0
endon
On System#Boot do 
  TaskValueSet 6,1,[Reb_Count#Reboots]+1 //will this survive a reboot?
endon
But how can I increase this task variable after each reboot? I guess I need something different to [var#16]+1, but what is exactly required? [Reb_Count#Reboots]+1 might this be an idea?
TD-er wrote: 13 Jun 2021, 20:38 N.B. This is somewhat unreliable on ESP32, but on ESP8266 it does work, as long as you don't power cycle the node.
It is a ESP8266, I am not yet into ESP32s.
--
ESP8266, ESPEasy (always latest mega release in use :D ), and Domoticz (only beta versions :) )

marstu
Normal user
Posts: 37
Joined: 29 May 2021, 02:15

Re: Reboot tracking

#4 Post by marstu » 13 Jun 2021, 21:05

marstu wrote: 13 Jun 2021, 20:58

Code: Select all

on Clock#Time=All,23:59 do //will run once a day at noon
 TaskValueSet 6,1,0
endon
On System#Boot do 
  TaskValueSet 6,1,[Reb_Count#Reboots]+1 //will this survive a reboot?
endon
Tested and it is working as expected, thanks for the helpful hint.
--
ESP8266, ESPEasy (always latest mega release in use :D ), and Domoticz (only beta versions :) )

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 31 guests