I configured three users in CloudMQTT and in HA, but only one of them works. All three are configured exactly the same.
Only one of the users receives location information.
Any ideas why would it happen?
Thank you.
I configured three users in CloudMQTT and in HA, but only one of them works. All three are configured exactly the same.
Only one of the users receives location information.
Any ideas why would it happen?
Thank you.
Are they all configured to use different topics? If not they’ll be over-writing each other.
What client software are you using for these users?
I configured three iPhones in the Control Panel on the CloudMQTT. All of the phones are configured the same way.
When I log into the CloudMQTT Control Panel and go to Websocket Console, I see that location information arrives to CloudMQTT from only one of the phones. It will only arrive from another phone if I manually push it from the phone, but all phones are configured to use “Significant Change Mode.”
With my iPhone, when I go into OwnTracks and check my section friends, I see all of the configured devices. The other two phones can see only my device and their own device. They cannot see the third person.
In CloudMQTT they are all configured with topic #. I saw the video that told me to do this. Should I change it?
Somehow one time the location for my iPhone changed in HA, but whatever I do, I cannot change it again. Other phones do not have any location information.
I configured logging for mosquitto and I see that some information of my phone arrives from CloudMQTT, but HA does not change anything. This is the bottom of the mosquitto log file:
1498283397: Received PINGRESP from local.ha
1498283442: Received PUBLISH from m11.name.domain.com (d0, q1, r1, m5, 'owntracks/Phone1/P1', ... (144 bytes))
1498283442: Sending PUBACK to m11.name.domain.com (Mid: 5)
1498283442: Received PUBLISH from local.ha (d0, q0, r0, m0, 'owntracks/Phone1/P1', ... (144 bytes))
1498283457: Sending PINGREQ to local.ha
1498283457: Received PINGRESP from local.ha
1498283502: Received PINGREQ from m11.name.domain.com
1498283502: Sending PINGRESP to m11.name.domain.com
1498283517: Sending PINGREQ to local.ha
1498283517: Received PINGRESP from local.ha
1498283562: Received PINGREQ from m11.name.domain.com
1498283562: Sending PINGRESP to m11.name.domain.com
1498283577: Sending PINGREQ to local.ha
1498283577: Received PINGRESP from local.ha
1498283622: Received PINGREQ from m11.name.domain.com
1498283622: Sending PINGRESP to m11.name.domain.com
1498283637: Sending PINGREQ to local.ha
1498283637: Received PINGRESP from local.ha
1498283682: Received PINGREQ from m11.name.domain.com
1498283682: Sending PINGRESP to m11.name.domain.com
Nothing comes to HA for other phones.
Can you help with this?
Can you help?
Thank you.
Edit
Each device should have their own identification values. Are you doing that?
To be very clear, they should each have a different username in the OwnTracks “Identification” section. Is that the case?
That’s CloudMQTT, not OwnTracks. OwnTracks is the application you referred to that you’ve installed on your iPhones.
Sorry,
Yes, I installed OwnTracks on the phones. I do not see an option Identification, but:
TrackerID, DeviceID, UserID, and Password are different on all phones.
Is this what you were asking about?
Thank you.
Yes (I don’t use any iPhones, and it sounds like the iPhone interface is a bit different).
I’d suspect a configuration error with OwnTracks, but you say you’ve checked that they’re all configured correctly.
I’ve updated the subject to match what you’re describing, which hopefully will attract others who’re familiar with OwnTracks on iOS
Thank you for your help. At this time, it looks to me that I have two problems.
I see in CloudMQTT that my phone sends location information, but, for some reason, it is not updated in HA.
Thank you.
If you’re not seeing the update in HA, then it means one of the following:
If you need help with those, you’ll need to provide the (correctly formatted - see the blue box at the top of every page) configuration settings from your configuration.yaml
file.
I am trying to use formatting. Not sure if it works the way you wanted to.
I have this line in my /etc/mosquitto/mosquitto.conf file
include_dir /etc/mosquitto/conf.d
This is my /etc/mosquitto/conf.d/cloudmqtt.conf file:
connection cloudmqtt
address mXX.cloudmqtt.com:12345
remote_username XXXXX
remote_password XXXXX
clientid ha
try_private false
start_type automatic
topic # in
I have this in my configuration.yaml file:
device_tracker:
# Owntracks
- platform: owntracks
max_gps_accuracy: 200
waypoints: True
waypoint_whitelist:
- Phone1
- Phone2
- Phone3
Do you see anything wrong? Thank you very much for helping me.
Right, but in HA, what are your settings for MQTT?
Anything in /etc/mosquitto/
is the configuration for mosquitto, and isn’t used at all by HomeAssistant. Please see the link I provided above.
As for your device_tracker, that looks ok, but you need to get MQTT right before anything will turn up in your known_devices.yaml
. Again, please read the documentation I linked to above.
Maybe I misunderstood, but in this questions; Multiple MQTTs issue I was told that I cannot use it because I have another MQTT configured.
I have MQTT working with my garage door now.
Because of that I removed MQTT section for Presence Detection from the configuration file.
Thank you.
Yes, you can only talk to a single MQTT server. That thread tells you that the solution is to bridge your local MQTT server with your CloudMQTT system(s).
Now, the important questions are:
Sorry, I am very new to this and not sure if I could answer all your questions. I just discovered HA about a month ago.
mqtt:
host: 192.168.1.112 #HA IP Address
port: 1883
user: username
password: password
doors:
-
id: 'Garage Door'
relay: 23
state: 17
state_mode: normally_closed
state_topic: "home-assistant/cover"
command_topic: "home-assistant/cover/set"
I have this entry in my HA configuration file for MQTT Cover (Garage Door RPi):
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 }}'
Thank you.
Did you configure an incoming bridge (in CloudMQTT) or an outgoing bridge (in Mosquitto)?
If you configured an incoming bridge, please provide a screenshot so we can see the settings (mask the username/password and hostname). Have you checked that you can reach Mosquitto from the Internet? Indeed, why not simply create users in Mosquitto for your iPhones, and then point them directly at Mosquitto?
If you configured an outgoing bridge, please provide the entries in mosquitto.conf for the bridge (again, mask the username and password).
This is the bridge that I configured in CloudMQTT. I tried Out and Both, but nothing worked.
This is my /etc/mosquitto/mosquitto.conf file. I temporary started logging, everything is default:
pid_file /var/run/mosquitto.pid
user mosquitto
port 1883
listener 9001
protocol websockets
persistence true
connection_messages true
allow_anonymous false
password_file /etc/mosquitto/pwfile
include_dir /etc/mosquitto/conf.d
log_dest file /var/lib/mosquitto/mosquitto.log
log_facility 5
log_type all
This is my /etc/mosquitto/conf.d/cloudmqtt.conf file:
connection cloudmqtt
address mXX.cloudmqtt.com:12345
remote_username hass #user name one of the users I created in CloudMQTT
remote_password hass #password one of the users I created in CloudMQTT
clientid ha
try_private false
start_type automatic
topic # in
I found something strange last night. I have logging enabled, so I run this command:
sudo systemctl restart mosquitto
This is the output that I have in log file:
1498411340: mosquitto version 1.4.12 (build date Thu, 25 May 2017 22:38:16 +0100) starting
1498411340: Config loaded from /etc/mosquitto/mosquitto.conf.
1498411340: Opening websockets listen socket on port 9001.
1498411340: Opening ipv4 listen socket on port 1883.
1498411340: Error: Address already in use
1498411341: mosquitto version 1.4.12 (build date Thu, 25 May 2017 22:38:16 +0100) starting
1498411341: Config loaded from /etc/mosquitto/mosquitto.conf.
1498411341: Opening websockets listen socket on port 9001.
1498411341: Opening ipv4 listen socket on port 1883.
1498411341: Error: Address already in use
I guess the port 1883 is in use. When I change this port in /etc/mosquitto/mosquitto.conf to, for example, port 8883, the mosquitto service starts. When this service starts (I also change port in the bridge of the CloudMQTT and firewall rule), if I run tests, I see that whatever comes to CloudMQQT arrives. I can see it in log file.
How to “create users in Mosquitto for your iPhones, and then point them directly at Mosquitto?” Can you please point me to component that does it? Is there a difference between presence or what you suggested?
I worry that I add more components to HA, they will use MQTT and does it mean that I will have problem with every new switch, sensor, etc…?
Thank you.
So:
You only need one of those - do please read the thread you were referred to here. With just the Mosquitto bridge, you don’t need port forwarding.
Your next problem is finding the process that’s listening on port 1883:
sudo netstat -pant|grep 1883
Not all components use MQTT. If you do then you either need a single MQTT broker that everything talks to, or a working bridge between your central MQTT broker and all other MQTT brokers.
You create the users in Mosquitto. A quick Google search suggests you need mosquitto_passwd for creating the users, just as you did when you created the user for the bridge in from CloudMQTT.
You’re simplifying things. Right now you’re trying to use 2 MQTT servers, and bridge them. That’s perfectly possible, but it requires that you invest time and effort in ensuring you’ve got the bridges working. Right now, all the signs are that you’ve got a number of issues, including that you’ve got something other than Mosquitto running on port 1883.
To simplify it while you learn, you can either configure your garage opener to use CloudMQTT (to match the OwnTracks configuration), or you can configure OwnTracks to use your local Mosquitto server.
Thank you for helping me.
I read the thread and some people were saying that it did not work until they configured bridge in CloudMQTT, so I configured both. Also, someone was talking about firewall forwarding. I will remove the bridge and try it, but not sure why mosquitto service would not start. This is the output of the command you gave me:
pi@Home-Assistant:~ $ sudo netstat -pant|grep 1883
tcp 0 0 0.0.0.0:1883 0.0.0.0:* LISTEN 510/python3
tcp 0 0 127.0.0.1:35453 127.0.0.1:1883 ESTABLISHED 510/python3
tcp 0 0 127.0.0.1:1883 127.0.0.1:35453 ESTABLISHED 510/python3
pi@Home-Assistant:~ $
Also, I have this when I check status for mosquitto service:
pi@Home-Assistant:~ $ sudo systemctl status mosquitto -l
● mosquitto.service - Mosquitto MQTT Broker
Loaded: loaded (/lib/systemd/system/mosquitto.service; disabled)
Active: failed (Result: start-limit) since Sun 2017-06-25 12:22:21 CDT; 1h 3min ago
Docs: man:mosquitto(8)
https://mosquitto.org/
Process: 2452 ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf (code=exited, status=1/FAILURE)
Main PID: 2452 (code=exited, status=1/FAILURE)
Jun 25 12:22:21 Home-Assistant systemd[1]: Unit mosquitto.service entered failed state.
Jun 25 12:22:21 Home-Assistant systemd[1]: mosquitto.service holdoff time over, scheduling restart.
Jun 25 12:22:21 Home-Assistant systemd[1]: Stopping Mosquitto MQTT Broker...
Jun 25 12:22:21 Home-Assistant systemd[1]: Starting Mosquitto MQTT Broker...
Jun 25 12:22:21 Home-Assistant systemd[1]: mosquitto.service start request repeated too quickly, refusing to start.
Jun 25 12:22:21 Home-Assistant systemd[1]: Failed to start Mosquitto MQTT Broker.
Jun 25 12:22:21 Home-Assistant systemd[1]: Unit mosquitto.service entered failed state.
pi@Home-Assistant:~ $
I can make it work if I change the port from 1883 to 8883, but I do not know if it will effect anything else. What do you think?
Thank you.
I removed the bridge in CloudMQTT and changed port from to 8883. Mosquitto started and, when something comes from CloudMQTT, the misquitto log shows me the following:
1498418642: Sending PINGREQ to local.ha
1498418642: Received PINGRESP from local.ha
1498418701: Sending PINGREQ to local.ha
1498418702: Received PINGRESP from local.ha
1498418761: Sending PINGREQ to local.ha
1498418762: Received PINGRESP from local.ha
1498418793: Received PUBLISH from local.ha (d0, q0, r0, m0, 'owntracks/Phone1/P1', ... (154 bytes))
1498418822: Sending PINGREQ to local.ha
1498418822: Received PINGRESP from local.ha
1498418881: Sending PINGREQ to local.ha
1498418882: Received PINGRESP from local.ha
1498418911: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
1498418917: Received PUBLISH from local.ha (d0, q0, r0, m0, 'owntracks/Phone2/P2', ... (148 bytes))
1498418941: Sending PINGREQ to local.ha
1498418942: Received PINGRESP from local.ha
1498419002: Sending PINGREQ to local.ha
1498419002: Received PINGRESP from local.ha
1498419062: Sending PINGREQ to local.ha
1498419062: Received PINGRESP from local.ha
The presence coordinates for the users do not change. Maybe because of that port, but I am not sure.
Any ideas?
Thank you.