How i can stop the MQTT before going to deepsleep?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
spicer
Normal user
Posts: 34
Joined: 01 Jul 2019, 16:40

How i can stop the MQTT before going to deepsleep?

#1 Post by spicer » 04 Aug 2019, 20:37

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?
Attachments
1564920274604-auswahl_011.png
1564920274604-auswahl_011.png (67.01 KiB) Viewed 9238 times

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

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

#2 Post by TD-er » 04 Aug 2019, 21:51

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.

User avatar
spicer
Normal user
Posts: 34
Joined: 01 Jul 2019, 16:40

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

#3 Post by spicer » 04 Aug 2019, 21:53

mega-20190803

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

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

#4 Post by TD-er » 04 Aug 2019, 23:16

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.

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

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

#5 Post by TD-er » 04 Aug 2019, 23:24

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.

User avatar
spicer
Normal user
Posts: 34
Joined: 01 Jul 2019, 16:40

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

#6 Post by spicer » 05 Aug 2019, 00:05

Wow, that's great. Thank you

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

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

#7 Post by TD-er » 05 Aug 2019, 02:22

Please let me know if tomorrow's build does fix this for you.

User avatar
spicer
Normal user
Posts: 34
Joined: 01 Jul 2019, 16:40

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

#8 Post by spicer » 05 Aug 2019, 14:29

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.

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

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

#9 Post by TD-er » 05 Aug 2019, 20:25

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.

User avatar
spicer
Normal user
Posts: 34
Joined: 01 Jul 2019, 16:40

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

#10 Post by spicer » 05 Aug 2019, 20:36

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)

User avatar
spicer
Normal user
Posts: 34
Joined: 01 Jul 2019, 16:40

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

#11 Post by spicer » 07 Aug 2019, 11:14

Without "Deckel" and "no deepsleep" it works perfect!
Im Moment läuft es sogar mit "Deckel"!

User avatar
spicer
Normal user
Posts: 34
Joined: 01 Jul 2019, 16:40

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

#12 Post by spicer » 07 Aug 2019, 13:57

Here the main case.
Excuse me for the external batteries ^^
It's still in test phase.
Attachments
hauptkasten.jpg
hauptkasten.jpg (192.1 KiB) Viewed 9066 times

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

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

#13 Post by TD-er » 08 Aug 2019, 17:43

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.

User avatar
spicer
Normal user
Posts: 34
Joined: 01 Jul 2019, 16:40

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

#14 Post by spicer » 18 Aug 2019, 07:59

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests