Required MQTT information
First up is to ensure that you can subscribe to the MQTT topics independent of WeeWX and obtain a basic understanding of the data being published.
- Determine the information is required to subscribe to the MQTT topic(s). Some of the questions to answer are:
- What is the broker/server name?
- What is the port to connect to?
- Is a username/password required?
- What topics is the data being published to?
- etc.
-
Test that you can subscribe to the MQTT topic(s). A couple of options are:
-
The advantage of using mosquitto_sub, it is a widely used utility and therefore a lot of information can be found on the web.
-
The advantage of using MQTTSubscribe Simulator is that it can be used to also test the MQTTSubscribe section of the WeeWX configuration.
This does require MQTTSubscribe to be installed and configured.
-
-
Determine the MQTT message ‘type’.
Currently three message ‘types’ are supported.
-
‘individual’ - Each field is its own topic and the MQTT message is the value. For example,
The value
1is published to a topic oftopic/idand the value26.7is published to a topic oftopic/temp1. -
‘json’ - The MQTT message is json. The json field/values in the message map to field/values in WeeWx. An example message is,
{ "id": 1, "temp1": “26.7“ } -
‘keyword’ - The MQTT message is delimited data of keywords and values. The json field/values in the message map to field/values in WeeWx. An example message is,
id=1,temp1=26.7
-