Basic: MQTT configuration - plan-d-io/P1-dongle GitHub Wiki

Previous: Basic configuration

MQTT

MQTT is a lightweight protocol that transports small messages between devices. The P1 dongle can act as a MQTT client, to both local or remote brokers, using a plaintext or encrypted (TLS) channel.

In order to use the P1 dongle with Home Assistant, you must configure the MQTT settings. Be sure an MQTT broker (e.g. mosquitto) is running on your Home Assistant host.

Currently, it's not possible to configure a bespoke topic structure or payload formatting. Please see the MQTT payload format page for more information about the default topic structure and payload formatting used.

Use MQTT Client

When checked, the P1 dongle will push meter data to the configured MQTT broker.

Broker hostname or IP address

Set the hostname, IP address or URL of the MQTT broker. The following entries are allowed

Type Example Info
IP address 10.42.0.1 Local or remote IP address of broker
hostname homeserver hostname of broker on local network
mDNS hostname homeserver.local mDNS hostname of broker on local network
URL io.adafruit.com URL of local or remote broker

When using a hostname, the P1 dongle will attempt a mDNS resolve to find the IP address of the broker on your local network. Depending on the settings of your router, this may or may not work. If not, use the IP address of your local broker.

Broker port

Set the port number of the MQTT broker. Standard values are

Port Info
1883 Plaintext connections (for use on local network)
8883 Encrypted TLS connections

Use TLS (SSL)

When checked, the P1 dongle will use a secure, encrypted channel to the MQTT broker (MQTT over TLS).

Make sure your broker accepts TLS connections, and that you have set the correct port. Otherwise, the P1 dongle will hang for some time while trying to negotiate the secure channel, and no data will ever be transferred.

TLS is strongly recommended when using a remote broker, but not recommended when using a local broker.

Client ID (optional)

The name the P1 dongle will use to identify itself with the MQTT broker. Defaults to the unique P1 dongle ID.

Use MQTT auth (optional)

When checked, the P1 dongle will authenticate itself to the MQTT broker with the credentials below.

Client username (optional)

Username to be used while authenticating (only used if MQTT auth is checked).

Client password (optional)

Password to be used while authenticating (only used if MQTT auth is checked).

MQTT topic prefix

The base topic the MQTT messages will arrive.

Update interval

Amount of seconds between MQTT updates.

Payload format

Select the format in which to send the MQTT data. We recommend setting 2 - Standard JSON. Please see the MQTT payload format page for more information.

In order to use Home Assistant, you must select format 1 or higher.

Next: Home Assistant configuration