Tasmota / Sonoff continiously changed from Online to Offline

  • Platform information:
    • Hardware: Raspberry Pi 3 Model B Rev 1.2
    • OS: Raspbian GNU/Linux 8 (jessie) Kernel = Linux 4.9.35-v7+
    • Java Runtime Environment: how can I read out this information?
    • openHAB version: openHAB 2.4.0-1 (Release Build)
  • Issue of the topic:
    I have 6 Sonoff producs in use (4xS20, 2x 4chpro) all flashed with Tasmota FW6.4.1. On OH is installed the MQTT binding 2.4.
    The general funtion is OK: switch ON/OFF and Temperature read out with DS18S20 works fine an stabel.
    For some of my sonnoff devices I get in the logfile sveral and continiously Online / Offline messages e.g.:
2019-02-12 20:17:20.843 [vent.ItemStateChangedEvent] - Wohnzimmer_Leselampe_Reachable changed from Online to Offline
2019-02-12 20:17:21.370 [vent.ItemStateChangedEvent] - Wohnzimmer_Leselampe_Reachable changed from Offline to Online
2019-02-12 20:18:33.648 [vent.ItemStateChangedEvent] - UV_Einfahrt_Switch01_Reachable changed from Online to Offline

here is a snippet of my mqtt.things:

Bridge mqtt:broker:mosquitto "Mosquitto" [ host="localhost", port=1883, secure=false, username="***********", password="***********", clientID="openhab" ]
    Thing mqtt:topic:sonoff_S20_00 "Wohnzimmer Leselampe" @ "Wohnzimmer" {
            Type switch : POWER     "Power"         [stateTopic="stat/SmHo-S20-00/POWER", commandTopic="cmnd/SmHo-S20-00/POWER"]
            Type number : RSSI      "WiFi RSSI"     [stateTopic="tele/SmHo-S20-00/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]
            Type string : UPTIME    "Uptime"        [stateTopic="tele/SmHo-S20-00/STATE", transformationPattern="JSONPATH:$.Uptime"]
            Type string : REACH     "Reachable"     [stateTopic="tele/SmHo-S20-00/LWT"]
            Type string : VCC       "Vcc"           [stateTopic="tele/SmHo-S20-00/STATE", transformationPattern="JSONPATH:$.Vcc"]
            Type string : IP        "IP"            [stateTopic="tele/SmHo-S20-00/INFO2", transformationPattern="JSONPATH:$.IPAddress"]
            Type string : HOST      "Hostname"      [stateTopic="tele/SmHo-S20-00/INFO2", transformationPattern="JSONPATH:$.Hostname"]
            Type string : SW        "SW-Version"    [stateTopic="tele/SmHo-S20-00/INFO1", transformationPattern="JSONPATH:$.Version"]
            Type string : RESET     "Reset"         [stateTopic="stat/SmHo-S20-00/RESTART",commandTopic="cmnd/SmHo-S20-00/RESTART"]
    } ....

What can be the reason for this continuously online / offline messages?

Gratings Holgus

After modifying the mqtt things file have you restarted OH? If so please post the items file to review and compare with your things file.

I also experienced online/offline issues with 2 of my 10 devices… for one I still have no clue for the reason.
did you experiment/change the sleep setting on the sonoff device?
one of my sonoffs was positioned too close to a subwoofer, just moved the sonoff a bit and problem was gone…
I inclued all IP devices in a gHeartbeat group, if a devices is offline for longer than 10min I get a notification…

I had the same issues. Reason was a buggy Espressif core (2.4.x) used for the Tasmota build. I installed the 6.4.1 that was based on core 2.3 provided for that reason.
Details may be found at https://github.com/arendst/Sonoff-Tasmota/wiki/Troubleshooting#wifi-issues-arduino-core-versions-and-expressif-sdk
Meanwhile newer beta-builds based on core 2.5 seem to work as well but I have not tried them.


I had this issue after upgrading to tasmota 6.4.1
Going back to 6.4.0 is more stable

  • chagned the Tasmota FW from the Thing “sonoff_S20_00” from 6.4.1 to FW 6.4.0
  • power cycle of sonoff device “sonoff_S20_00”
  • restarted OH
  • power cycle of RPI
  • I not oblivious experimented or changed something in the sleep settings… I don’t now how?

All above have no impact on the issue:

2019-02-13 19:20:30.754 [vent.ItemStateChangedEvent] - Wohnzimmer_Leselampe_Reachable changed from Online to Offline
2019-02-13 19:20:30.876 [vent.ItemStateChangedEvent] - UV_Einfahrt_Switch01_Reachable changed from Online to Offline
2019-02-13 19:20:31.133 [vent.ItemStateChangedEvent] - Wohnzimmer_Leselampe_Reachable changed from Offline to Online

Here the snippet of my Items:

Switch Wohnzimmer_Leselampe             "Leselampe [MAP(de.map):%s]"    (gLicht) ["Lighting"]       {channel="mqtt:topic:sonoff_S20_00:POWER"}
Number Wohnzimmer_Leselampe_RSSI        "WiFi RSSI: [%d %%]"                                        {channel="mqtt:topic:sonoff_S20_00:RSSI"}
String Wohnzimmer_Leselampe_Uptime      "Aktiv seit: [%s]"                                          {channel="mqtt:topic:sonoff_S20_00:UPTIME"}
String Wohnzimmer_Leselampe_Reachable   "Status: [%s]"                                              {channel="mqtt:topic:sonoff_S20_00:REACH"}
String Wohnzimmer_Leselampe_VCC         "Vcc:[%s V]"                                                {channel="mqtt:topic:sonoff_S20_00:VCC"}                                        
String Wohnzimmer_Leselampe_IP          "IP:[%s]"                                                   {channel="mqtt:topic:sonoff_S20_00:IP"}
String Wohnzimmer_Leselampe_Hostname    "Hostname:[%s]"                                             {channel="mqtt:topic:sonoff_S20_00:HOST"}
String Wohnzimmer_Leselampe_SW          "SW-Version:[%s]"                                           {channel="mqtt:topic:sonoff_S20_00:SW"}
String Wohnzimmer_Leselampe_RESET       "Reset"                                                     {channel="mqtt:topic:sonoff_S20_00:RESET"}

Has anyone an idea how I can solve these continuous online offline messages on some Sonoff / Tasmota devices?

Move them closer to your WiFi hub. If it stops then you will need a beefier router

Not sure that its anything to do with the distance from the WiFi router - I have 25 SonOff devices (a mixture of Basics, POWs, 4CHs and Slamphers) and also have this issue. I’m not totally convinced but believe it might be down to some of the units not being manufactured to the same ‘standard’ as the others??? I have a couple of devices that appear to not operate correctly if they have anything higher than Tasmota 5.14 on them. For now have just left those on the lower version as they operate correctly for me in my set-up.

what does “Info” on the Tasmota web-menu tell you with regards to the core/sdk version ?

As I said, my SonOffs worked fine, then I upgraded to 6.4.1 and had issues. Then I “upgraded” to the alternative builds where 6.4.1 is based on the Espressif core 2.3 and all was good after that.


25 connected devices on one router. How many can your router handle? They don’t have the same capacity.

  • I changed the place of the sonoff with online / offline issue to a place were I had a sonoff device without this online / offline issue. But I have the same result. The RSSI is now 100% before I had 73%.
  • Another sonoff device has only 12%RSSI and works without these online offline issue. So I guess that has nothing to to with distances.
  • I read out the Core-/SDK-Version on both I have the same (2_4_2/2.2.1(cfd48f3))

If there is a core/SDK issue why there are differences? But nevertheless I will try it out.
I will follow up the note from @mdillman :
[https://github.com/arendst/Sonoff-Tasmota/wiki/Troubleshooting#wifi-issues-arduino-core-versions-and-expressif-sdk 2]
I will try to invest more time to understand how I can change the Core-/SDK-Version.
If I understand correctly I cannot update the core/SDK with OTA?
@mdillman : What did you mean with alternative build? Is in this alternative *.bin the 2.3 Core-/SDK-Version?

Just do an OTA upgrade with a 6.4.1 that is built using 2.3.0 SDK. Use the following OTA URL: http://thehackbox.org/tasmota/release/020300/sonoff-DE.bin (for a German FW, you can find other languages at this site as well)

It seems that the online offline issue is gone. Since 20 minutes no failures…

  1. I have installed the sonoff-minimal.bin with SDK 2.3.0 due to error messages
  2. Just do an OTA upgrade with a 6.4.1 that is built using 2.3.0 SDK. Use the following OTA URL: http://thehackbox.org/tasmota/release/020300/sonoff-DE.bin

On one sonoff device I use the 2_5_0 SDK with success, no online / offline messages.

If I get no online / offline messages in the next days I will set this ticket to solve.
All, thanks you very much for your help, espacely for @mdillman