Okay sound good
Reboot check your add-on log that it started up and gets a connection from HA
Check HA can publish
Then you just need the rpi3 client to connect to Hassio and subscribe to the topic
Not working yet. I get this in the mqtt add-on log:
[21:21:44] INFO: Setup mosquitto configuration
[21:21:44] WARNING: SSL not enabled - No valid certs found!
[21:21:45] INFO: No local user available
[21:21:46] INFO: Initialize Hass.io Add-on services
[21:21:46] INFO: Initialize Home Assistant discovery
[21:21:46] INFO: Start Mosquitto daemon
1578021706: Loading config file /share/mosquitto/acl.conf
1578021706: mosquitto version 1.6.3 starting
1578021706: Config loaded from /etc/mosquitto.conf.
1578021706: Loading plugin: /usr/share/mosquitto/auth-plug.so
1578021706: |-- *** auth-plug: startup
1578021706: âââ Username/password checking enabled.
1578021706: âââ TLS-PSK checking enabled.
1578021706: âââ Extended authentication not enabled.
1578021706: Opening ipv4 listen socket on port 1883.
1578021706: Opening ipv6 listen socket on port 1883.
1578021706: Opening websockets listen socket on port 1884.
1578021706: Warning: Mosquitto should not be run as root/administrator.
1578021713: New connection from 192.168.1.117 on port 1883.
1578021714: Socket error on client <unknown>, disconnecting.
1578021714: New connection from 192.168.1.117 on port 1883.
1578021714: New client connected from 192.168.1.117 as auto-56F75646-008E-489B-5DC2-ABFB9DD69726 (p2, c1, k60).
1578022121: Client auto-56F75646-008E-489B-5DC2-ABFB9DD69726 disconnected.
1578022162: New connection from 192.168.1.117 on port 1883.
1578022162: New client connected from 192.168.1.117 as auto-B6D82A41-867F-29DA-197E-B45C1160F771 (p2, c1, k60)
So did the last client stay connected.
Why canât you just use user/password doesnât the python program your running on the pi3 support authentication ?
What do you mean by âdid the last client stay connectedâ?.
This all used to work fine. My guess is that at some point mqtt got updated and from what I can tell in the add-on info it started requiring authentication that my setup did not have at all. It was all anonymous.
So Iâve added the acl files and setup up mqtt config as customize = true and anonymous = true. But it still doesnât work.
My latest setup is that Im trying to use anonymous, not interested in creating a user for this.
Devices:
Rpi2-hassio w/mqtt add-on. (IP:.117)
This rpi2 controls a sonoff t3 light switch via this interface and it has for years and still does works fine (Den Light Switch #3):
Rpi3-raspbian connected via BLE to relay board. (IP:.113)
This rpi3 used to work by receiving mqtt messages (komp-on, komp-off, sole-on, sole-off) from the rpi2. The rpi3 would parse the message and according to a switch case, run a python script to send the appropriate command via BLE to the relay board. These is what doesnt work anymore.
The mqtt service on rpi3 is running fine:
Back to the rpi2-hassio with mqtt addon, this is my current config:
{
"logins": [],
"anonymous": true,
"customize": {
"active": true,
"folder": "mosquitto"
},
"certfile": "fullchain.pem",
"keyfile": "privkey.pem",
"require_certificate": false
}
anonymous is set to true because i not interested in user/pwd authentication. customize is set to true because i created an acl:
user user4mqtt
topic readwrite test_channel
and
acl_file /share/mosquitto/accesscontrollist
with user:
When I go to Developer Tools and MQTT for testing to the test_channel, I get nothing back. Im also checking via terminal on the rpi3 and it gets nothing in that channel. I started listening on the rpi3 using:
and my configuration.yaml is:
homeassistant:
# Name of the location where Home Assistant is running
name: Home
# Location required to calculate the time the sun rises and sets
latitude: 25.5263
longitude: -48.0307
# Impacts weather/sunrise data (altitude above sea level in meters)
elevation: 90
# metric for Metric, imperial for Imperial
unit_system: metric
# Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
time_zone: America/Tegucigalpa
# Customization file
customize: !include customize.yaml
# Show links to resources in log and frontend
#introduction:
# Enables the frontend
frontend:
# Enables configuration UI
config:
# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
# base_url: example.duckdns.org:8123
# Checks for available updates
# Note: This component will send some information about your system to
# the developers to assist with development of Home Assistant.
# For more information, please see:
# https://home-assistant.io/blog/2016/10/25/explaining-the-updater/
updater:
# Optional, allows Home Assistant developers to focus on popular components.
# include_used_components: true
# Discover some devices automatically
discovery:
# Allows you to issue voice commands from the frontend in enabled browsers
conversation:
# Enables support for tracking state changes over time
history:
# View all events in a logbook
logbook:
# Enables a map showing the location of tracked devices
map:
# Track the sun
sun:
# Example configuration.yaml entry
input_boolean:
notify_home:
name: Publish MQTT msg
icon: mdi:car
power_kompressor:
name: Kompressor
icon: mdi:car
power_solenoid:
name: Solenoid
icon: mdi:car
# MQTT Switches RPi2 - RPi3
switch:
- platform: mqtt
name: kompressor
command_topic: "test_channel"
payload_on: "komp-on"
payload_off: "komp-off"
- platform: mqtt
name: solenoid
command_topic: "test_channel"
payload_on: "sole-on"
payload_off: "sole-off"
# Sensors
sensor:
# Weather prediction
- platform: yr
# Emoncms
- platform: emoncms
api_key: myapikey
url: http://myserver.com/emoncms/
id: 1
# Example configuration.yaml entry configuring HomeKit
homekit:
mqtt:
broker: 192.168.1.117
sonoff:
username: [email protected]
password: mypass
scan_interval: 60
grace_period: 600
api_region: 'us'
# Example configuration.yaml entry
device_tracker:
- platform: bluetooth_le_tracker
# Text to speech
tts:
- platform: google_translate
service_name: google_say
# Cloud
cloud:
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
panel_iframe:
configurator:
title: Configurator
icon: mdi:wrench
url: http://hassio.local:3218
system_health:
You donât need an mqtt server running on that device. You only need ONE broker on your network.
Based on this command, youâre listening to the local running instance on this raspi3, not the broker on hassio.
Oh OK. But I the hassio gui interface in Developer Tools does listen to its own ser ice and itâs not working.
How do you know itâs not working?
You were publishing/subscribing topic on ANOTHER brokerâŚhow would your hassio broker see the data coming across that broker?
So youâre saying that if I go here in rpi2-hassio:
and enter test_channel below and Start Listening, I should NOT get anything in that same screen like I did before as in post 25 or in post 3 back when I was on MQTT 2.0?
Is your broker running and working? Why not use a better third party client to connect and test?
well can you suggest one? I dont see why the gui that did work back in v2 shouldnt work in v5. but ill do anything to test this and figure it out.
MQTT Explorer? MQTTLens? There are a bunch of options out there.
Iâm just suggesting that rather than relying on a web page, where you arenât seeing ANYTHING, then perhaps a better tool is in order to TROUBLESHOOT the issue.
ok i downloaded mqtt explorer and entered 192.168.1.117 as the host, im a bit lost though. How do i test it:
Quite different to when I connect to the rpi3-raspbian. Im confused now. Who is the broker supposed to be?
So you have a fully functional broker on 113
Use that.
Change HA mqtt to 113 in the configuration
mqtt: broker: 192.168.1.113
Whoever you want to be.
It looks like your hassio add-on is not working properly. Again, this tool was just to verify that. I donât use the pub/sub in HA because thereâs no context and I canât see everything.
If the hassio add-on was working, you would see $SYS there too.
Personally I would just use one that works. It doesnât matter which one that is.
ok i got it working again. Something happened to my mqtt broker service on rpi2-hassio because it was working before using .117 as the broker. I know that because its ip used to be 127.0.0.1, which meant localhost on the rpi2-hassio, which has ip .117. Now I have to use rpi3-.117.
Anyway, thanks so much for all the help. Now I have to figure out whats up with my Configurator not loading from the sidebar, only from the Hass.io menu.