Page 1 of 1

flash writes happen to often.....?

Posted: 13 Apr 2021, 09:29
by chromo23
First of all i am not sure if i understand the flash counter right

Code: Select all

Flash Writes:	27 daily / 38 boot
Does that mean i had in 24h 27 flash writes and also 38 reboots?
And will it be reset after 24h or only after a power cycle or flashcounter reset

Why is this happening on a device where it shouldn’t happen at all? (i have a lot espeasy powered devices that don´t do it)

Rules:

Code: Select all

on System#Boot do
TaskValueSet 4,1,1
TaskRun,3
endon

On toggle do
  if [Relay#State]=0
    if [dummy#var]=1
      let,2,1
      TaskValueSet 4,1,0 
    endif
    gpio,12,1
    timerSet,2,14400
  else
    if [var#2]=1
      TaskValueSet 4,1,1
      let,2,0
    endif
    gpio,12,0
  endif
endon

On Button#State=1 do
event,toggle
endon

On Button#State=11 do
 if [dummy#var]=1
  TaskValueSet 4,1,0 
  gpio,12,0
 else
  TaskValueSet 4,1,1   
 endif
endon

On WiFi#Connected do
  SendToHTTP,api.thingspeak.com,80,/update?api_key=******&field1=[sensor#Temperature]&field2=[sensor#Humidity]
  timerSet,1,59
  Let,1,0
endon

On Rules#Timer=1 do
  Let,1,[VAR#1]+1
 if [var#1]<5 
  SendToHTTP,api.thingspeak.com,80
 else
  TaskRun,3
  SendToHTTP,api.thingspeak.com,80,/update?api_key=******&field1=[sensor#Temperature]&field2=[sensor#Humidity]
  Let,1,0
 endif
 timerSet,1,59
endon

//------------------------------------
On aan do
       TaskValueSet 4,1,1
endon 

On aaus do
       TaskValueSet 4,1,0
endon

//------------------------------------
On dummy#var=1 do
  
if [sensor#Humidity]>=75
    gpio,12,1
  endif

if [sensor#Humidity]<=71 and [dummy#var2]=1
gpio,12,0
  endif
endon

On Rules#Timer=2 do
   event,toggle
endon

On dummy#var do
if [dummy#var]=1
      gpio,13,0
    else
    gpio,13,1
endif
endon
My Devices:
Bildschirmfoto 2021-04-13 um 09.14.57.png
Bildschirmfoto 2021-04-13 um 09.14.57.png (88.05 KiB) Viewed 3903 times
Build: 20110 - Mega (Sonoff s20)

So either the Hardware has an issue or i did something wrong in rules or the rest of the configuration.
Any suggestions?

Re: flash writes happen too often.....?

Posted: 13 Apr 2021, 15:39
by TD-er
Daily flash write counts is reset after 86400 seconds since last reset of this counter.
The "38" in your example is the number of flash writes since last boot.

Re: flash writes happen too often.....?

Posted: 13 Apr 2021, 21:36
by chromo23
Thank you...
So if i write once to the flash i should look like this:
1 daily / 1 boot

and after 24h:
0 daily / 1 boot

and the flashwrite since boot will only be reset after i reboot (as well as the daily counter), right?
so it accumulates all the writes...

Re: flash writes happen to often.....?

Posted: 13 Apr 2021, 23:13
by TD-er
Yep, that's what the code suggests, which I browsed when typing the answer to your question :)

The total writes counter is large enough, that it can hold more writes than the flash can handle (32 bit int)

Re: flash writes happen to often.....?

Posted: 13 Apr 2021, 23:19
by chromo23
Perfect! :)