Another HA/Owntracks/MQTT Question

Hi, Progressing nicely getting HA set up and worked through multiple issues with all the help available.

But have an issue that seems to be a roadblock. I have an MQTT broker set up on a cloud virtual server and it appears to be working fine. Multiple different clients and publish and sub with messages flowing fine. Followed the DigitalOcean tutorial even though it uses a different service. So that part seems to be squared away.

Owntracks is set up on my IPhone with a home region and it publishes just fine to the MQTT broker in the owntracks topic.

I added the MQTT broker info to configuration.yaml and it threw no exceptions/errors. Added Owntracks and it started throwing an error in the console as below

2017-07-07 01:47:20 WARNING (Thread-6) [homeassistant.components.emulated_hue] When targetting Google Home, listening port has to be port 80
2017-07-07 01:47:20 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform owntracks
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/device_tracker/init.py”, line 154, in async_setup_platform
hass, p_config, tracker.async_see, disc_info)
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/device_tracker/owntracks.py”, line 314, in async_setup_scanner
hass, LOCATION_TOPIC, async_owntracks_location_update, 1)
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/mqtt/init.py”, line 231, in async_subscribe
yield from hass.data[DATA_MQTT].async_subscribe(topic, qos)
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/mqtt/init.py”, line 525, in async_subscribe
_raise_on_error(result)
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/mqtt/init.py”, line 634, in _raise_on_error
‘Error talking to MQTT: {}’.format(mqtt.error_string(result)))
homeassistant.exceptions.HomeAssistantError: Error talking to MQTT: The client is not currently connected.

Not exactly a helpful message since I know that they are able to talk until i set up owntracks. and no known_devices.yaml file either…

After pulling my hair out for a bit, thinking that HA was supposed to automatically create the known_devices.yaml(k_d.yaml for brevity) and yet not seeing it, I created a blank one. Same error. Then I had the wild thought it might be a permissions based issue so I chmod to set k_d.yaml to 666. And Bingo, no more errors in the console, but…

No devices in k_a.yaml either… Thoughts? I can post configuration.yaml if it would be helpful. Thx Chris

Has owntracks sent a message regarding any devices since you got the permissions set right? And I think HA creates the known_devices file itself. You might want to check the rights on the .homeassistant directory. Mine are as follows:

drwxr-xr-x 9 homeassistant homeassistant 4096 Jul 5 16:11 .homeassistant

From the traceback, it doesn’t look like HASS is able to connect to the MQTT broker.

It looks like this happens while it’s trying to subscribe to a topic. Do you have the MQTT component configured in HASS as well?

Yes, I forced the messages multiple times. Standalone app that is subscribed to owntracks topic saw each, but nothing from HA

Yes, it is configured and pretty sure it is connected from this output:

user1@pine64:/home/homeassistant$ sudo systemctl status home-assistant@homeassistant
[email protected] - Home Assistant
Loaded: loaded (/etc/systemd/system/[email protected]; enabled; vendor preset: enabled)
Active: active (running) since Fri 2017-07-07 03:35:28 UTC; 11s ago
Main PID: 22017 (hass)
CGroup: /system.slice/system-home\x2dassistant.slice/[email protected]
└─22017 /srv/homeassistant/bin/python3 /srv/homeassistant/bin/hass -c /home/homeassistant/.homeassistant

Jul 07 03:35:38 pine64 hass[22017]: 2017-07-07 03:35:38 INFO (MainThread) [homeassistant.components.automation] Initialized trigger Startup Notification
Jul 07 03:35:38 pine64 hass[22017]: 2017-07-07 03:35:38 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: old_state=<state automation.startup_notification=off; last_trigge
Jul 07 03:35:38 pine64 hass[22017]: 2017-07-07 03:35:38 INFO (MainThread) [homeassistant.core] Timer:starting
Jul 07 03:35:38 pine64 hass[22017]: 2017-07-07 03:35:38 INFO (MainThread) [homeassistant.components.automation] Executing Startup Notification
Jul 07 03:35:38 pine64 hass[22017]: 2017-07-07 03:35:38 INFO (MainThread) [homeassistant.core] Bus:Handling <Event logbook_entry[L]: domain=automation, name=Startup Notification, message=has been tr
Jul 07 03:35:38 pine64 hass[22017]: 2017-07-07 03:35:38 INFO (MainThread) [homeassistant.helpers.script] Script Startup Notification: Running script
Jul 07 03:35:38 pine64 hass[22017]: 2017-07-07 03:35:38 INFO (MainThread) [homeassistant.helpers.script] Script Startup Notification: Executing step call service
Jul 07 03:35:38 pine64 hass[22017]: 2017-07-07 03:35:38 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: service_data=value1=HAss has Started!!, event=TestHA_Trigger, doma
Jul 07 03:35:38 pine64 hass[22017]: 2017-07-07 03:35:38 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: old_state=<state group.all_automations=off; hidden=True, assumed_
Jul 07 03:35:39 pine64 hass[22017]: 2017-07-07 03:35:39 INFO (Thread-14) [homeassistant.components.mqtt] Successfully reconnected to the MQTT server

Watch Ben’s @bruhautomation video on this, very helpful

Thx, but yes, I have watched it several times:) As he states, once the services are connected, and owntracks is added to the yaml file, it should just work but that is not the case for me. No errors are being thrown now, but still not seeing any devices in the known_devices file