MQTT Broker
The MQTT integration needs you to run an MQTT broker for Open Peer Power to connect to.
Run your own
This is the most private option, is running your own MQTT broker.
The recommended setup method is to use the Mosquitto MQTT broker add-on.
Configuration
# Example configuration.yaml entry
mqtt:
broker: 192.168.1.100
Public broker
The Mosquitto project runs a public broker. This is the easiest to set up, but there is no privacy as all messages are public. Use this only for testing purposes and not for real tracking of your devices or controlling your home.
CloudMQTT
CloudMQTT is a hosted private MQTT instance that is free for up to 10 connected devices. This is enough to get started with for example OwnTracks and give you a taste of what is possible.
- Create an account (no payment details needed)
- Create a new CloudMQTT instance (Cute Cat is the free plan)
- From the control panel, click on the Details button.
- Create unique users for Open Peer Power and each phone to connect
(CloudMQTT does not allow two connections from the same user)- Under manage users, fill in username, password and click add
- Under ACLs, select user, topic
#
, check ‘read access’ and ‘write access’
- Copy the instance info to your configuration.yaml:
mqtt:
broker: CLOUDMQTT_SERVER
port: CLOUDMQTT_PORT
username: CLOUDMQTT_USER
password: CLOUDMQTT_PASSWORD
Embedded broker (Deprecated)
Open Peer Power contains an embedded MQTT broker called HBMQTT. If you don’t have an MQTT broker, you can configure this one to be used. If configured, Open Peer Power will automatically connect to it.
Setting | Value |
---|---|
Host | localhost |
Port | 1883 |
Protocol | 3.1.1 |
User | openpeerpower |
Password | password set under MQTT settings |
Websocket port | 8080 |
# Example configuration.yaml entry
mqtt:
password: hello
Owntracks
To use Owntracks with the internal broker a small configuration change must be made in order for the app to use MQTT protocol 3.1.1 (Protocol Level 4).
In the Owntracks preferences (Android: v1.2.3+, iOS: v9.5.1+) open Configuration Management; Find the value named mqttProtocolLevel
and set the value to 4
. The application will now use MQTT 3.1.1 to connect, which is compatible with the embedded broker.
Settings
If you want to customize the settings of the embedded broker, use embedded:
and the values shown in the HBMQTT Broker configuration. This will replace the default configuration.
# Example configuration.yaml entry
mqtt:
embedded:
# Your HBMQTT config here. Example at:
# http://hbmqtt.readthedocs.org/en/latest/references/broker.html#broker-configuration