Your first problem is because some python3 process is listening on that port. Possibly that’s the HomeAssistant process, since it has a built in (very limited) MQTT broker. Please provide the output of:
ps axu | egrep "\s510\s"
The coordinates not updating suggest that the phone isn’t pushing updated coordinates. Are you sure they are?
I am sure that updates are coming because, if I remove my garage door and configure HA to use Presence without all this modifications, everything works.
So, it looks like currently HA thinks it needs to start it’s internal MQTT broker, which is the source of your port clash. The garage door opener is reporting to it, hence why that works yet your Mosquitto bridge to CloudMQTT doesn’t appear to do anything for you.
Configuring mqtt as you’ve done should stop that happening. Do you have any other mqtt lines in your configuration?
I do not have anything else that uses mqtt at this time, Just starting with HA, but I believe that I have more later.
Sorry, but I did not understand what you mean by configure mqtt as I have done. Do you mean to change port to 8883? It is like that now, but the presence status is not updating.
Ok, first thing to do is post your entire configuration.yaml, and any files you include, removing any usernames and passwords. It’s likely that you’ve got multiple mqtt: entries, which is causing HA to start it’s own internal broker.
Once we’ve fixed that, we should be able to fix the presence detection.
homeassistant:
# Name of the location where Home Assistant is running
name: Home
# Location required to calculate the time the sun rises and sets
latitude: 55.5555555
longitude: -55.5555555
# Impacts weather/sunrise data (altitude above sea level in meters)
elevation: 301
# metric for Metric, imperial for Imperial
unit_system: imperial
# Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
time_zone: My/Location
customize:
cover.garage_door:
# friendly_name: Garage
icon: mdi:garage
switch.coffee_maker:
icon: mdi:coffee
# Show links to resources in log and frontend
#introduction:
# Enables the frontend
frontend:
# Enables configuration UI
config:
http:
# Uncomment this to add a password (recommended!)
# api_password: PASSWORD
# Uncomment this if you are using SSL or running in Docker etc
# base_url: example.duckdns.org:8123
api_password: MyPasswordHere
# 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:
# Track the sun
sun:
# Text to speech
tts:
platform: google
###################Customized##################################
binary_sensor:
# Ring Doorbell
- platform: ring
monitored_conditions:
- ding
- motion
cover:
# Garage Door
- platform: mqtt
state_topic: "home-assistant/cover"
command_topic: "home-assistant/cover/set"
name: "Garage Door"
qos: 0
retain: true
payload_open: "OPEN"
payload_close: "CLOSE"
payload_stop: "STOP"
state_open: "OPEN"
state_closed: "STATE"
optimistic: false
value_template: '{{ value.x }}'
device_tracker:
# Owntracks
- platform: owntracks
max_gps_accuracy: 200
waypoints: True
waypoint_whitelist:
- Phone1
- Phone2
- Phone3
# Ring Doorbell
ring:
username: [email protected]
password: MyPasswordHere
sensor:
# Weather Prediction
- platform: yr
# CPU Speed
- platform: cpuspeed
# System Monitor
- platform: systemmonitor
resources:
- type: disk_use_percent
arg: /home
- type: memory_free
# Ring
- platform: ring
monitored_conditions:
- battery
- last_activity
- last_ding
- last_motion
- volume
switch:
# Coffee Maker
- platform: tplink
host: 192.168.1.114
# Zones
zone:
name: Home
latitude: xx.xxxxxxx
longitude: -xx.xxxxxxx
radius: 100
icon: mdi:home
zone 2:
name: Work
latitude: xx.xxxxxxx
longitude: -xx.xxxxxxx
icon: mdi:worker
zone 3:
name: MiddleSchool
latitude: xx.xxxxxxx
longitude: -xx.xxxxxxx
radius: 250
icon: mdi:school
zone 4:
name: HighSchool
latitude: xx.xxxxxxx
longitude: -xx.xxxxxxx
radius: 250
icon: mdi:school
group: !include groups.yaml
automation: !include automations.yaml
This is my automation.yaml file:
- alias: Turn Off the Coffee Maker At Midnight
condition:
condition: state
entity_id: switch.coffee_maker
state: 'on'
trigger:
platform: time
at: 00:00:01
action:
service: switch.turn_off
entity_id: switch.coffee_maker
So, it would appear you’ve removed the mqtt: configuration, which is why the internal broker is starting. You need to restore that and shut down HA so you can start Mosquitto. Once you start Mosquitto and it’s running, then you can start HA again.
I configured mosquitto.conf file to use port 1883.
After that, I added lines, as you suggested to my configuration file (changing user name and password).
After reboot, in the HA web portal, where it used to show me the Garage Door controls, I have the following:
Invalid config
The following components and platforms could not be set up:
device_tracker.owntracks
mqtt
cover.mqtt
Please check your config
It does not show Garage Door controls anymore.
When I check log section of the HA web portal, I see the following:
2017-06-27 08:02:23 ERROR (MainThread) [homeassistant.config] Invalid config for [mqtt]: [host] is an invalid option for [mqtt]. Check: mqtt->mqtt->host. (See /home/homeassistant/.homeassistant/configuration.yaml, line 100). Please check the docs at https://home-assistant.io/components/mqtt/
2017-06-27 08:02:23 ERROR (MainThread) [homeassistant.setup] Setup failed for mqtt: Invalid config.
2017-06-27 08:02:25 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of cover.mqtt. Setup failed for dependencies: mqtt
2017-06-27 08:02:25 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform cover.mqtt: Could not setup all dependencies.
2017-06-27 08:02:25 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of device_tracker.owntracks. Setup failed for dependencies: mqtt
2017-06-27 08:02:25 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform device_tracker.owntracks: Could not setup all dependencies.
The mqtt code that I added is located on line 100.
Now, when I restart it, I check and see that mosquitto service is not running. If I manually start this service and, after that, restart HA service, everything works.
Any ideas how to fix this? I guess, I need mosquitto service to start before HA service starts.