Page 1 of 1

How i can stop the MQTT before going to deepsleep?

Posted: 04 Aug 2019, 20:37
by spicer
My ESP go to deepsleep every 5min.

Code: Select all

On System#Boot do    //When the ESP wake up, do
  timerSet,1,40      //Set Timer 1 for the next event in 40 seconds
endon

On Rules#Timer=1 do  //When Timer1 expires, do
     deepsleep,300      //Deepsleep for the next 300 seconds
endon
But the MQTT server generates strange lines when the transfer is aborted.
See the attachement.
MCU_T0, ' , Auss, Luf0>7, Luftf0>7, Luftfeuchtigkeit0, Win0, �0, �0>7

How i can stop the MQTT transfer before the ESP go to deepsleep?

Re: How i can stop the MQTT before going to deepsleep?

Posted: 04 Aug 2019, 21:51
by TD-er
What build is that?
I will also look at the deepsleep command, but a little while ago (two months maybe???) I added some flush function to all controllers which is being called before entering deep sleep.
So maybe I forgot to look at the deepsleep command itself, but at least there is support for flushing data before entering the deep sleep.

Re: How i can stop the MQTT before going to deepsleep?

Posted: 04 Aug 2019, 21:53
by spicer
mega-20190803

Re: How i can stop the MQTT before going to deepsleep?

Posted: 04 Aug 2019, 23:16
by TD-er
spicer wrote: 04 Aug 2019, 21:53mega-20190803
OK, that's new enough ;)
I will look into the deepsleep call to see if I understand what's missing here.

Re: How i can stop the MQTT before going to deepsleep?

Posted: 04 Aug 2019, 23:24
by TD-er
Found it...
There is a separate function to start the deepsleep from a command and one from within the loop().

Will fix that one.
Let's see if I can make it before the next build tonight.

Re: How i can stop the MQTT before going to deepsleep?

Posted: 05 Aug 2019, 00:05
by spicer
Wow, that's great. Thank you

Re: How i can stop the MQTT before going to deepsleep?

Posted: 05 Aug 2019, 02:22
by TD-er
Please let me know if tomorrow's build does fix this for you.

Re: How i can stop the MQTT before going to deepsleep?

Posted: 05 Aug 2019, 14:29
by spicer
Problem solved.
However, I had with the 20190803 solved the problem synonymous.
I deleted the mqtt in ioBroker and created new.
Now the newest version is running.
No problems so far.
Thank you very much for your support.

Re: How i can stop the MQTT before going to deepsleep?

Posted: 05 Aug 2019, 20:25
by TD-er
I guess you had 2 problems at hand.
One was the deepsleep call from a command that didn't flush the data before going to sleep.
The other was that it was perhaps using a setting that wasn't initialized well before being used. (old settings from an older build and then upgrade the build)

So when in doubt, always clear some of the settings of a plugin or controller which is misbehaving.

Re: How i can stop the MQTT before going to deepsleep?

Posted: 05 Aug 2019, 20:36
by spicer
Yes. I did an upgrade.
And disconnected the power manually during the install.

My Rules:

Code: Select all

on System#Wake do
  gpio,14,1
  gpio,13,0
endon

On System#Boot do    //When the ESP wake up, do
  timerSet,1,60      //Set Timer 1 for the next event in 60 seconds
endon

On Rules#Timer=1 do  //When Timer1 expires, do
    if [Wind#Wind]<20    //When Wind speed less than 20km/h, do
     deepsleep,300      //Deepsleep for the next 300 seconds
    else
     timerSet,1,20      //Add 20 seconds again
    endif
endon
Pls say to your developer:
Deepsleep is very unstable.
Energy saving....is not for a ESP8266
All 5min for 60s on is not the solution.
I think, my soluton with Modemsleep is more stable.


What's that? When the blue LED is hard blinking?
Or the 2nd LED is on?
ESP will not reboot after this.

Edit:
ATM it works perfect.If it's thunderstorm is very bad

If you interested:
http://www.ltspiceusers.ch/showthread.php?t=392
(my own board)

Re: How i can stop the MQTT before going to deepsleep?

Posted: 07 Aug 2019, 11:14
by spicer
Without "Deckel" and "no deepsleep" it works perfect!
Im Moment läuft es sogar mit "Deckel"!

Re: How i can stop the MQTT before going to deepsleep?

Posted: 07 Aug 2019, 13:57
by spicer
Here the main case.
Excuse me for the external batteries ^^
It's still in test phase.

Re: How i can stop the MQTT before going to deepsleep?

Posted: 08 Aug 2019, 17:43
by TD-er
I am not really a fan of those DC/DC step-up/down converters you used.
They are really hard to set right, especially if you get above 12V or so.
So you may also want to fixate the trimpot using some nail polish or glue or replace them with fixed value resistors.

Re: How i can stop the MQTT before going to deepsleep?

Posted: 18 Aug 2019, 07:59
by spicer
Update:
The blinking LED is a problem from a bad Wlan.
Now i installed a repeater.
It works perfect.

In my language:
Die schnell blinkende LED ist tatsächlich ein Problem eines schlechten Wlan Empfangs.
Ich habe jetzt einen Wlan Repeater installiert und mein ESP funktioniert seit Stunden perfekt.
Auch müllt das ESP den ioBroker nicht mehr zu. ...keine falschen MQTT Einträge mehr.