S20 (Sonoff): 99% load always...

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
M*I*B
Normal user
Posts: 379
Joined: 22 Jan 2018, 15:47
Location: Germany
Contact:

S20 (Sonoff): 99% load always...

#1 Post by M*I*B » 15 Jul 2023, 13:05

Hello there again,

As you may know, I have a number of converted S20s in use.
A few days ago I had a technical problem with my power supply and as a result two S20 and a Shelly plug didn't want to use wifi anymore...
The problem is solved, but I noticed that an S20 always runs at 99% load.
As soon as I remove the rules, the problem goes away. So it must have something to do with the rules...

Hence my question:

Am I doing something here that generates an infinite loop or something like that? I do not find it :cry:

Code: Select all

on System#Boot do
	// Prefill all Data after cold start
	TaskValueSet,Taste,BTN,0
	TaskValueSet,Sollwert,D,23.0	// Daytime- temperature
	TaskValueSet,Sollwert,N,19.0	// Nighttime- temperature
	TaskValueSet,Zeiten,Dh,05	// Time to start Day/hour
	TaskValueSet,Zeiten,Dm,30	// Time to start Day/minute
	TaskValueSet,Zeiten,Nh,22	// Time to start Night/hour
	TaskValueSet,Zeiten,Nm,00	// Time to start Night/minute
endon

on Time#Initialized do
	// Set Level of Regulator after cold start
	if %systime% > [Zeiten#Dh#D2]:[Zeiten#Dm#D2] and %systime% < [Zeiten#Nh#D2]:[Zeiten#Nm#D2]
		config,task,Regler,SetLevel,[Sollwert#D]
		TaskValueSet,Sollwert,IS,[Sollwert#D]
	else
		config,task,Regler,SetLevel,[Sollwert#N]
		TaskValueSet,Sollwert,IS,[Sollwert#N]
	endif
endon

on Regler#SET do
	// Regler ACTIVE && KEY ON || Regler ACTIVE && Regler ON
	if [Regler#SET] = 1 or [Taste#BTN] = 1
		gpio,12,1
		TaskValueSet,Sollwert,IS,[Regler#GetLevel]
	// Regler ACTIVE && KEY OFF && Regler OFF
	elseif [Regler#SET] = 0 and [Taste#BTN] = 0
		gpio,12,0
		TaskValueSet,Sollwert,IS,[Regler#GetLevel]
	endif
endon

// Time to switch to over day temperature
on Clock#Time=All,[Zeiten#Dh]:[Zeiten#Dm] do
	config,task,Regler,SetLevel,[Sollwert#D]
	TaskValueSet,Sollwert,IS,[Sollwert#D]
endon

// Time to switch to over night temperature
on Clock#Time=All,[Zeiten#Nh]:[Zeiten#Nm] do
	config,task,Regler,SetLevel,[Sollwert#N]
	TaskValueSet,Sollwert,IS,[Sollwert#N]
endon

// LongPress: Toggle the regulator (OFF/AUTOMATIC)
// ShortPress: Toggle between AUTO and ON (ON 
on Taste#BTN do
// Regler ACTIVE && KEY Longpress? Regler PASSIVE, RLY OFF
	if [Regler#settings.enabled] = 1 and %eventvalue1% > 9 
		gpio,12,0
		TaskDisable,Regler
		longpulse_ms,13,1,300,100,-1
 // Regler ACTIVE and KEY ON Regler ACTIVE, RLY On
	elseif [Regler#settings.enabled] = 1 and %eventvalue1% = 1 
		gpio,12,1
 // Regler ACTIVE and KEY OFF Regler ACTIVE, RLY OFF
	elseif [Regler#settings.enabled] = 1 and %eventvalue1% = 0
		gpio,12,0
 // Regler PASSIVE and KEY Longpress? Regler ACTIVE, RLY OFF
	elseif [Regler#settings.enabled] = 0 and %eventvalue1% > 9
		gpio,12,0
		TaskEnable,Regler
		longpulse_ms,13,1,0
	endif
endon

// Base system: SONOff S20, 4pin 3,5mm Plug, !! Wire from PE to GND !!
// 10k resistor inside Plug, not in device. GND=GND, Ring 1 = TX, Ring 2 = RX, TIP = +Ub
// DEVICES
//  1 - Switch input - Switch 		- "Taste#BTN" 	- GPIO0
//  2 - Switch input - Switch 		- "Relais#RLY" 	- GPIO12
//  5 - Regulator - Level Control	- "Regler#SET"	- Task11
//  8 - Generic - Dummy Device		- "Sollwert#D	- °C Day tt.t
//  8 					- "Sollwert#N	- °C Night
//  9 - Generic - Dummy Device		- "Zeiten#Dh"	- Day Hour
//  9							- "Zeiten#Dm"	- Day Minutes
//  9							- "Zeiten#Nh"	- Night Hour
//  9							- "Zeiten#Nm"	- Night Minutes
// 11 - Environment - DS18b20		- "Sensor#TMP"	- either ... 
// 12 - Environment - DHT11/12...	- "Sensor#TMP"	- ... or
// 12 					- "Sensor#HUM"	-

DLzG
Micha

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

Re: S20 (Sonoff): 99% load always...

#2 Post by TD-er » 15 Jul 2023, 13:09

Do you have "ECO" mode checked on the Tools->Advanced page?
If so, then a high load doesn't mean it can't keep up with all it has to do.

User avatar
M*I*B
Normal user
Posts: 379
Joined: 22 Jan 2018, 15:47
Location: Germany
Contact:

Re: S20 (Sonoff): 99% load always...

#3 Post by M*I*B » 15 Jul 2023, 14:28

... ECO is off now, so the LOAD is gone down to ~97% more or less (most more).
Ok, while BootUp there is many to do but if running there is almost nothing if no event are up...
DLzG
Micha

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

Re: S20 (Sonoff): 99% load always...

#4 Post by TD-er » 15 Jul 2023, 22:32

Maybe the ESP needs to do a lot of connection attempts to some MQTT broker, or something else?

I can't really tell what might be the problem here without seeing the timing stats.
You may need to enable collecting the timingstats (if it is even present in your build, as it is often disabled for 1M builds) and let the unit run for a while before opening the TimingStats page. (on every reload of that page, the stats are reset)

Post Reply

Who is online

Users browsing this forum: No registered users and 40 guests