flash writes happen to often.....?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
chromo23
Normal user
Posts: 821
Joined: 10 Sep 2020, 16:02
Location: germany

flash writes happen to often.....?

#1 Post by chromo23 » 13 Apr 2021, 09:29

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 3784 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?
Last edited by chromo23 on 13 Apr 2021, 22:22, edited 1 time in total.

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

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

#2 Post by TD-er » 13 Apr 2021, 15:39

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.

User avatar
chromo23
Normal user
Posts: 821
Joined: 10 Sep 2020, 16:02
Location: germany

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

#3 Post by chromo23 » 13 Apr 2021, 21:36

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...

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

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

#4 Post by TD-er » 13 Apr 2021, 23:13

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)


Post Reply

Who is online

Users browsing this forum: No registered users and 25 guests