Switch Turning Lights On after Unavailable

What is your switch configuration? It’s most likely you have retain set in the broker and you need to clear that - but if your switch is set to retain: true it will keep doing that. It’s easily solved.

this is from the snippet above:

I tried to follow [The Hook Up]'s suggestions

So then you must have a retain setting in the broker that you need to get rid of. Use MQTT Explorer and you can see what is in the broker and can delete old messages. (You can actually delete everything as it will come back when the sonoff publishes to the broker again)