OwnTracks on iOS - 2 devices not reporting, one is

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?

This is the output of that command:

    pi@Home-Assistant:~ $ ps axu | egrep "\s510\s"
    homeass+   510  2.8  6.2 175364 59276 ?        Ssl  09:49   9:33 /srv/homeassistant/homeassistant_venv/bin/python3/srv/homeassistant/homeassistant_venv/bin/hass -c /home/homeassistant/.homeassistant
    pi@Home-Assistant:~ $

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.

Thank you.

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.

Any ideas what can I do to fix the presence?

Thank you.

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.

Here is my configuration.yaml file:

    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

This is my groups.yaml file:

    default_view:
    #test:
      name: Home
      view: true
      entities:
      - group.garage_door_group
      - switch.coffee_maker
      - device_tracker.phone1_p1
      - device_tracker.phone2_p2
      - device_tracker.phone3_p3
      - sensor.yr_symbol
      - sun.sun
    Automations_View:
      name: Automations
      view: true
      entities:
      - automation.turn_off_the_coffee_maker_at_midnight
    Garage_Door_Group:
      name: Garage Door
      entities:
      - cover.garage_door
    Ring_Group:
      name: Ring
      entities:
      - binary_sensor.ring_front_door_ding
      - binary_sensor.ring_front_door_motion
      - sensor.ring_front_door_last_activity
      - sensor.ring_front_door_last_ding
      - sensor.ring_front_door_last_motion
      - sensor.ring_front_door_battery
      - sensor.ring_front_door_volume
      - sensor.ring_office_volume
    Ring_View:
      name: Ring
      view: true
      entities:
      - group.ring_group
    System_Group:
      name: Local System
      entities:
      - sensor.cpu_speed
      - sensor.disk_use_home
      - sensor.ram_free
    System_View:
      name: System
      view: true
       entities:
      - group.system_group

Thank you.

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.

mqtt:
    host: 192.168.1.112 #HA IP Address
    port: 1883
    user: username
    password: password

Once you’ve done that, and the garage door opener is correctly working, we can tackle the presence detection.

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.

Thank you.

I guess, it did not like the word host under mqtt section, I replaced it to broker, as suggested and now it complains that it does not like word user.

When I remove words user and password, it gives me more errors in the log section.

Thank you.

The formatting is incorrect on the posted sample, the options are indented too far. Should be…

mqtt:
  host: 192.168.1.112 #HA IP Address
  port: 1883
  user: username
  password: pass

Thank you for the suggestion, but I changed indenting when I copied it to my configuration file. There are only two spaces now.

Thank you.

I found something interesting. I configured my configuration.yaml file to have this:

    mqtt:
      broker: 192.168.1.112 #HA IP Address
      port: 1883
      username: username
      password: pass

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.

Thank you.