Sensors reporting too frequently

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
boolie
Normal user
Posts: 20
Joined: 23 May 2018, 21:35

Sensors reporting too frequently

#1 Post by boolie » 20 Dec 2019, 11:39

Hi All,

I've been running ESPEasy on some sensors for a long while, but have just noticed some unexpected behaviour with at least a couple of my ESPEasy-based sensors. I have devices set up to report to the controller (domoticz) every 300 seconds, but I see the sensors sending messages to domoticz much more frequently - as often as 15 seconds apart. These seem to be related to very small changes in the sensor value in ESPEasy. It's causing quite a lot of unnecessary event processing on the dz server, as these sensors are part of the climate control logic.

Are sensors supposed to send only when I tell them (every 300s), or whenever the value changes? Do I have something mis-configured?

Thanks!

ESP Version: mega-20191103
Can't attach TXT files, so apologies for the big code block below - this is one of the logs with a few of the excessive reports; look at idx 1138, 1139.

Code: Select all

66398: EVENT: Rules#Timer=1
66553: ACT  : 7dn,51.6          
66558: 7DGT : Show Number=51
66655: ACT  : TaskValueSet,12,1,2+1             
66668: Command: taskvalueset
66686: ACT  : timerSet,1,5
66698: Command: timerset
70996: MQTT : Connection lost, state: Connection timeout
70997: EVENT: MQTT#Disconnected
71072: ACT  : timerSet,5,60
71085: Command: timerset
71174: MQTT : Connected to broker with client ID: GarageSensor_9
71176: Subscribed to: domoticz/out
71178: EVENT: MQTT#Connected
71237: ACT  : timerSet,5,0
71250: Command: timerset
71325: DHT  : Temperature: 18.50
71325: DHT  : Humidity: 51.60
71329: EVENT: DHT#Temperature=18.04
71428: EVENT: DHT#Humidity=51.60
71546:  Domoticz: Sensortype: 2 idx: 1138 values: 18.0;51.6;1
72380: EVENT: Rules#Timer=1
72609: ACT  : 7dt,48.6                 
72615: 7DGT : Show Temperature=48.60
72696: ACT  : TaskValueSet,12,1,3+1             
72711: Command: taskvalueset
72757: ACT  : timerSet,1,5
72769: Command: timerset
73675: DS   : Temperature: 48.56 (28-21-54-77-91-3-2-51)
73678: EVENT: DHW-LOW#Temperature=48.56
73796:  Domoticz: Sensortype: 1 idx: 1139 values: 48.6
73858: DS   : Temperature: 55.81 (28-ff-82-20-a3-16-5-1b)
73860: EVENT: DHW-HIGH#Temperature=55.81
73979:  Domoticz: Sensortype: 1 idx: 1150 values: 55.8
78378: EVENT: Rules#Timer=1
78621: ACT  : 7dt,55.8                  
78627: 7DGT : Show Temperature=55.80
78669: ACT  : TaskValueSet,12,1,4+1             
78682: Command: taskvalueset
78721: ACT  : TaskValueSet,12,1,1
78734: Command: taskvalueset
78743: ACT  : timerSet,1,5
78755: Command: timerset
84378: EVENT: Rules#Timer=1
84477: ACT  : 7dt,18.0             
84482: 7DGT : Show Temperature=18.00
84666: ACT  : TaskValueSet,12,1,1+1             
84681: Command: taskvalueset
84727: ACT  : timerSet,1,5
84740: Command: timerset
90375: EVENT: Rules#Timer=1
90526: ACT  : 7dn,51.6          
90531: 7DGT : Show Number=51
90668: ACT  : TaskValueSet,12,1,2+1             
90681: Command: taskvalueset
90758: ACT  : timerSet,1,5
90770: Command: timerset
92757: WD   : Uptime 2 ConnectFailures 0 FreeMem 16992 WiFiStatus 3
94158: MQTT : Connection lost, state: Connection timeout
94159: EVENT: MQTT#Disconnected
94206: ACT  : timerSet,5,60
94218: Command: timerset
94305: MQTT : Connected to broker with client ID: GarageSensor_9
94306: Subscribed to: domoticz/out
94309: EVENT: MQTT#Connected
94367: ACT  : timerSet,5,0
94381: Command: timerset
94461: DHT  : Temperature: 18.50
94461: DHT  : Humidity: 51.60
94465: EVENT: DHT#Temperature=18.04
94600: EVENT: DHT#Humidity=51.60
94723:  Domoticz: Sensortype: 2 idx: 1138 values: 18.0;51.6;1
96377: EVENT: Rules#Timer=1
96568: ACT  : 7dt,48.6                 
96574: 7DGT : Show Temperature=48.60
96666: ACT  : TaskValueSet,12,1,3+1             
96678: Command: taskvalueset
96723: ACT  : timerSet,1,5
96735: Command: timerset
96825: DS   : Temperature: 48.50 (28-21-54-77-91-3-2-51)
96828: EVENT: DHW-LOW#Temperature=48.50
96946:  Domoticz: Sensortype: 1 idx: 1139 values: 48.5
96979: DS   : Temperature: 55.81 (28-ff-82-20-a3-16-5-1b)
96982: EVENT: DHW-HIGH#Temperature=55.81
97099:  Domoticz: Sensortype: 1 idx: 1150 values: 55.8
102375: EVENT: Rules#Timer=1
102618: ACT  : 7dt,55.8                  
102623: 7DGT : Show Temperature=55.80
102664: ACT  : TaskValueSet,12,1,4+1             
102677: Command: taskvalueset
102717: ACT  : TaskValueSet,12,1,1
102730: Command: taskvalueset
102738: ACT  : timerSet,1,5
102749: Command: timerset
108376: EVENT: Rules#Timer=1
108475: ACT  : 7dt,18.0             
108481: 7DGT : Show Temperature=18.00
108695: ACT  : TaskValueSet,12,1,1+1             
108709: Command: taskvalueset
108755: ACT  : timerSet,1,5
108767: Command: timerset
114375: EVENT: Rules#Timer=1
114524: ACT  : 7dn,51.6          
114530: 7DGT : Show Number=51
114696: ACT  : TaskValueSet,12,1,2+1             
114711: Command: taskvalueset
114756: ACT  : timerSet,1,5
114770: Command: timerset
120375: EVENT: Clock#Time=Thu,00:02
120470: EVENT: Rules#Timer=1
120670: ACT  : 7dt,48.5                 
120675: 7DGT : Show Temperature=48.50
120790: ACT  : TaskValueSet,12,1,3+1             
120805: Command: taskvalueset
120851: ACT  : timerSet,1,5
120865: Command: timerset
121184: Dummy: value 1: 4.00
121185: Dummy: value 2: 0.00
121185: Dummy: value 3: 0.00
121185: Dummy: value 4: 0.00
121187: EVENT: MyVars#cycle=4.00
121286: EVENT: MyVars#=0.00
121382: EVENT: MyVars#=0.00
121475: EVENT: MyVars#=0.00
122757: WD   : Uptime 2 ConnectFailures 0 FreeMem 17568 WiFiStatus 3
126383: EVENT: Rules#Timer=1
126622: ACT  : 7dt,55.8                  
126628: 7DGT : Show Temperature=55.80
126643: ACT  : TaskValueSet,12,1,4+1             
126656: Command: taskvalueset
126667: ACT  : TaskValueSet,12,1,1
126680: Command: taskvalueset
126688: ACT  : timerSet,1,5
126699: Command: timerset
127509: MQTT : Connection lost, state: Connection timeout
127510: EVENT: MQTT#Disconnected
127556: ACT  : timerSet,5,60
127568: Command: timerset
127689: MQTT : Connected to broker with client ID: GarageSensor_9
127691: Subscribed to: domoticz/out
127693: EVENT: MQTT#Connected
127752: ACT  : timerSet,5,0
127766: Command: timerset
127842: DHT  : Temperature: 18.50
127842: DHT  : Humidity: 51.60
127847: EVENT: DHT#Temperature=18.04
127980: EVENT: DHT#Humidity=51.60
128098:  Domoticz: Sensortype: 2 idx: 1138 values: 18.0;51.6;1
129773: DS   : Temperature: 48.63 (28-21-54-77-91-3-2-51)
129775: EVENT: DHW-LOW#Temperature=48.63
129892:  Domoticz: Sensortype: 1 idx: 1139 values: 48.6
129924: DS   : Temperature: 55.81 (28-ff-82-20-a3-16-5-1b)
129926: EVENT: DHW-HIGH#Temperature=55.81
130043:  Domoticz: Sensortype: 1 idx: 1150 values: 55.8
Various D1 & Sonoffs with ESPEasy, some Tasmota. Domoticz, Z-wave.
ESPEasy Patreon - keep up the good stuff, guys!

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

