Lights turns on itself - Sonoff T1

I’m using Openhab 2.3 on x64 Linux Ubuntu. I don’t know where to start to indagate: Tasmota firmware, Openhab, Mosquitto or something else. I turn off the light and after non predictable time, the light turns itself on.

/etc/mosquitto/mosquitto.conf

pid_file /var/run/mosquitto.pid
persistence false
log_dest file /var/log/mosquitto/mosquitto.log
allow_anonymous false
password_file /etc/mosquitto/passwd

/var/lib/openhab2/openhab2/services/mqtt.cfg

openhab.url=tcp://localhost:1883
openhab.user=myuser
openhab.pwd=mypwd
openhab.qos=1
openhab.retain=true
openhab.async=false

/var/lib/openhab2/openhab2/services/influxdb.cfg

url=http://127.0.0.1:8086
user=openhab
password=mypwd
db=openhab_db
retentionPolicy=autogen

Log from sonoff console

18:33:06 MQT: tele/sonoff-touch-cameretta/STATE = {"Time":"2018-06-14T18:33:06","Uptime":25,"Vcc":3.108,"POWER":"OFF","Wifi":{"AP":1,"SSId":"MYWIFI","RSSI":68,"APMac":"60:38:E0:B8:E4:71"}}
18:34:05 MQT: stat/sonoff-touch-cameretta/RESULT = {"POWER":"ON"}
18:34:05 MQT: stat/sonoff-touch-cameretta/POWER = ON
18:35:04 MQT: Attempting connection...
18:35:04 MQT: Connected
18:35:05 MQT: tele/sonoff-touch-cameretta/LWT = Online (retained)
18:35:05 MQT: cmnd/sonoff-touch-cameretta/POWER = 
18:35:05 MQT: stat/sonoff-touch-cameretta/RESULT = {"POWER":"OFF"}
18:35:05 MQT: stat/sonoff-touch-cameretta/POWER = OFF
18:35:11 MQT: stat/sonoff-touch-cameretta/RESULT = {"POWER":"ON"}
18:35:11 MQT: stat/sonoff-touch-cameretta/POWER = ON
18:36:49 CMD: PowerOnState
18:36:49 MQT: stat/sonoff-touch-cameretta/RESULT = {"PowerOnState":3}

/var/lib/openhab2/openhab2/persistence/influxdb.persist

Strategies {
    everyMinute : "0 * * * * ?"
    everyHour   : "0 0 * * * ?"
    everyDay    : "0 0 0 * * ?"
}

Items {
  gPersistence*   :
  gPersistence1d*   : strategy = everyDay, restoreOnStartup
  gPersistence1h*   : strategy = everyHour, restoreOnStartup
  gPersistence1m*   : strategy = everyMinute, restoreOnStartup
  gPersistence5m*   : strategy = every5Minutes, restoreOnStartup
  gPersistenceChange*  : strategy = everyChange, restoreOnStartup
}

add also the Item definition.

also: any relevant entries from openhab.log & events.log

I don’t see anything wrong with the configs that you already posted.
There is a small mistake in your influxdb.persist. The first Items line (gPersistence* :) has no strategy defined.

Thanks. gPersistence fixed.

items/main.items

Group           Home                           "Casa"                    <house>

Group           Ingresso                      "Ingresso"                 <frontdoor>        (Home)
Group           Lavanderia                    "Lavanderia"               <washingmachine>   (Home)
Group           Bagno                         "Bagno"                    <toilet>           (Home)
Group           Balcone                       "Balcone"                                     (Home)
Group           Camera_letto                  "Camera da Letto"          <bedroom>          (Home)
Group           Corridoio_ingresso            "Corridio ingresso"        <corridor>         (Home)
Group           Garage                        "Garage"                   <garage>           (Home)
Group           Cucina                        "Cucina"                   <kitchen>          (Home)
Group           Soggiorno                     "Soggiorno"                <parents_2_4>      (Home)
Group           Cameretta                     "Cameretta"                <bedroom>          (Home)
Group           Corridoio                     "Corridoio"                <corridor>         (Home)

