Proper mqtt server name on hassio

Ive been running hassio on an rpi2 for about a year. It worked fine until today when it failed to run the mqtt service giving a connection refused error. The python file specified the mqtt server as hassio.local. I changed it to its ip address and that error is gone. Now when I run the script I get:

The script code is:

import paho.mqtt.client as mqtt
from failedPythonBLE import turn1ON,turn1OFF,turn2ON,turn2OFF,turn3ON,turn3OFF

MQTT_PATH = "test_channel"

# The callback for when the client receives a CONNACK response from the server.
def on_connect(client, userdata, flags, rc):
    print("Connected with result code "+str(rc))

    # Subscribing in on_connect() means that if we lose the connection and
    # reconnect then subscriptions will be renewed.

# The callback for when a PUBLISH message is received from the server.
def on_message(client, userdata, msg):
    print(msg.topic+" "+str(msg.payload))
    # more callbacks, etc

    if str(msg.payload)=='01':
        print "letsGoBaby! Turn On Relay 1"
    elif str(msg.payload)=='02':
        print "Turn Off Relay 1"
    elif str(msg.payload)=="komp-on":
        print "Turn On Relay 2"
    elif str(msg.payload)=="komp-off":
        print "Turn Off Relay 2"
    elif str(msg.payload)=="sole-on":
        print "Turn On Relay 3"
    elif str(msg.payload)=="sole-off":
        print "Turn Off Relay 3"
    elif str(msg.payload)=='07':
        print "Turn On Relay 4"
    elif str(msg.payload)=='08':
        print "Turn Off Relay 4"

client = mqtt.Client()
client.on_connect = on_connect
client.on_message = on_message

client.connect(MQTT_SERVER, 1883, 60)

Ok i just noticed that if I run the mqtt service directly from Developer Tools on hassio, I get this message:

Im also unable to access the configurator in hassio, I get hassio refused to connect error with sad face. However I can ping hassio.local from my laptop. I also upgraded to .103 hassio and I still get that error.

Win laptop ?

Its macbook pro. I just updated the Configurator from the Updater to 4.2 and I have access again to the configurator. I went into configuration.yaml and changed mqtt broker from to which is the ip address. Now when I go to publish an mqtt msg, I dont get the error (i actually get no error but nothing else happens), but i also dont get the python file running which should run. If I run the python file manually everything runs fine, but the mqtt isnt firing the python which it used to do just fine before. It must be an mqtt issue.

I also noticed these orange and red warnings in the system log:

20-01-03 00:00:08 WARNING (MainThread) [hassio.dns] Can't write local resolv: [Errno 13] Permission denied: '/etc/resolv.conf'
20-01-03 00:01:28 WARNING (MainThread) [hassio.addons.validate] Unknown options username
20-01-03 00:01:28 WARNING (MainThread) [hassio.addons.validate] Unknown options password
20-01-03 00:01:28 WARNING (MainThread) [hassio.addons.validate] Unknown options ssl
20-01-03 00:01:28 WARNING (MainThread) [hassio.addons.validate] Unknown options certfile
20-01-03 00:01:28 WARNING (MainThread) [hassio.addons.validate] Unknown options keyfile
20-01-03 00:01:28 WARNING (MainThread) [hassio.addons.validate] Unknown options allowed_networks
20-01-03 00:01:28 WARNING (MainThread) [hassio.addons.validate] Unknown options banned_ips
20-01-03 00:01:28 WARNING (MainThread) [hassio.addons.validate] Unknown options banlimit
20-01-03 00:01:28 WARNING (MainThread) [hassio.addons.validate] Unknown options notify_service

I then tested the mqtt service here and it seems to work fine:

Is your HA on Ubuntu ?

It’s on hassio on raspberry pi.

Oh I get the same issue with dnsmasq, the networkmanager doesn’t want to let go.
Are you using the inbuilt Mqtt or the add-on?

Oh! I just noticed there’s an update for it:

Version 2??? lol…

Maybe he should toggle the auto update on all his add-ons as well as keep a regular snapshots.

meh… I have auto-updates off as I don’t like surprises but I always update after reading the change notes even for addons.

Oh it’s half the fun of IoT, fix, break, investigate, fix, go to bed in the wee hours of the morning, phew :crazy_face:

1 Like

Actually while your here i still cant get your addon to work.
All the bom_forecast_x all return unknown
Stil l using the dark sky card

OK I updated and restarted ha but I still get nothing happening.

I see this in the log file:

Unable to connect to the MQTT broker: Connection Refused: not authorised.

Wait, mqtt was not installed on hassio, was it? It was installed on my rpi3 running raspbian. Thats the broker. Or well, it was running on both?

rpi2-hassio is .117 and it runs the lovelace interface.

rpi3-raspbian is .113 and it runs the python script in my OP which receives the msg and its payload in order to determine which python script to run for relay activation.

So what setting do you have in your add-on
Check the log file on the addon
What setting do you have in your configuration

If so disable the add-on
‘# out the mqtt in your config’

I just edited my previous post to include my setup explanation a bit better.

If you use the addon, don’t configure another broker in raspbian as they will conflict… uninstall the raspbian one and just use the broker in

I dont know which one I used to be honest. But I know it worked. In the receiving rpi3 i was obviously using the terminal one from raspbian. I think I only have the addon one on the hassio.

I just went to my rpi3-raspbian and typed:

mosquitto_sub -d -t test_channel

and went over to rpi2-hassio in Developer Tools and tested but I dont get it on the rpi3. Weird thing is that now I dont even get it in the Developer Tools>Testing GUI either.