Surprising boot boot surprenant

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
gibus17
Normal user
Posts: 19
Joined: 06 Jan 2020, 12:02

Surprising boot boot surprenant

#1 Post by gibus17 » 23 Jan 2021, 15:14

bonjour ,
rédiger en francais et traduit avec google.
write in french and translate with google.
Quand j'ai cette regle tout est OK
When I have this rule everything is OK

Code: Select all

on consigne_moins do
	timerSet,4,1  //démarre un timer pour éviter des changements trop rapides
endon
on Rules#Timer=4 do
	if [CONSIGNE#consigne]>=15.0
		taskValueSet,5,1,[CONSIGNE#consigne]-0.5  //consigne - 0.5
	else
		taskValueSet,5,1,25
	endif
	SendToHTTP,192.168.1.145,6017,/json.htm?type=command&param=setsetpoint&idx=69&setpoint=[CONSIGNE#consigne]
//	event,maj_thermostat
//endon
	
//on maj_thermostat do	
	if [CONSIGNE#mode] = 1  
		config,task,THERMOSTAT,setLevel,0 
	elseif [CONSIGNE#mode] = 2
		config,task,THERMOSTAT,setLevel,7 
	elseif [CONSIGNE#mode] = 3
		config,task,THERMOSTAT,setLevel,[CONSIGNE#consigne]-2 
	elseif [CONSIGNE#mode] = 4
		config,task,THERMOSTAT,setLevel,[CONSIGNE#consigne]
	elseif [CONSIGNE#mode] = 5 
		config,task,THERMOSTAT,setLevel,[CONSIGNE#consigne]+2 
	endif
endon
Lorsque la commande "event,consigne_moins" s'execute, c'est OK
When the "event, consignment_minus" command is executed, it is OK

Quand je la modifie comme ceci (suppression des signes commentaire)
When I edit it like this (remove comment signs)

Code: Select all

on consigne_moins do
	timerSet,4,1  //démarre un timer pour éviter des changements trop rapides
endon
on Rules#Timer=4 do
	if [CONSIGNE#consigne]>=15.0
		taskValueSet,5,1,[CONSIGNE#consigne]-0.5  //consigne - 0.5
	else
		taskValueSet,5,1,25
	endif
	SendToHTTP,192.168.1.145,6017,/json.htm?type=command&param=setsetpoint&idx=69&setpoint=[CONSIGNE#consigne]
	event,maj_thermostat
endon
	
on maj_thermostat do	
	if [CONSIGNE#mode] = 1  
		config,task,THERMOSTAT,setLevel,0 
	elseif [CONSIGNE#mode] = 2
		config,task,THERMOSTAT,setLevel,7 
	elseif [CONSIGNE#mode] = 3
		config,task,THERMOSTAT,setLevel,[CONSIGNE#consigne]-2 
	elseif [CONSIGNE#mode] = 4
		config,task,THERMOSTAT,setLevel,[CONSIGNE#consigne]
	elseif [CONSIGNE#mode] = 5 
		config,task,THERMOSTAT,setLevel,[CONSIGNE#consigne]+2 
	endif
endon
Quand la commande "event,consigne_moins" est effectuée le Sonooff dual reboot et redemarre en mode AP, j'ai sur le port serie ces infos
When the "event, consignment_minus" command is performed, the Sonooff dual reboot and restarts in AP mode, I have this information on the serial port

Code: Select all

34712 : Info   : WIFI : Disconnected! Reason: '(15) ' Connected for 11 s
34763 : Info   : EVENT: WiFi#Disconnected
35630 : Info   : WIFI  : Start network scan
37816 : Info   : IP   : Static IP : 192.168.1.130 GW: 192.168.1.1 SN: 255.255.255.0 DNS: 192.168.1.1
37817 : Info   : WIFI : Connecting SFR_2660 attempt #4
37830 : Info   : WIFI  : Scan finished, found: 7
37831 : Info   : WIFI  : Selected: SFR_2660 24:95:04:BA:26:64 Ch:1 (-73dBm) WPA/WPA2/PSK
38465 : Info   : WD   : Uptime 1 ConnectFailures 0 FreeMem 24608 WiFiStatus 6 ESPeasy internal wifi status: DISCONNECTED
Lors d'une commande ""boot "ou d'un arret/marche secteur, la connexion au Wifi s'effectue normalement
Si j'execute avec le navigateur la commande "event,maj_thermostat" elle est exécutée normalement.
Le contrôle du Sonoff me permet de constater que sa config n'a pas changée à l'exception du mot de passe de connexion Wifi que je ne sais pas contrôler. Je le renseigne donc à nouveau. c'est après avoir renseigné le mdp Wifi, de très nombreuses fois, que le Sonoff se connecte au Wifi de la Box SFR.
Merci de votre aide


During a "" boot "command or a power on / off, the connection to Wifi is carried out normally.
If I run the "event, maj_thermostat" command with the browser, it is executed normally.
Checking the Sonoff allows me to see that its config has not changed except for the WiFi connection password which I cannot control. I therefore inform it again. it is after having informed the WiFi mdp, many times, that the Sonoff connects to the Wifi of the SFR Box.
Thank you for your help

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

Re: Surprising boot boot surprenant

#2 Post by TD-er » 23 Jan 2021, 15:26

Can you check in some editor like Notepad++ to see if you have some characters which are not in the normal ASCII range?
Also I don't know if an event with an underscore is working well (no idea why not, but never tested it)

Anyway it is good practice not to use letters with accents in task names and variable names (and events)

I can't explain why issues in your rules may lead to the ESP no longer connecting to WiFi and starting the AP mode.

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

Re: Surprising boot boot surprenant

#3 Post by TD-er » 23 Jan 2021, 15:27

Why do you use the "config" command?

Hmm I notice this is the command for the level plugin.
But it also does try to save the settings every time you call it.
So you're wearing out your flash quite fast and crash/boot does seem likely if you write it very often.
Also this saves the security.dat file, which contains the passwords.
If this saving fails, then it would explain why you get an AP at boot.

gibus17
Normal user
Posts: 19
Joined: 06 Jan 2020, 12:02

Re: Surprising boot boot surprenant

#4 Post by gibus17 » 23 Jan 2021, 16:21

Merci pour ce retour rapide
Dans notepad++ je ne vois aucun caractère particulier
J'utilise le tiret du 8 dans d'autre "event" sans soucis
j'utilise la commande "config" pour après avoir modifier la valeur de la consigne enregistrer dans un "dimmer" pour mettre un jour le niveau de declenchement du "Regulator - Level"
pour eviter des changement trop rapide j'ai mis un "timer" reglé à 1 sec
Si une autre rédaction est plus recommandé, je suis preneur
MERCI


Thank you for this quick feedback
In notepad ++ I don't see any particular character
I use the dash of 8 in other "event" without worries
I use the "config" command for after modifying the setpoint value to save in a "dimmer" to update the trigger level of the "Regulator - Level"
to avoid too fast changes I put a "timer" set to 1 sec
If another writing is more recommended, I am interested
THANK YOU

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

Re: Surprising boot boot surprenant

#5 Post by TD-er » 23 Jan 2021, 16:32

I will have a look at the Level plugin later this evening, as this writing of the settings is really disastrous for the flash and the settings may get corrupted if they are written very often.

The file system we're using (SPIFFS) is not designed for a lot of writes. The file system may become fragmented which causes a save action to fail and thus corrupting the settings file.
Usually when editing settings, we don't save everything, but only parts of it.
So the way the level plugin does this is something that needs to be changed and also you should limit the number of writes to this command for now.

gibus17
Normal user
Posts: 19
Joined: 06 Jan 2020, 12:02

Re: Surprising boot boot surprenant

#6 Post by gibus17 » 23 Jan 2021, 16:50

Ok MERCI
J'attend votre retour
j'ai d'autre problème de flash. Mais avant de vous en parler, je vais parcourir le forum

OK, thanks
I'm waiting for your feedback
i have other flash problem. But before I tell you about it, I will browse the forum

gibus17
Normal user
Posts: 19
Joined: 06 Jan 2020, 12:02

Re: Surprising boot boot surprenant

#7 Post by gibus17 » 30 Apr 2021, 16:02

Hello,
Hello,
Have you seen the plugin?
I have a thermostat that has worked well for a year with a schedule that changes the setpoint 4 times a day. For a few days, during a change of setpoint, the thermostat has remained blocked on "ON". A reboot does not unblock it. The power supply must be cut for it to operate correctly again. I think this may be due to the corruption of the system as you mentioned previously

bonjour,
Avez vous vu le plugin?
J'ai un thermostat qui a bien fonctionné depuis un an avec un planning qui modifie la consigne 4 fois dans la journée. Depuis quelques jours, lors d'un changement de consigne, le thermostat reste bloqué sur "ON".un reboot ne le débloque pas. Il faut couper l'alimentation pour qu'il fonctionne à nouveau correctement. Je pense que cela peut être du à la corruption du système comme vous l'évoquez précédemment

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

Re: Surprising boot boot surprenant

#8 Post by TD-er » 30 Apr 2021, 17:51

If you try to change just anything in the settings, does the web interface show an error in red telling you writing of the settings failed?

Are you using 1M flash or 4M flash?
The 1M flash only has a very small SPIFFS file system, so it could also be that the filesystem gets fragmented.
At boot, the file system garbage collector is called, which may free up some sectors which may not be freed if the file system is mounted.
If that's the case then it might not be a flash wear issue, but more of a fragmentation issue.
A weekly reboot could help prevent this.

gibus17
Normal user
Posts: 19
Joined: 06 Jan 2020, 12:02

Re: Surprising boot boot surprenant

#9 Post by gibus17 » 01 May 2021, 22:50

Thank you for this quick feedback.
I waited to answer you until the thermostat was blocked in order to carry out the recommended modification test.
I use a 1M flash
I have a rule that reboots every day.
The thermostat is blocked when the thermostat setpoint goes from 17.5 to 20.
A modification in a rule or the modification of the hysteresis is registered without any difficulty (no refusal message)
To unlock, you must cut off the power supply. the "REBOOT" or "RESTART" commands are carried out normally but do not unblock the thermostat. For my information: what is the difference between these two commands?

Merci pour ce retour rapide.
J'ai attendu pour vous répondre que le thermostat soit bloqué afin de faire l'essai de modification préconisé.
j'utilise un flash de 1M
J'ai une règle qui fait un "reboot" chaque jour.
Le blocage du thermostat s'effectue lorsque la consigne du thermostat passe de 17.5 à 20.
Une modification dans une règle ou la modification de l'hystéresis s'enregistre sans aucune difficulté (pas de message de refus)
Pour débloquer, il faut couper l'alimentation éléctrique. les commandes "REBOOT" ou "RESTART" s'effectent normalement mais ne débloquent pas le thermostat. Pour mon information : quelle est la différence entre ces deux commandes?

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

Re: Surprising boot boot surprenant

#10 Post by TD-er » 02 May 2021, 15:15

"reboot" and "restart" call the same function, so they are the same.

gibus17
Normal user
Posts: 19
Joined: 06 Jan 2020, 12:02

Re: Surprising boot boot surprenant

#11 Post by gibus17 » 02 May 2021, 23:12

Thank you for this clarification and for your availability.
Do you have a lead that would allow me to solve my blocking problem?

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

Re: Surprising boot boot surprenant

#12 Post by TD-er » 03 May 2021, 00:25

Your calls to setlevel will trigger to save the settings, so I am afraid you have now worn out your flash.
One thing you could try to do is export your settings file, strip everything after 36kB (the settings file is larger than it has to be, so on 1M flash it makes sense to remove the last part of the file containing only zeroes)
Then re-upload this file to your unit.

What this does is it will make sure you use a different part of the file system and also use a smaller part of it.
But I am afraid these issues may occur quite soon again as you have already worn out a large part of your flash sectors used for the SPIFFS file system.
If you plan to replace the unit, or its flash chip, please consider using a 4M flash chip so you have a larger SPIFFS area and thus more sectors to write to when storing settings.

gibus17
Normal user
Posts: 19
Joined: 06 Jan 2020, 12:02

Re: Surprising boot boot surprenant

#13 Post by gibus17 » 03 May 2021, 10:04

Your diagnosis unfortunately confirms my fears. So I will change the module. But for space problems, I have to keep the same.
Is it possible to use or modify (I don't have the skills to do it) the "Regulator - Level" plugin to avoid using the "config" command and therefore to save the SPIFFS files.
Once again THANK YOU for your help and your availability

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

Re: Surprising boot boot surprenant

#14 Post by TD-er » 03 May 2021, 10:43

You can also just replace the flash chip, if you're using a small module like an ESP-01.
They are not that hard to solder by hand.

gibus17
Normal user
Posts: 19
Joined: 06 Jan 2020, 12:02

Re: Surprising boot boot surprenant

#15 Post by gibus17 » 03 May 2021, 12:19

I use a basic sonoff R2 v1.4

gibus17
Normal user
Posts: 19
Joined: 06 Jan 2020, 12:02

Re: Surprising boot boot surprenant

#16 Post by gibus17 » 03 May 2021, 12:45

I reduced the config.dat file to 36k with Notepad ++ by removing the last lines. I reload it on the sonoff. I see that it returns to its original size of 64K

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

Re: Surprising boot boot surprenant

#17 Post by TD-er » 03 May 2021, 12:46

Ah too bad.
That one seems to be using an ESP8285 as can be seen on the Tasmota docs: https://tasmota.github.io/docs/devices/Sonoff-Basic/

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

Re: Surprising boot boot surprenant

#18 Post by TD-er » 03 May 2021, 12:46

gibus17 wrote: 03 May 2021, 12:45 I reduced the config.dat file to 36k with Notepad ++ by removing the last lines. I reload it on the sonoff. I see that it returns to its original size of 64K
Oh?
Does it perform a factory reset?

gibus17
Normal user
Posts: 19
Joined: 06 Jan 2020, 12:02

Re: Surprising boot boot surprenant

#19 Post by gibus17 » 03 May 2021, 13:28

I simply did a reboot

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

Re: Surprising boot boot surprenant

#20 Post by TD-er » 03 May 2021, 13:37

OK, I will have a look at the code to see if I can explain this behavior.

User avatar
Ath
Normal user
Posts: 1160
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Surprising boot boot surprenant

#21 Post by Ath » 03 May 2021, 14:07

Is the save that is done by the "Regulator - Level" plugin causing a full rewrite of the missing parts?
/Ton

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

Re: Surprising boot boot surprenant

#22 Post by TD-er » 03 May 2021, 14:44

Depends a bit on the used file system :)
SPIFFS can update parts of a file, but this also needs some administration by SPIFFS to keep track of what block is used by what file (and in what order)

I do know that SPIFFS does use some nifty tricks to keep the number of writes down, highly relying on the property of NAND flash that you can only change an '1' to a '0'.
So a write only counts as a write when you need to erase a block.
For some flash chips like PUYA, this is not true, so for those chips the number of writes is (much) higher per update.

LittleFS cannot update a part in a file, so it must then rewrite all data that's located after the update.
That's what makes LittleFS so much slower on our settings.

Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests