Hi,
I can’t remember how many tutorials I now have tried to get a mqtt sensor working (diyprojects[DOT]io/esp8266-dht22-mqtt-make-iot-include-home-assistant, diyi0t[DOT]com/home-assistant-mqtt-tutorial/, https://learn.adafruit.com/set-up-home-assistant-with-a-raspberry-pi/mqtt-setup, to name a few of them…).
I don’t even come to the point where I can configure the sensors…
The plan is very simple, I’ll just have wemosd1 mini lites which will send their DHT22 measurements to the mosquitto broker, and I then want to show these values in my Overview dashboard.
What I’ve done now:
- Installed HASSIO
- Installed Mosquitto broker Addon via “Supervisor” (now Version 5.1.0)
Configuration:
logins:
- username: mquser
password: mqpass
anonymous: false
customize:
active: true
folder: mosquitto
certfile: fullchain.pem
keyfile: privkey.pem
require_certificate: false
- Added the following to the Configuration yaml
mqtt:
broker: core-mosquitto # This will have to be your mqtt broker, Mosquitto addon is recommended.
discovery: true
- Restart via Configuration > Server Controls
Now the problem, I connect via mqtt cli (hivemq[DOT]com/blog/mqtt-cli/)
$ mqtt sub -h 192.168.0.220 -u mquser --password mqpass -t home/whz/temp --verbose
Setting value of 'version' to default value: MQTT_5_0
Setting value of 'port' to default value: 1883
Empty identifier will lead to using broker generated client identifier
Command SubscribeCommand{host=192.168.0.220, port=1883, version=MQTT_5_0, user=mquser, useDefaultSsl=false, useWebSocket=falsetopics=[home/whz/temp], qos=[EXACTLY_ONCE], outputToConsole=true, base64=false, jsonOutput=false, showTopics=false}
Client '[email protected]' sending CONNECT MqttConnect{keepAlive=60, cleanStart=true, sessionExpiryInterval=0, simpleAuth=MqttSimpleAuth{username and password}}
Client '[email protected]' received CONNACK MqttConnAck{reasonCode=SUCCESS, sessionPresent=false, assignedClientIdentifier=auto-53AB30AD-FDE6-D123-B72F-6D523ACCB295, restrictions=MqttConnAckRestrictions{receiveMaximum=65535, maximumPacketSize=268435460, topicAliasMaximum=10, maximumQos=EXACTLY_ONCE, retainAvailable=true, wildcardSubscriptionAvailable=true, sharedSubscriptionAvailable=true, subscriptionIdentifiersAvailable=true}}
Client '[email protected]' sending SUBSCRIBE MqttSubscribe{subscriptions=[MqttSubscription{topicFilter=home/whz/temp, qos=EXACTLY_ONCE, noLocal=false, retainHandling=SEND, retainAsPublished=false}]}
Client '[email protected]' received SUBACK MqttSubAck{reasonCodes=[GRANTED_QOS_2], packetIdentifier=65526}
Via Supervisor > Mosquitto Broker > Log it looks fine:
1595258461: New connection from 192.168.0.43 on port 1883.
[INFO] found mquser on local database
1595258462: New client connected from 192.168.0.43 as auto-53AB30AD-FDE6-D123-B72F-6D523ACCB295 (p5, c1, k60, u'mquser').
Then I’ll publish a message via cli:
~$ mqtt pub -h 192.168.0.220 -u mquser --password mqpass -t home/whz/temp -m "23.5" --verbose
Setting value of 'version' to default value: MQTT_5_0
Setting value of 'port' to default value: 1883
Empty identifier will lead to using broker generated client identifier
Command PublishCommand{host=192.168.0.220, port=1883, version=MQTT_5_0, user=mquser, useDefaultSsl=false, useWebSocket=false, topics=[home/whz/temp], qos=[AT_MOST_ONCE], message=23.5}
Client '[email protected]' sending CONNECT MqttConnect{keepAlive=60, cleanStart=true, sessionExpiryInterval=0, simpleAuth=MqttSimpleAuth{username and password}}
Client '[email protected]' received CONNACK MqttConnAck{reasonCode=SUCCESS, sessionPresent=false, assignedClientIdentifier=auto-0B1716CC-370F-74D4-453D-4A039E85B726, restrictions=MqttConnAckRestrictions{receiveMaximum=65535, maximumPacketSize=268435460, topicAliasMaximum=10, maximumQos=EXACTLY_ONCE, retainAvailable=true, wildcardSubscriptionAvailable=true, sharedSubscriptionAvailable=true, subscriptionIdentifiersAvailable=true}}
Client '[email protected]' sending PUBLISH ('23.5') MqttPublish{topic=home/whz/temp, payload=4byte, qos=AT_MOST_ONCE, retain=false}
Client '[email protected]' received PUBLISH acknowledgement MqttPublishResult{publish=MqttPublish{topic=home/whz/temp, payload=4byte, qos=AT_MOST_ONCE, retain=false}}
The Output in the Mosquitto Broker log seems fine to me again
[INFO] found mquser on local database
1595258462: New client connected from 192.168.0.43 as auto-53AB30AD-FDE6-D123-B72F-6D523ACCB295 (p5, c1, k60, u'mquser').
1595258563: New connection from 192.168.0.43 on port 1883.
1595258563: New client connected from 192.168.0.43 as auto-0B1716CC-370F-74D4-453D-4A039E85B726 (p5, c1, k60, u'mquser').
1595258563: Client auto-0B1716CC-370F-74D4-453D-4A039E85B726 disconnected.
But in the other terminal window, nothing happens, no message to receive.
I tried with the MQTT-Explorer (0.4.0-beta1), and it shows no topic with the user, even that connection works and “Connection health: online” is shown.
Same when I use the homeassistant user and password I get when I choose Supervisor > Integrations > Mosquitto Broker > Configure > Re-Configure.
When I use [Supervisor > Integrations > Mosquitto Broker > Configure > Listen to a Topic > “home/whz/temp” > Start Listening] no message appears after sending the same command via the mqtt cli mentioned above.
When I open two tabs, one for listening and one for publishing, nothing happens.
For a fresh start, I rebooted the System (Supervisor > System > REBOOT) Still the same behaviour.
What to I do wrong?
configuration.yaml
homeassistant:
# Name of the location where Home Assistant is running
name: Home
# Location required to calculate the time the sun rises and sets
latitude: 50.0
longitude: 10.0
# Impacts weather/sunrise data (altitude above sea level in meters)
elevation: 0
# 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: Europe/Berlin
# Customization file
customize: !include customize.yaml
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
# base_url: example.duckdns.org:8123
# Discover some devices automatically
discovery:
mqtt:
broker: core-mosquitto.local.hass.io # This will have to be your mqtt broker, Mosquitto addon is recommended.
discovery: true
# Sensors
sensor:
# Weather prediction
- platform: yr
- platform: systemmonitor
resources:
- type: disk_use
arg: /
- type: disk_use_percent
arg: /home
- type: memory_free
- platform: command_line
name: CPU Temperature
command: "cat /sys/class/thermal/thermal_zone0/temp"
unit_of_measurement: "°C"
value_template: '{{ (value | multiply(0.001)) | round(1) }}'
device_tracker:
- platform: fritz
track_new_devices: true
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
api:
media_player:
- platform: androidtv
device_class: firetv
name: FireTV
host: 192.168.0.52
adbkey: "/config/adbkey"
adb_server_ip: 127.0.0.1
remote:
- platform: broadlink
host: 192.168.0.47
mac: 34:EA:34:E3:B2:34
type: rm_mini3_redbean
switch:
- platform: broadlink
host: 192.168.0.47
mac: '34:EA:34:E3:B2:34'
timeout: 15
switches:
# Will work on most Phillips TVs:
tv_wohnzimmer:
friendly_name: "TV Wohnzimmer"
command_on: 'JgCMAJaSFDYUNhQ1FBEUERQRFBEUERQ1FDYUNhQRExEUERQRFBEUERQ1FBEUERQRFBEUERQREzYUERQ2FDUUNhQ2FDUUNhQABgKWkhQ2FDYUNRQRFBEUERQRFBEUNRQ2FDYUERMRFBEUERQRFBEUNRQRFBEUERQRFBEUERM2FBEUNhQ1FDYUNhQ1FDYUAA0FAAAAAAAAAAAAAAAA'
command_off: 'JgCMAJaSFDYUNhQ1FBEUERQRFBEUERQ1FDYUNhQRExEUERQRFBEUERQ1FBEUERQRFBEUERQREzYUERQ2FDUUNhQ2FDUUNhQABgKWkhQ2FDYUNRQRFBEUERQRFBEUNRQ2FDYUERMRFBEUERQRFBEUNRQRFBEUERQRFBEUERM2FBEUNhQ1FDYUNhQ1FDYUAA0FAAAAAAAAAAAAAAAA'
staubsauger:
friendly_name: "Roby"
command_on: 'JgBeAZWQFDUUEBQRFBAUERQQFBETNRQ1FBEUEBQRFBAUERQQFDUUERQQFBEUNBQRFBAUERQQFDUUNRQ1FBEUNRQ1EzUUNRQAA7WUkBU0FBEUERMRFBAUERQQEzYTNhMSERMSExETEhMRExI3EhISExISEjcSExETEhMRExI3EjcTNhMREzYUNRQ1FDUUAAO1kpISNxITERMSExETEhMRExI3EjcSEhITERMSExETExIROBISEhMSEhM2ExETEhMRExITNhM2EzYTERM2FDUUNRQ1FAADtJWOFjUUEBQRFBAUERQQFBEUNBU0FBEUEBQRFBAUERQQFDUUERQQFBEUNBUQFBAUERQQFDUUNRQ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QQFDUUNRQQFBEUEBQRFBAUERQ1FDUUEBQRExEUEBQRFBAUERQQFDUUNRQ1FDUUNRQ1FDUUAA0FAAAAAAAAAAAAAA=='
Supervisor > Mosquitto Broker > Configuration: (Network ports are all in default)
logins:
- username: mquser
password: mqpass
anonymous: false
customize:
active: true
folder: mosquitto
certfile: fullchain.pem
keyfile: privkey.pem
require_certificate: false
The Supervisor > Mosquitto Broker > Log
[17:33:18] INFO: Setup mosquitto configuration
[17:33:18] WARNING: SSL not enabled - No valid certs found!
[17:33:18] INFO: Found local users inside config
[17:33:19] INFO: Initialize Hass.io Add-on services
[17:33:19] INFO: Initialize Home Assistant discovery
[17:33:19] INFO: Start Mosquitto daemon
1595259199: Loading config file /share/mosquitto/acl.conf
1595259199: mosquitto version 1.6.3 starting
1595259199: Config loaded from /etc/mosquitto.conf.
1595259199: Loading plugin: /usr/share/mosquitto/auth-plug.so
1595259199: |-- *** auth-plug: startup
1595259199: ├── Username/password checking enabled.
1595259199: ├── TLS-PSK checking enabled.
1595259199: └── Extended authentication not enabled.
1595259199: Opening ipv4 listen socket on port 1883.
1595259199: Opening ipv6 listen socket on port 1883.
1595259199: Opening websockets listen socket on port 1884.
1595259199: Warning: Mosquitto should not be run as root/administrator.
1595259369: New connection from 172.30.32.1 on port 1883.
[INFO] found homeassistant on local database
1595259371: New client connected from 172.30.32.1 as auto-966DDFC5-0754-C6D9-88B0-7169196EB4CB (p2, c1, k60, u'homeassistant').
1595259625: New connection from 192.168.0.43 on port 1883.
[INFO] found mquser on local database
1595259626: New client connected from 192.168.0.43 as auto-10245C81-C8BD-D038-711F-739BA49B3487 (p5, c1, k60, u'mquser').
1595259626: Client auto-10245C81-C8BD-D038-711F-739BA49B3487 disconnected.
1595259685: New connection from 192.168.0.43 on port 1883.
1595259685: New client connected from 192.168.0.43 as auto-34AC40AE-C592-CEFE-20E3-53C5D550D122 (p5, c1, k60, u'mquser').
1595259685: Client auto-34AC40AE-C592-CEFE-20E3-53C5D550D122 disconnected.
1595259827: New connection from 192.168.0.43 on port 1883.
[INFO] found homeassistant on local database
1595259828: New client connected from 192.168.0.43 as auto-D8AF9B89-C7B7-A385-E032-11012F5CE2EE (p5, c1, k60, u'homeassistant').
1595259828: Client auto-D8AF9B89-C7B7-A385-E032-11012F5CE2EE disconnected.
1595259831: New connection from 192.168.0.43 on port 1883.
1595259831: New client connected from 192.168.0.43 as auto-97439B42-FD88-C1C9-71A2-8CA7E9BBDAF1 (p5, c1, k60, u'homeassistant').
1595259831: Client auto-97439B42-FD88-C1C9-71A2-8CA7E9BBDAF1 disconnected.
1595259893: New connection from 192.168.0.43 on port 1883.
1595259893: New client connected from 192.168.0.43 as auto-00F14833-A61A-3254-4252-327F1E2AD4D5 (p5, c1, k60, u'mquser').
1595259893: Client auto-00F14833-A61A-3254-4252-327F1E2AD4D5 disconnected.
Supervisor > System > Core Logprovider:
2020-07-20 17:27:22 WARNING (SyncWorker_0) [androidtv.adb_manager] Couldn't connect to 192.168.0.52:5555 via ADB server 127.0.0.1:5037 because the server is not connected to the device
2020-07-20 17:27:22 WARNING (SyncWorker_0) [homeassistant.components.androidtv.media_player] Could not connect to FireTV at 192.168.0.52:5555 using ADB server at 127.0.0.1:5037
2020-07-20 17:27:22 WARNING (MainThread) [homeassistant.components.media_player] Platform androidtv not ready yet. Retrying in 180 seconds.
2020-07-20 17:30:23 WARNING (SyncWorker_10) [androidtv.adb_manager] Couldn't connect to 192.168.0.52:5555 via ADB server 127.0.0.1:5037 because the server is not connected to the device
2020-07-20 17:30:23 WARNING (SyncWorker_10) [homeassistant.components.androidtv.media_player] Could not connect to FireTV at 192.168.0.52:5555 using ADB server at 127.0.0.1:5037
2020-07-20 17:30:23 WARNING (MainThread) [homeassistant.components.media_player] Platform androidtv not ready yet. Retrying in 180 seconds.
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
2020-07-20 17:30:33 WARNING (Thread-4) [homeassistant.components.mqtt] Disconnected from MQTT server core-mosquitto.local.hass.io:1883 (0)
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] udev.sh: executing...
[17:33:43] INFO: Update udev information
[cont-init.d] udev.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
2020-07-20 17:36:05 WARNING (MainThread) [homeassistant.setup] Setup of person is taking over 10 seconds.
2020-07-20 17:36:05 WARNING (MainThread) [homeassistant.setup] Setup of hassio is taking over 10 seconds.
2020-07-20 17:36:08 WARNING (SyncWorker_19) [androidtv.adb_manager] Couldn't connect to 192.168.0.52:5555 via ADB server 127.0.0.1:5037 because the server is not connected to the device
2020-07-20 17:36:08 WARNING (SyncWorker_19) [homeassistant.components.androidtv.media_player] Could not connect to FireTV at 192.168.0.52:5555 using ADB server at 127.0.0.1:5037
2020-07-20 17:36:09 WARNING (MainThread) [homeassistant.components.media_player] Platform androidtv not ready yet. Retrying in 30 seconds.
2020-07-20 17:36:10 WARNING (MainThread) [homeassistant.components.mobile_app.notify] Found duplicate device name dome's Nokia 4.2
2020-07-20 17:36:10 WARNING (MainThread) [homeassistant.components.mobile_app.notify] Found duplicate device name dome's Nokia 4.2
2020-07-20 17:36:10 WARNING (MainThread) [homeassistant.components.mobile_app.notify] Found duplicate device name dome's Nokia 4.2
2020-07-20 17:36:10 WARNING (MainThread) [homeassistant.components.mobile_app.notify] Found duplicate device name dome's Nokia 4.2
2020-07-20 17:36:10 WARNING (MainThread) [homeassistant.components.mobile_app.notify] Found duplicate device name dome's Nokia 4.2
2020-07-20 17:36:10 WARNING (MainThread) [homeassistant.components.mobile_app.notify] Found duplicate device name dome's Nokia 4.2
2020-07-20 17:36:40 WARNING (SyncWorker_10) [androidtv.adb_manager] Couldn't connect to 192.168.0.52:5555 via ADB server 127.0.0.1:5037 because the server is not connected to the device
2020-07-20 17:36:40 WARNING (SyncWorker_10) [homeassistant.components.androidtv.media_player] Could not connect to FireTV at 192.168.0.52:5555 using ADB server at 127.0.0.1:5037
2020-07-20 17:36:40 WARNING (MainThread) [homeassistant.components.media_player] Platform androidtv not ready yet. Retrying in 60 seconds.
2020-07-20 17:37:41 WARNING (SyncWorker_14) [androidtv.adb_manager] Couldn't connect to 192.168.0.52:5555 via ADB server 127.0.0.1:5037 because the server is not connected to the device
2020-07-20 17:37:41 WARNING (SyncWorker_14) [homeassistant.components.androidtv.media_player] Could not connect to FireTV at 192.168.0.52:5555 using ADB server at 127.0.0.1:5037
2020-07-20 17:37:41 WARNING (MainThread) [homeassistant.components.media_player] Platform androidtv not ready yet. Retrying in 90 seconds.
2020-07-20 17:39:12 WARNING (SyncWorker_7) [androidtv.adb_manager] Couldn't connect to 192.168.0.52:5555 via ADB server 127.0.0.1:5037 because the server is not connected to the device
2020-07-20 17:39:12 WARNING (SyncWorker_7) [homeassistant.components.androidtv.media_player] Could not connect to FireTV at 192.168.0.52:5555 using ADB server at 127.0.0.1:5037
2020-07-20 17:39:12 WARNING (MainThread) [homeassistant.components.media_player] Platform androidtv not ready yet. Retrying in 120 seconds.
2020-07-20 17:41:13 WARNING (SyncWorker_16) [androidtv.adb_manager] Couldn't connect to 192.168.0.52:5555 via ADB server 127.0.0.1:5037 because the server is not connected to the device
2020-07-20 17:41:13 WARNING (SyncWorker_16) [homeassistant.components.androidtv.media_player] Could not connect to FireTV at 192.168.0.52:5555 using ADB server at 127.0.0.1:5037
2020-07-20 17:41:13 WARNING (MainThread) [homeassistant.components.media_player] Platform androidtv not ready yet. Retrying in 150 seconds.
2020-07-20 17:43:44 WARNING (SyncWorker_13) [androidtv.adb_manager] Couldn't connect to 192.168.0.52:5555 via ADB server 127.0.0.1:5037 because the server is not connected to the device
2020-07-20 17:43:44 WARNING (SyncWorker_13) [homeassistant.components.androidtv.media_player] Could not connect to FireTV at 192.168.0.52:5555 using ADB server at 127.0.0.1:5037
2020-07-20 17:43:44 WARNING (MainThread) [homeassistant.components.media_player] Platform androidtv not ready yet. Retrying in 180 seconds.
2020-07-20 17:46:45 WARNING (SyncWorker_4) [androidtv.adb_manager] Couldn't connect to 192.168.0.52:5555 via ADB server 127.0.0.1:5037 because the server is not connected to the device
2020-07-20 17:46:45 WARNING (SyncWorker_4) [homeassistant.components.androidtv.media_player] Could not connect to FireTV at 192.168.0.52:5555 using ADB server at 127.0.0.1:5037
2020-07-20 17:46:45 WARNING (MainThread) [homeassistant.components.media_player] Platform androidtv not ready yet. Retrying in 180 seconds.
Any help is much appreciated.