Calling MQTT.publish, but no message seems to be sent

Hi

I am fairly new to hassio, and a couple of days started over again with a scratch install in order to learn more from setting up the system again. This time around I am struggling with MQTT. I have installed the mosquitto plugin and I am able to publish messages and control a Sonoff Tasmota switch when calling mosquitto_pub from SSH

mosquitto_pub -t 'cmnd/sonoff/POWER' -m ON -h 192.168.1.17 -u mosquittouser -P mosquittopw

mosquitto_sub -v -t '#' -h 192.168.1.1.17 -u mosquittouser -P mosquittopw

tele/sonoff/LWT Online
cmnd/sonoff/POWER OFF
stat/sonoff/RESULT {"POWER":"OFF"}
stat/sonoff/POWER OFF

I can also see the message in the bus using mosquitto_sub.

However, when I try to call mqtt.publish from either hassio services or MQTT developer tools nothing happens and I can see nothing on the bus in SSH:

Service:
mqtt.publish
Service Data:
{“topic”:“cmnd/sonoff/POWER”,“payload”:“OFF”}

MQTT Publish a packet
topic:
cmnd/sonoff/POWER
Payload
OFF

My configuration.yaml looks like this:
https://hastebin.com/sayuyowaju.makefile

H/W: Raspberry Pi 3
OS: Hass.io
HA Version: 0.87.1
Mosquitto version: 1.4.15

Any help greatly appreciated!

I have a hypothesis that when I call mqtt.publish from inside hassio I am somehow calling the built in mqtt service instead of mosquitto. Is there a way I can check this?

Also, here is my mosquitto configuration:
https://hastebin.com/bifawacego.json

(Posting using hastebin as I can’t find out how to format more than one line of text as code)

Found some more information. If my call from hassio dev tools is in fact going to the built in mqtt broker instead of mosquitto, I should be able to view the messages on the bus for that broker using hbmqtt_sub. I will try this when I’m back home tonight.

Ok, I found the solution:
There was an entry in core.config_entries referring to mqtt. Once I removed that the calls from hassio dev tools are now going to the mosquitto mqtt bus. Not sure how that entry got there, but I assume it was due to an initial attempt to configure mqtt. If anyone can enlighten me it would be greatly appreciated.

For future reference: The clue that got me to check the core.config_entries file in config/.storage was a message in the log

019-02-21 16:53:11 WARNING (MainThread) [homeassistant.components.mqtt] Data in your config entry is going to override your configuration.yaml: {‘broker’: ‘192.168.1.17’, ‘discovery’: False, ‘password’: ‘’, ‘port’: 1883, ‘username’: ‘’}

That brought me to this thread:

I backed up the file before attempting to change it. Once I had removed the entry referring to mqtt everything, and restarted hassio, mqtt worked fine even from the dev tools. Furhter, a new entry was automatically created again, this time with the correct data

{
            "connection_class": "local_push",
            "data": {},
            "domain": "mqtt",
            "entry_id": "97b22e6606da4bc1b165ff71c2fda544",
            "source": "import",
            "title": "configuration.yaml",
            "version": 1
        }

I see in the last post of the above mentioned thread that @DavidFW1960 is warning against this. If exiting core.config_entries directly is not safe, is there a safe procedure for this?

Hi! I have a similar problem. I just can’t get the hassio MQTT addon to work and not even with Developer tools. SSH terminal work fine. Starts to sound like a bug. Where can you find that core.config_entries file? Will look the logs next week.