Switch          Ingresso_Light                "Luce"                     <light>            (Ingresso, gLight)         [ "Lighting" ]          { mqtt=">[openhab:cmnd/sonoff-touch-ingresso/POWER:command:*:default],<[openhab:stat/sonoff-touch-ingresso/POWER:state:default]" }
Switch          Lavanderia_Light              "Luci lavanderia"          <light>            (Lavanderia, gLight)       [ "Lighting" ]          { mqtt=">[openhab:cmnd/sonoff-touch-lavanderia/POWER:command:*:default],<[openhab:stat/sonoff-touch-lavanderia/POWER:state:default]" }
Switch          Lavanderia_Power              "Lavatrice"                <washingmachine_2> (Lavanderia      )       [ "Switchable" ]          { mqtt=">[openhab:cmnd/sonoff-pow-lavatrice/POWER:command:*:default],<[openhab:stat/sonoff-pow-lavatrice/POWER:state:default]" }
Switch          Bagno_Light                   "Luci bagno"               <light>            (Bagno, gLight)            [ "Lighting" ]          { mqtt=">[openhab:cmnd/sonoff-touch-bagno/POWER:command:*:default],<[openhab:stat/sonoff-touch-bagno/POWER:state:default]" }
Rollershutter   Bagno_Shutter                 "Persiana [%d %%]"         <rollershutter>    (Bagno, gShutter)                                  { channel="zwave:device:efddf849:node2:blinds_control" }
Switch          Balcone_Light                 "Luci balcone sinistra"    <light>            (Balcone, gLight)          [ "Lighting" ]          { mqtt=">[openhab:cmnd/sonoff-basic-balcone-salone/POWER:command:*:default],<[openhab:stat/sonoff-basic-balcone-salone/POWER:state:default]" }
Switch          Balcone_Light_1               "Luci balcone destra"      <light>            (Balcone, gLight)          [ "Lighting" ]          { mqtt=">[openhab:cmnd/sonoff-basic-balcone-camera-lett/POWER:command:*:default],<[openhab:stat/sonoff-basic-balcone-camera-lett/POWER:state:default]" }
Switch          Camera_letto_Light            "Luci camera da letto"     <light>            (Camera_letto, gLight)     [ "Lighting" ]          { mqtt=">[openhab:cmnd/sonoff-touch-camera-letto/POWER1:command:*:default],<[openhab:stat/sonoff-touch-camera-letto/POWER1:state:default]" }
Switch          Camera_letto_Light_3          "Led camera da letto"      <light>            (Camera_letto, gLight)     [ "Lighting" ]          { channel="wifiled:wifiled:6001949113D8:power" }
Switch          Camera_letto_Light_2                                                                                                           { channel="wifiled:wifiled:600194955ED2:power" }
Switch          Camera_letto_Light_4          "Specchio camera da letto" <contact>          (Camera_letto, gLight)     [ "Lighting" ]          { mqtt=">[openhab:cmnd/sonoff-touch-camera-letto/POWER2:command:*:default],<[openhab:stat/sonoff-touch-camera-letto/POWER2:state:default]" }
//Color         Camera_letto_Color_3          "Colore led destra"        <colorlight>       (Camera_letto, gLight)                             { channel="wifiled:wifiled:6001949113D8:color" }
//Color         Camera_letto_Color_2          "Colore led sinistra"      <colorlight>       (Camera_letto, gLight)                             { channel="wifiled:wifiled:600194955ED2:color" }
Rollershutter   Camera_letto_Shutter          "Persiana [%d %%]"         <rollershutter>    (Camera_letto, gShutter)                           { channel="zwave:device:efddf849:node3:blinds_control" }
Switch          Corridoio_Light               "Luci corridoio"           <light>            (Corridoio, gLight)        [ "Lighting" ]          { mqtt=">[openhab:cmnd/sonoff-touch-corridoio-specchio/POWER1:command:*:default],<[openhab:stat/sonoff-touch-corridoio-specchio/POWER1:state:default]" }
Switch          Corridoio_Light_1                                                                                                              { mqtt=">[openhab:cmnd/sonoff-touch-corridoio-specchio/POWER2:command:*:default],<[openhab:stat/sonoff-touch-corridoio-specchio/POWER2:state:default]" }
Switch          Corridoio_Light_2                                                                                                              { mqtt=">[openhab:cmnd/sonoff-touch-corridoio-specchio/POWER3:command:*:default],<[openhab:stat/sonoff-touch-corridoio-specchio/POWER3:state:default]" }
//Switch          Garage_Light                  "Luce"                     <light>            (Garage, gLight)             [ "Lighting" ]          {channel=""}
Switch          Cucina_Light                  "Luci cucina"              <light>            (Cucina, gLight)           [ "Lighting" ]          { mqtt=">[openhab:cmnd/sonoff-touch-cucina/POWER1:command:*:default],<[openhab:stat/sonoff-touch-cucina/POWER1:state:default]" }
Rollershutter   Cucina_Shutter                "Persiana [%d %%]"         <rollershutter>    (Cucina, gShutter)                                 { channel="zwave:device:efddf849:node5:blinds_control" }
Switch          Cucina_Power                  "Lavastoviglie"            <dryer>            (Cucina)                   [ "Switchable" ]        { mqtt=">[openhab:cmnd/sonoff-pow-lavastoviglie/POWER:command:*:default],<[openhab:stat/sonoff-pow-lavastoviglie/POWER:state:default]" }
Switch          Cucina_Power_2                "Forno"                    <kitchen>          (Cucina)                   [ "Switchable" ]        { mqtt=">[openhab:cmnd/sonoff-pow-forni/POWER:command:*:default],<[openhab:stat/sonoff-pow-forni/POWER:state:default]" }
Switch          Cucina_Power_3                "Frigo"                    <poweroutlet>      (Cucina)                                           { mqtt=">[openhab:cmnd/sonoff-pow-frigo/POWER:command:*:default],<[openhab:stat/sonoff-pow-frigo/POWER:state:default]" }
Switch          Soggiorno_Light_4             "Luci soggiorno"           <light>            (Soggiorno, gLight)        [ "Lighting" ]          { mqtt=">[openhab:cmnd/sonoff-touch-cucina/POWER2:command:*:default],<[openhab:stat/sonoff-touch-cucina/POWER2:state:default]" }
Switch          Soggiorno_Light_3             "Luci isola"               <light>            (Soggiorno, gLight)        [ "Lighting" ]          { mqtt=">[openhab:cmnd/sonoff-touch-cucina/POWER3:command:*:default],<[openhab:stat/sonoff-touch-cucina/POWER3:state:default]" }
Switch          Soggiorno_Light_2             "Luci muretto"             <light>            (Soggiorno, gLight)        [ "Lighting" ]          { mqtt=">[openhab:cmnd/sonoff-basic-muretto/POWER:command:*:default],<[openhab:stat/sonoff-basic-muretto/POWER:state:default]" }
Switch          Soggiorno_Light               "Led soggiorno"            <light>            (Soggiorno, gLight)        [ "Lighting" ]          { mqtt=">[openhab:cmnd/sonoff-basic-led-salone/POWER:command:*:default],<[openhab:stat/sonoff-basic-led-salone/POWER:state:default]" }
Rollershutter   Soggiorno_Shutter             "Persiana [%d %%]"         <rollershutter>    (Soggiorno, gShutter)                              { channel="zwave:device:efddf849:node4:blinds_control" }
Number          Soggiorno_Temp                "Temperatura [%.1f °C]"    <temperature>      (Soggiorno, gPersistenceChange)                    { mqtt="<[openhab:tele/sonoff-th-caldaia/SENSOR:state:JSONPATH($.SI7021.Temperature)]" }
Number          Soggiorno_Umidita              "Umidità [%.1f %%]"       <humidity>         (Soggiorno, gPersistenceChange)                    { mqtt="<[openhab:tele/sonoff-th-caldaia/SENSOR:state:JSONPATH($.SI7021.Humidity)]" }
Switch          Cameretta_Light               "Luci cameretta"           <light>            (Cameretta, gLight)        [ "Lighting" ]          { mqtt=">[openhab:cmnd/sonoff-touch-cameretta/POWER:command:*:default],<[openhab:stat/sonoff-touch-cameretta/POWER:state:default]" }
Rollershutter   Cameretta_Shutter             "Persiana [%d %%]"         <rollershutter>    (Cameretta, gShutter)                              { channel="zwave:device:efddf849:node6:blinds_control" }
Switch          Corridoio_ingresso_Light      "Luci corridoio ingresso"  <light>            (Corridoio, gLight)        [ "Lighting" ]          { mqtt=">[openhab:cmnd/sonoff-touch-corridoio-ingresso/POWER1:command:*:default],<[openhab:stat/sonoff-touch-corridoio-ingresso/POWER1:state:default]" }
Switch          Corridoio_ingresso_Light_1                                                                                                     { mqtt=">[openhab:cmnd/sonoff-touch-corridoio-ingresso/POWER2:command:*:default],<[openhab:stat/sonoff-touch-corridoio-ingresso/POWER2:state:default]" }
Switch          Corridoio_ingresso_Light_2                                                                                                     { mqtt=">[openhab:cmnd/sonoff-touch-corridoio-ingresso/POWER3:command:*:default],<[openhab:stat/sonoff-touch-corridoio-ingresso/POWER3:state:default]" }
Switch          Campanello                    "Campanello"                                                                                     { mqtt=">[openhab:cmnd/sonoff-basic-campanello/POWER:command:*:default],<[openhab:stat/sonoff-basic-campanello/POWER:state:default]" }
Switch          Corridoio_ingresso2_Light                                                                                                      { mqtt=">[openhab:cmnd/sonoff-touch-corridoio-ingresso2/POWER1:command:*:default],<[openhab:stat/sonoff-touch-corridoio-ingresso2/POWER1:state:default]" }
Switch          Corridoio_ingresso2_Light_1                                                                                                    { mqtt=">[openhab:cmnd/sonoff-touch-corridoio-ingresso2/POWER2:command:*:default],<[openhab:stat/sonoff-touch-corridoio-ingresso2/POWER2:state:default]" }
Switch          Corridoio_ingresso2_Light_2                                                                                                    { mqtt=">[openhab:cmnd/sonoff-touch-corridoio-ingresso2/POWER3:command:*:default],<[openhab:stat/sonoff-touch-corridoio-ingresso2/POWER3:state:default]" }

