I’m completely new to HA and just started using Get Started article, and I’m currently stuck…
Basically, I have an SONOFF RF bridge (flashed with Espurna), some SONOFF PIR2 and SONOFF DW1 sensors, and a Raspberry Pi 3.
My goal is to build a burglar alarm system.
My HA is up and running on RPi and I can ssh into it from my MacBook Pro (OS X 10.11.6).
I added empty mqtt section to configuration.yaml to enable internal MQTT broker, but apparently it’s not working because when I run mosquitto_sub -v -V mqttv311 -t "#"it says Error: Address not available
I tried to install a mosquito server manually (tutorial), but have no luck here as well because it says -bash: command not found for either sudo and apt-key.
Yes, Mosquitto broker add-on is installed, but in the system log I see
ERROR (SyncWorker_18) [hassio.docker] Can’t start addon_core_mosquitto: 500 Server Error: Internal Server Error (“driver failed programming external connectivity on endpoint addon_core_mosquitto (3836f23d34feeb12bfbfb35c6adfcc075b97f7ff5ddbdbebec9de3fea648bb23): Error starting userland proxy: listen tcp 0.0.0.0:1883: bind: address already in use”)
could you tell me how to test that the broker is working?
by the way, I was able to access http://hassio.local:3218 via configurator add-on, but recently it started showing Policy not fulfilled and I cannot change anything.
well, initially I added an empty mqtt section to configuration.yaml hoping to be able to test everything in the minimal configuration, but commands like mosquito_sub failed with error messages and I decided to install the Mosquitto add-on.
las time I was able to access and edit my config it was like broker: core-mosquitto
as I saw somewhere in the documentation.
Will try to gain access to the configurator (as it’s currently “Policy not fulfilled”).
And still, how can I make sure a broker is working properly?
Edit: installed and configured Samba add-on, edited config so it has mqtt: broker: 192.168.0.34
Restarted, same error in logs, mosquitto add-on not started.
Was able to access Configurator once, then again “Policy not fulfilled”. Don’t like it… :\
specified broker’s ip, port, username and password, did “configuration -> Check config, then Reload core” - no difference.
eventually clicked Hass.io -> System -> Reboot and… bingo, the add-on is green, no error messages in the log.
However, when I run mosquitto_sub -h 127.0.0.1 -v -t "homeassistant/#" -u testuser -P mypw it says Error: Connection refused
What’s wrong with it?
From mosquitto’s log:
1520282247: Warning: Mosquitto should not be run as root/administrator.
1520282297: New connection from 192.168.0.34 on port 1883.
1520282297: New client connected from 192.168.0.34 as 4ccc9e7c-2669-4c06-9d39-f5c085a0769b (c1, k60, u’testuser’).
Update: got the result by changing host ip from 127.0.0.1 to the real one: core-ssh:~# mosquitto_sub -h 192.168.0.34 -v -V mqttv311 -t "#" -u testuser -P mypw home-assistant/switch/1/on Switch is ON
Looks like it’s working now, isn’t it?
Honestly, I’m not sure that using ip addresses in config and commands is a good idea as they are dynamic and everything would break if they are changed.
What is the best practice?