Switch MQTT entity behaves oddly

I’ve got several Sonoff S26s flashed with Tasmota. I move them around a bit and am trying to sort out my xmas lights. I had a power cut today and one of them lost its setting so I re-did them but got the IP wrong such that it conflicted with another of the Sonoffs. The switches started behaving oddly and I’ve tracked down the IP conflict and put it right. But things still aren’t quite sorted!

I may have other problems but for now I can’t solve this one.

When I put the corrected Sonoff switch into an Entities card, it thinks the switch is off when it is on. So when I press the switch it goes through the motions of turning the thing on but after a second it goes back to the off position. The Icon remains blue. The switch itself stays on.

Looking at the MQTT messages in MQTT Explorer, I can see the command cmd/socket5/POWER on and the response stat/socket5/RESULT {"POWER":"ON} flashing when I press the switch. So that looks OK but the Entities card isn’t seeing it!

Now when I instead, press on the name to open up the switch dialogue box (DB) and then press that switch, the DB switch stays on and turns yellow and the Sonoff switch stays on. When I press it again both turn off as they should, but the label above the switch still says On!

I’ve been pulling my hair out for 3 hours now trying to fix this and I swear the behaviour is a bit erratic in that it might change from how I described but never working as it used to.

Help please.

That happen whenyou going the the IP Address of the tasmota Sonoff does it trun om/off do on is on and off is off

I seem to have it all sorted now.

Out of the 7 S26s I have, following a power outage (I was having solar panels fitted and they drilled through a mains cable that was routed above the rafters!),
qty 3 S26s lost their settings. In the end I completely changed the Host name and Topic but put them back to the fixed IP they had originally (apart form temporarily getting one wrong; and duplicated!). I then had to go through all the dashboards and automations to make sure they were still ok. It was a re-learning experience.

Thanks.