// Consumi
Number          Lavanderia_Power_W                                                (gPower)                                           { mqtt="<[openhab:tele/sonoff-pow-lavatrice/SENSOR:state:JSONPATH($.ENERGY.Power)]" }
Number          Cucina_Power_W                                                    (gPower)                                           { mqtt="<[openhab:tele/sonoff-pow-lavastoviglie/SENSOR:state:JSONPATH($.ENERGY.Power)]" }
Number          Cucina_Power_2_W                                                  (gPower)                                           { mqtt="<[openhab:tele/sonoff-pow-forni/SENSOR:state:JSONPATH($.ENERGY.Power)]" }
Number          Cucina_Power_3_W                                                  (gPower)                                           { mqtt="<[openhab:tele/sonoff-pow-frigo/SENSOR:state:JSONPATH($.ENERGY.Power)]" }
Number          Soggiorno_Power_W                                                 (gPower)                                           { mqtt="<[openhab:tele/sonoff-pow-condizionatore/SENSOR:state:JSONPATH($.ENERGY.Power)]" }

Group:Switch:OR(ON, OFF)           gLight     "Luce"          <light>           (Home, gPersistenceChange)
Group:Rollershutter:MAX            gShutter   "Persiana"      <rollershutter>   (Home, gPersistenceChange)
Group:Number:SUM                   gPower     "Elettricità"   <poweroutlet>     (Home, gPersistenceChange)


Group gPersistence       (Home)
Group gPersistence1m     (Home)
Group gPersistence5m     (Home)
Group gPersistence1h     (Home)
Group gPersistence1d     (Home)
Group gPersistenceChange (Home)

this happens with all sonoff related items?

Please show the output of the sonoff console for the commands SwitchMode and SwitchTopic

With sonoff touch. But I don’t know if it is a coincidence

07:23:16 MQT: stat/sonoff-touch-cucina/RESULT = {"SwitchMode1":0}
07:23:41 MQT: stat/sonoff-touch-cucina/RESULT = {"SwitchTopic":"0"}

OK, IMHO These settings are correct.

What do you think about retain?

/var/lib/openhab2/openhab2/services/mqtt.cfg

openhab.url=tcp://localhost:1883
openhab.user=myuser
openhab.pwd=mypwd
openhab.qos=1
openhab.retain=true <----- RETAIN
openhab.async=false

@lamero , you didn’t post those.

Yes I know, but the problem is random. I can’t post a 1 day log. Anyway there is only the switch that goes from OFF to ON

If you could post the actual part of when it has happened.

Sure. When it happens i will try to post the log. Thanks for your support for now