MQTT plug switching off randomly

Hi
Trying to sort out MQTT switch that keeps turning off. Its a Medion smart plug with Tasmota 8.2.0.6 loaded, setoption19 on and this randomly triggers power off:

08:40:05 WIF: Checking connection...
08:40:21 MQT: Received Topic "cmnd/medion1/POWER", Data Size 2, Data "ON"
08:40:21 SRC: MQTT
08:40:21 CMD: Group 0, Index 1, Command "POWER", Data "ON"
08:40:21 MQT: tele/medion1/STATE = {"Time":"2020-05-06T08:40:21","Uptime":"0T00:56:06","UptimeSec":3366,"Heap":16,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"POWER":"ON","Wifi":{"AP":1,"SSId":"Telstra11CE_2GEXT","BSSId":"A0:63:91:DB:EF:2B","Channel":10,"RSSI":100,"Signal":-33,"LinkCount":1,"Downtime":"0T00:00:03"}}
08:40:21 MQT: stat/medion1/RESULT = {"POWER":"ON"}
08:40:21 MQT: stat/medion1/POWER = ON (retained)
08:40:21 CFG: Saved to flash at F8, Count 100, Bytes 4096
08:40:23 MQT: tele/medion1/HASS_STATE = {"Version":"8.2.0.6(fb2b29e-tasmota)","BuildDateTime":"2020-05-05T10:01:20","Core":"2_7_0","SDK":"2.2.2-dev(38a443e)","Module":"Medion","RestartReason":"Software/System restart","Uptime":"0T00:56:08","WiFi LinkCount":1,"WiFi Downtime":"0T00:00:03","MqttCount":1,"BootCount":7,"SaveCount":100,"IPAddress":"192.168.0.130","RSSI":"100","LoadAvg":19}
08:40:25 WIF: Checking connection...
08:40:45 WIF: Checking connection...
08:41:05 WIF: Checking connection...
08:41:25 WIF: Checking connection...
08:41:45 WIF: Checking connection...
08:42:05 WIF: Checking connection...
08:42:06 APP: Button1 immediate
08:42:06 MQT: stat/medion1/BUTTON1T = {"TRIG":""}
08:42:06 SRC: Button
08:42:06 MQT: tele/medion1/STATE = {"Time":"2020-05-06T08:42:06","Uptime":"0T00:57:51","UptimeSec":3471,"Heap":16,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"POWER":"OFF","Wifi":{"AP":1,"SSId":"Telstra11CE_2GEXT","BSSId":"A0:63:91:DB:EF:2B","Channel":10,"RSSI":100,"Signal":-32,"LinkCount":1,"Downtime":"0T00:00:03"}}
08:42:06 MQT: stat/medion1/RESULT = {"POWER":"OFF"}
08:42:06 MQT: stat/medion1/POWER = OFF (retained)
08:42:06 CFG: Saved to flash at F7, Count 101, Bytes 4096
08:42:25 WIF: Checking connection...

Tasmota status:

08:49:41 CMD: status 0
08:49:41 SRC: WebConsole from 192.168.0.81
08:49:41 CMD: Group 0, Index 1, Command "STATUS", Data "0"
08:49:41 MQT: stat/medion1/STATUS = {"Status":{"Module":0,"FriendlyName":["medion1"],"Topic":"medion1","ButtonTopic":"0","Power":0,"PowerOnState":3,"LedState":1,"LedMask":"FFFF","SaveData":1,"SaveState":1,"SwitchTopic":"0","SwitchMode":[0,0,0,0,0,0,0,0],"ButtonRetain":0,"SwitchRetain":0,"SensorRetain":0,"PowerRetain":1}}
08:49:41 MQT: stat/medion1/STATUS1 = {"StatusPRM":{"Baudrate":115200,"SerialConfig":"8N1","GroupTopic":"tasmotas","OtaUrl":"http://thehackbox.org/tasmota/release/tasmota.bin","RestartReason":"Software/System restart","Uptime":"0T01:05:26","StartupUTC":"2020-05-05T21:44:15","Sleep":50,"CfgHolder":4617,"BootCount":7,"BCResetTime":"2020-05-05T10:10:47","SaveCount":101,"SaveAddress":"F7000"}}
08:49:41 MQT: stat/medion1/STATUS2 = {"StatusFWR":{"Version":"8.2.0.6(fb2b29e-tasmota)","BuildDateTime":"2020-05-05T10:01:20","Boot":4,"Core":"2_7_0","SDK":"2.2.2-dev(38a443e)","Hardware":"ESP8285","CR":"409/699"}}
08:49:41 MQT: stat/medion1/STATUS3 = {"StatusLOG":{"SerialLog":4,"WebLog":4,"MqttLog":4,"SysLog":4,"LogHost":"192.168.0.1","LogPort":514,"SSId":["Telstra11CE_2GEXT","Cecil"],"TelePeriod":300,"Resolution":"558180C0","SetOption":["000AA029","2805C8000100060000005A00000000000000","00000200","00000000"]}}
08:49:41 MQT: stat/medion1/STATUS4 = {"StatusMEM":{"ProgramSize":585,"Free":416,"Heap":22,"ProgramFlashSize":1024,"FlashSize":1024,"FlashChipId":"144051","FlashMode":3,"Features":["00000809","8FDAE797","043683A0","000000CD","010013C0","C000F981","00000024"],"Drivers":"1,2,3,4,5,6,7,8,9,10,12,16,18,19,20,21,22,24,26,27,29,30,35,37","Sensors":"1,2,3,4,5,6"}}
08:49:41 MQT: stat/medion1/STATUS5 = {"StatusNET":{"Hostname":"medion1-1129","IPAddress":"192.168.0.130","Gateway":"192.168.0.1","Subnetmask":"255.255.255.0","DNSServer":"192.168.0.3","Mac":"84:0D:8E:4C:84:69","Webserver":2,"WifiConfig":4,"WifiPower":17.0}}
08:49:41 MQT: stat/medion1/STATUS6 = {"StatusMQT":{"MqttHost":"192.168.0.17","MqttPort":1883,"MqttClientMask":"DVES_%06X","MqttClient":"DVES_4C8469","MqttUser":"airoguard","MqttCount":1,"MAX_PACKET_SIZE":1200,"KEEPALIVE":30}}
08:49:41 MQT: stat/medion1/STATUS7 = {"StatusTIM":{"UTC":"2020-05-05T22:49:41","Local":"2020-05-06T08:49:41","StartDST":"2020-10-04T03:00:00","EndDST":"2020-04-05T02:00:00","Timezone":99,"Sunrise":"14:20","Sunset":"05:13"}}
08:49:41 MQT: stat/medion1/STATUS9 = {"StatusPTH":{"PowerDelta":0,"PowerLow":0,"PowerHigh":0,"VoltageLow":0,"VoltageHigh":0,"CurrentLow":0,"CurrentHigh":0}}
08:49:41 MQT: stat/medion1/STATUS10 = {"StatusSNS":{"Time":"2020-05-06T08:49:41","ENERGY":{"TotalStartTime":"2020-05-05T10:10:47","Total":0.071,"Yesterday":0.000,"Today":0.071,"Power":0,"ApparentPower":0,"ReactivePower":0,"Factor":0.00,"Voltage":0,"Current":0.000}}}
08:49:41 MQT: stat/medion1/STATUS11 = {"StatusSTS":{"Time":"2020-05-06T08:49:41","Uptime":"0T01:05:26","UptimeSec":3926,"Heap":21,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"POWER":"OFF","Wifi":{"AP":1,"SSId":"Telstra11CE_2GEXT","BSSId":"A0:63:91:DB:EF:2B","Channel":10,"RSSI":100,"Signal":-37,"LinkCount":1,"Downtime":"0T00:00:03"}}}

I note that setoption19 on is not swapping prefix and topic in tasmota? Is this normal?

Is this faulty hardware or faulty config? This device is cheap and nasty.

Thanks
Rob

‘Breaking’ change in Tasmota 8.2

What are your retain setings (in tasmota and HA) ?

Francisp
Thanks for your help.
Originally I had the following:

#mqtt:
#  broker: 192.168.0.17
#  port: 1883
#  username: !secret mqtt_username
#  password: !secret mqtt_password
#  discovery: true
#  discovery_prefix: homeassistant

and

#    retain: false

in several MQTT switch yaml settings but now commented out due to discovery and new Integration.

I’ve tried the following commands in the Medion console but no change, still turning itself off randomly:

switchretain off
buttonretain on
buttonretain off
poweronstate 3
powerretain on

Thanks
Rob

Seems to have something to do with Button1 multi-press 1?

22:51:17 WIF: Checking connection...
22:51:25 MQT: Received Topic "cmnd/medion1/POWER", Data Size 2, Data "ON"
22:51:25 SRC: MQTT
22:51:25 CMD: Group 0, Index 1, Command "POWER", Data "ON"
22:51:25 MQT: tele/medion1/STATE = {"Time":"2020-05-06T22:51:25","Uptime":"0T00:36:41","UptimeSec":2201,"Heap":19,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":2,"POWER":"ON","Wifi":{"AP":1,"SSId":"Telstra11CE_2GEXT","BSSId":"A0:63:91:DB:EF:2B","Channel":10,"RSSI":100,"Signal":-34,"LinkCount":1,"Downtime":"0T00:00:03"}}
22:51:25 MQT: stat/medion1/RESULT = {"POWER":"ON"}
22:51:25 MQT: stat/medion1/POWER = ON (retained)
22:51:25 CFG: Saved to flash at F9, Count 187, Bytes 4096
22:51:37 WIF: Checking connection...
22:51:57 WIF: Checking connection...
22:52:17 WIF: Checking connection...
22:52:35 APP: Button1 multi-press 1
22:52:35 MQT: stat/medion1/BUTTON1T = {"TRIG":""}
22:52:35 SRC: Button
22:52:35 MQT: tele/medion1/STATE = {"Time":"2020-05-06T22:52:35","Uptime":"0T00:37:51","UptimeSec":2271,"Heap":21,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":2,"POWER":"OFF","Wifi":{"AP":1,"SSId":"Telstra11CE_2GEXT","BSSId":"A0:63:91:DB:EF:2B","Channel":10,"RSSI":100,"Signal":-34,"LinkCount":1,"Downtime":"0T00:00:03"}}
22:52:35 MQT: stat/medion1/RESULT = {"POWER":"OFF"}
22:52:35 MQT: stat/medion1/POWER = OFF (retained)
22:52:36 CFG: Saved to flash at F8, Count 188, Bytes 4096
22:52:37 WIF: Checking connection...