If i remove the line for the certificate the sensors show up but they wont be updated with the actual data… they stay at unknown state.
So it looks like I got MQTT running, and using the web interface can publish test packets and see packets pushed by OwnTracks. Great.
I installed MQTT mostly for OwnTracks. I set up OwnTracks with the following code:
device_tracker:
- platform: owntracks
max_gps_accuracy: 200
waypoints: true
mqtt_topic: "owntracks/#"
But when I restart, I get the following errors in the HA log:
Timer got out of sync. Resetting
2:39 PM core.py (ERROR)
Error setting up platform owntracks
2:39 PM components/mqtt/__init__.py (ERROR)
Unable to load /config/known_devices.yaml: Config file not found: /config/known_devices.yaml
2:39 PM components/device_tracker/__init__.py (ERROR)
Expanding the middle one shows:
Error setting up platform owntracks
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/__init__.py", line 180, in async_setup_platform
hass, p_config, tracker.async_see, disc_info)
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/owntracks.py", line 93, in async_setup_scanner
hass, context.mqtt_topic, async_handle_mqtt_message, 1)
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/mqtt/__init__.py", line 280, in async_subscribe
topic, msg_callback, qos, encoding)
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/mqtt/__init__.py", line 662, in async_subscribe
await self._async_perform_subscription(topic, qos)
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/mqtt/__init__.py", line 697, in _async_perform_subscription
_raise_on_error(result)
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/mqtt/__init__.py", line 782, in _raise_on_error
'Error talking to MQTT: {}'.format(mqtt.error_string(result_code)))
homeassistant.exceptions.HomeAssistantError: Error talking to MQTT: The client is not currently connected.
I’m wondering if this is a timing issue. When I restart MQTT (using the plugin controls), it takes quite a while for it to come all the way up - on the order of minutes. Could it be that HA is expecting MQTT to be up before it is ready?
Any advice appreciated.
First error are missing a file. Create that file.
The addon should start before HA, so it should not be an issue.
I use this to connect and do not have any issues:
mqtt:
broker: a0d7b954-mqtt
port: 1883
Well, creating that file did clear the error. But not the main one.
I tried using that line for broker, though with port 4883, since I’m using SSL. I have plain MQTT turned off. No joy. I think I’ll try enabling plain, next.
So, some progress. I think there were permission issues. After fiddling with usernames, passwords, and such, the error has gone away. But now I’ve got a different problem - there’s no error, but no sign that the device tracker is there. I think I’ll start a new thread, this seems outside the scope of this one.
Thank you for your help!
Still having issues. I posted a separate thread, but no response so far. The thread is here, in case anyone can help:
Getting very frustrated beating my head against this (see linked thread). Is anyone using this plug-in with OwnTracks? If so, would you share your configuration? I need the plug in config and the “mqtt” and “device_tracker” blocks from configuration.yaml
Much appreciated.
Does anybody know if it’s possible to add the customize folder to this addon?
I tried just adding to the addon config:
"customize": {
"active": true,
"folder": "mosquitto"
},
But it gets removed when I start the addon
That is not supported.
Ah ok, that explains why it wasn’t working haha
Thanks!
Has anyone managed to make web interface work with external NGINX proxy?
Yes.
I have it exposed behind a NGINX proxy.
@ludeeus, would it be possible to include the plugin that allows recursively removing retained messages?
https://www.hivemq.com/plugin/delete-retained-messages-recursively-plugin/
Great plugin BTW
I looks like that plugin are ment to only run once (on demand) that is not great for an addon that are designed to allways run, or did I miss something?
TBH I don’t know anything about the addon, it was just part of the same base system (HiveMQ) and I’d like some mechanism for removing retained messages recursively on the broker. If it isn’t a suitable addition then that is no bother.
[edit] - Is it possible to drop it into the plugins folder of the HiveMQ install? Where would I find that folder if it is? I realised this addon is using the HiveMQ client not the broker - apologies.
Cheers
Does anyone know where this error is coming from?
HA can never connect to the broker while nodered can.
2018-10-30 14:21:04 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 354, in _async_add_entity
await entity.async_added_to_hass()
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/sensor/mqtt.py", line 177, in async_added_to_hass
message_received, self._qos)
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/mqtt/__init__.py", line 306, in async_subscribe
topic, msg_callback, qos, encoding)
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/mqtt/__init__.py", line 688, in async_subscribe
await self._async_perform_subscription(topic, qos)
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/mqtt/__init__.py", line 723, in _async_perform_subscription
_raise_on_error(result)
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/mqtt/__init__.py", line 808, in _raise_on_error
'Error talking to MQTT: {}'.format(mqtt.error_string(result_code)))
homeassistant.exceptions.HomeAssistantError: Error talking to MQTT: The client is not currently connected.
Addon config:
mqtt:
broker: hassio.local
port: 1883
client_id: ha_mqtt
username: !secret mqtt_broker_username2
password: !secret mqtt_broker_password2
Think i got at least part of the issue… ssl does not seem to be working for HA while it is for the nodered addon. Activating the non ssl part of the addon and using the config above “solves it”.
And i guess the error message above is not related…
But i am still wondering if HA should be able to use a selfsigned cert for ssl with this addon.
My cert is at the default location /ssl/…
You may need to set tls_insecure
and/or tls_version
Hm i will try that Thanks for the hint!
Hi all
I am unable to connect to the broker from paho, my notebook is here, and I am using the default config with a single user robin
(also used to the web UI).
In the addon logs I see:
1541484333: New client connected from 192.168.1.107 as hassio-mqtt-client (c1, k60, u'robin').
1541484336: Socket error on client hassio-mqtt-client, disconnecting.
I have enable_mqtt : false
perhaps this is wrong. Set to true
and try port 1883, now error is:
1541485174: New connection from 192.168.1.107 on port 1883.
1541485174: Socket error on client <unknown>, disconnecting.
1541485179: New client connected from 192.168.1.107 as hassio-mqtt-client (c1, k60, u'robin').
UPDATE: using port 1883 this is now working. I’ve updated my notebook. I don’t understand what the difference between using ports 1883 & 1884 is
1883 are for non-ssl MQTT and 1884 are for non-ssl WS