Re: Sensors reporting too frequently

#2 Post by TD-er » 20 Dec 2019, 13:45

What plugins are those?
IDX 1138 seems to be the DHT (Environment - DHT11/12/22 SONOFF2301/7021)
IDX 1139 is the Dallas sensor?

boolie
Normal user
Posts: 20
Joined: 23 May 2018, 21:35

Re: Sensors reporting too frequently

#3 Post by boolie » 21 Dec 2019, 20:00

Yes, there are DS18 and DHT22 on there. The other sensor that I've noticed this from, has 3 x DS18B20. I can post a log from that one if it helps, possibly easier to diagnose with just one plug-in involved? I've also updated that one to firmware 20191208.
Various D1 & Sonoffs with ESPEasy, some Tasmota. Domoticz, Z-wave.
ESPEasy Patreon - keep up the good stuff, guys!

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Sensors reporting too frequently

#4 Post by ThomasB » 21 Dec 2019, 20:38

Are sensors supposed to send only when I tell them (every 300s), or whenever the value changes? Do I have something mis-configured?
On typical devices both of these things will trigger sending data when you use the plugins "Send to Controller" feature. To prevent sending data when the value changes you should disable the device's Send to Controller and use rules instead. For example, setup a timer rule that publishes the value every 300s.

- Thomas

