Sonoff Espurna firmware state

I have flashed my sonoff with Tinkermancat’s Espurna firmware. https://bitbucket.org/xoseperez/espurna/src/b8e6b4c8caab?at=master
The configuration I use can toggle the relay on and off from home assistant just fine but if I toggle the relay from it’s own webpage or by pressing the button on the relay itself the change is not reported back to the home assistant states page. I’m new to this and any help would be appreciated. The firmware reports it’s state back to the same topic. I’m using Mosca as my MQTT broker. I’m running this in Windows with python installed. My sonoff is subscribed to /home/sonoff and my configuraton.yaml looks like this:

switch:
platform: mqtt
name: “LRL1”
state_topic: “home/sonoff/relay”
command_topic: “home/sonoff/relay”
payload_on: “1”
payload_off: “0”
qos: 1
retain: true

I’m not sure if that will work as you expected. If HA subscribes to the topic, it will get the state updated from the initial command, not the response from the device, which is what you really want to happen. It would be more accurate if you can get the report to be published on a separate topic.

However, it should still actually work.

I assume the extra ‘/’ at the beginning is a typo, but if not, it will not match the topic expected by your configuration.yaml, and so won’t trigger an update. It may explain your symptoms, as HA is being updated by its own command, but ignoring the state sent by the Sonoff.

If not I suggest you subscribe to your broker with a tool that prints out every topic, to see what your sonoff is actually publishing to. I usually use mosquitto_sub, but I expect mosca has an equivalent that you have already installed.