boolie
Normal user
Posts: 20
Joined: 23 May 2018, 21:35

Re: Sensors reporting too frequently

#5 Post by boolie » 21 Dec 2019, 23:13

Hmm. Ok, if that's how they're intended to behave. Maybe I should raise a feature request on that one, make it easy to disable the on-change sending in the UI.
Various D1 & Sonoffs with ESPEasy, some Tasmota. Domoticz, Z-wave.
ESPEasy Patreon - keep up the good stuff, guys!

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

Re: Sensors reporting too frequently

#6 Post by TD-er » 21 Dec 2019, 23:39

A task is meant to output a value every [interval] number of seconds.
This interval can be set in the task configuration.

If for some reason a plugin does send out more often, then it is very likely a bug, or you call the taskrun command from the rules?

Remember, if you have multiple instances of the same plugin, then each of these tasks has its own interval.
Just make sure you have them all set to the right interval.

Apart from that, the controller may perform a retry when it appears to be unsuccessful in sending the value.
Make sure you're not looking at those retries (for example set the number of retries to 0 in the controller)

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Sensors reporting too frequently

#7 Post by ThomasB » 22 Dec 2019, 02:49

A task is meant to output a value every [interval] number of seconds. {snip} If for some reason a plugin does send out more often, then it is very likely a bug ...
Hmm, either I'm confused (very possible) or the plugin's on-change controller behavior was revised and I never noticed. So you have my attention.

If the intent is to rely only on the plugin's controller timer then sending data value updates will be delayed. IMHO, sending on-change data is important too.

A typical scenario is someone opens a door and changes the state value in a Switch plugin. A home automation system would want to immediately know this (could be a burglar if security mode is on). Same expectation for data from a measurement sensor; A dangerous temperature rise occurs and waiting for the next controller timer expiration may be too late.

BTW, some plugins allow us to disable the controller timer (set it to zero). Therefore only on-change data should be sent. The OP desires the opposite of this; I suggest the practical solution is to use rules.

- Thomas

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Sensors reporting too frequently

#8 Post by grovkillen » 22 Dec 2019, 06:37

The switch plug-in works like that, i.e. it'll trigger an event upon change. Sensor plugins will trigger events on interval.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Sensors reporting too frequently

#9 Post by ThomasB » 22 Dec 2019, 07:24

My apologies, that's truly a surprise. I didn't realize that the switch plugin was the only one capable of doing it. But now I know!

- Thomas

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

Re: Sensors reporting too frequently

#10 Post by TD-er » 22 Dec 2019, 20:58

Well there is a difference between "interval timer" and the switch plugin (as one of the very few) to also send out an event.
I don't think the switch plugin does re-schedule itself to be read (and thus output a value through the controller), or only fires an event which can be used in rules.

I can imagine both could be useful for the switch plugin.

All other plugins should rely on their task interval to perform a read.
The controller is just a receiving one, so it will not initiate a read from the plugin.
There are some very specific exceptions of controller interaction with plugins, but those are controller specific and only interact with a handful of plugins.

boolie
Normal user
Posts: 20
Joined: 23 May 2018, 21:35

Re: Sensors reporting too frequently

#11 Post by boolie » 04 Jan 2020, 23:48

Interesting topic.

My sensors seem to have calmed down since I resolved another issue that I found later, with there being so much MQTT traffic on domoticz/out that it swamped the ESP. Now I'm seeing reports from them only every interval, which is the expected behaviour, if I understood TD-er's and grovkillen's comments above correctly. I suspect that the retries and MQTT disconnections were causing the extra reports (and in the process, adding to the load on the poor ESP).

I think Thomas's point is a good one too; there are situations where a device would ideally report on both change and interval. I guess that one can achieve report-on-change by rules triggered 'on device#value' so that's already possible. Might be nice to have the 'either-or-both' option in the UI, as that would make the behaviour clear in each device.
Various D1 & Sonoffs with ESPEasy, some Tasmota. Domoticz, Z-wave.
ESPEasy Patreon - keep up the good stuff, guys!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 27 guests