-
Notifications
You must be signed in to change notification settings - Fork 13
Additional Options
This configures the MQTT connection and any necessary WeeWX options.
Whether to bind to the loop
or the archive
.
This is only used by the service.
The default is loop
.
The clean_session parameter that is passed into the creation of the MQTT client. The default is true
.
The clean_start parameter that is passed into the creation of the MQTT client.
Valid values are true
, false
, and MQTT_CLEAN_START_FIRST_ONLY
.
The default is MQTT_CLEAN_START_FIRST_ONLY
.
This option is only valid with a the protocol
option set to MQTTv5
.
The client id to use when connecting. When running as a service, the default is MQTTSubscribeService-xxxx. When running as a driver, the default is MQTTSubscribeDriver-xxxx. Where xxxx is a random number between 1000 and 9999.
Set to true
to turn on MQTT logging. The default is false
.
The MQTT protocol version.
Valid values are MQTTv31
, MQTTv311
, and MQTTv5
.
The default is MQTTv311
.
When the MQTT queue becomes empty, how long in seconds before checking it. This is only used by the driver. The default is 2
.
The TLS options that are passed to tls_set method of the MQTT client. For additional information see, https://eclipse.org/paho/clients/python/docs/strptime-format-codes
Path to the Certificate Authority certificate files that are to be treated as trusted by this client.
The PEM encoded client certificate and private keys. The default is None
.
The certificate requirements that the client imposes on the broker. Valid values are, none
, optional
, required
. The default is required
The encryption ciphers that are allowable for this connection. Specify None
to use the defaults. The default is None
.
The private keys. The default is None
.
The version of the SSL/TLS protocol to be used. Valid values are,sslv2
, sslv23
, sslv3
, tls
, tlsv1
, tlsv11
, tlsv12
. The default is tlsv12
.
This has the the MQTT topics that are to be subscribed to along with options used to control processing of the
The name of the MQTT on_message callback configuration section. This should only be changed if a topic named ‘message’ is being subscribed to. Default is 'message'.
The formatting string for converting a timestamp to an epoch datetime.
For additional information see, https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes
The default is None
.
The maximum queue size. When the queue is larger than this value, the oldest element is removed. In general the queue should not grow large, but it might if the time between the driver creating packets is large and the MQTT broker publishes frequently. Or if subscribing to 'individual' payloads with wildcards. This results in many topic in a single queue. The default is sys.maxsize for python 3 and sys.maxint for python 2.
The formatting string for converting the time offset when converting a timestamp to an epoch datetime.
Example values are, -hhmm
, +hhmm
, and hh:mm
.
The default is None
.
The QOS level to subscribe to. The default is 0
.
Controls if an actual subscription request is made to the broker for this topic.
The default is True
.
When true
, even if the payload has a dateTime field, ignore it and use the server’s datetime. The default is false
.
The name of the MQTT on_message callback configuration section. This should only be changed if a topic named ‘message’ is being subscribed to. Overrides the value set for all topics.
Specifies a field name In the MQTT message whose value is appended to every field name in the message.
This enables same formatted messages to map to different WeeWX fields.
The default is None
.
This option is only used with json payloads.
So if the different messages looked like this,
{
"time":"2020-06-19 11:28:10",
"model":"Prologue-TH",
"subtype":9,
"id":73,
"channel":1,
"battery_ok":0,
"temperature_C":25.300,
"button":0,
"humidity":68
}
{
"time":"2020-06-19 11:28:17",
"model":"Prologue-TH",
"subtype":9,
"id":42,
"channel":3,
"battery_ok":0,
"temperature_C":26.900,
"button":0,
"humidity":63
}
{
"time":"2020-06-19 11:28:44",
"model":"Prologue-TH",
"subtype":9,
"id":207,
"channel":2,
"battery_ok":0,
"temperature_C":29.700,
"button":0,
"humidity":57
}
Then the configuration would look like this:
[[Topics]]
[[[topic name]]]
msg_id_field = id
[[[[temperature_C_73]]]]
name = extraTemp1
[[[[temperature_C_42]]]]
name = extraTemp2
[[[[temperature_C_207]]]]
name = extraTemp3
[[[[time_73]]]]
name = time_stamp
[[[[time_42]]]]
name = time_stamp
[[[[time_207]]]]
name = time_stamp
Controls if an actual subscription request is made to the broker for this topic.
The default is True
.
Controls what to do when an error occurs converting the data to the desired type.
When set to True
, if there is an exception converting the data type, the value is set to None.
When set to False
if there is an exception converting the data type, an error is logged and the MQTT msg is skipped.
Valid values are True
and False
.
The default is False
.
A Python expression that when evaluated returns a valid value.
Example, conversion_func = lambda x: True if x == 'ON' else False
This takes precedence over the conversion_type
option.
The default is not set.
Controls the ‘archive record cache’.
The ‘archive record cache’ caches values that may not be published in every archive interval.
This specifies in seconds how long the cache is valid. A value of 0
means the cache is always expired.
This is useful if the missing field should have a value of None
instead of the previous value’.
Setting expires_after
to None
means the cache never expires.
The default is not set
When the field has any of the listed values, the MQTT message is not processed. Any set of values separated by a comma is valid. For example: v1, v2, v3. The default is empty. Only used for json payloads. Note, conversion_type will most likely have to be set.
When True
, the value in the field specified in msg_id_field is not appended to the fieldname in the mqtt message. The default is false
.
The units for this field. This is useful if this field's units differ from the topic's unit_system's units. For valid values see, http://www.weewx.com/docs/customizing.htm#units The default is not set.
When true
, even if the payload has a dateTime field, ignore it and use the server’s datetime. The default is false
.
This is only valid when the fieldname is an array. Each subsection 'names' the element in the array.
Each subfield can be configured like a field in the json.
Getting Help
Feel free to open an issue, start a discussion in github, or post on WeeWX google group. When doing so, see Help! Posting to weewx user for information on capturing the log.
Getting Started
Prerequisites
Required MQTT information
Required WeeWX information
Installing MQTTSubscribe
Configuring MQTTSubscribe
Running MQTTSubscribe with WeeWX
Debugging
Common Options
Main section
The [[topics]]
section
The [[[message]]]
section
The [[[topic-name]]]
section
The [[[[field-name]]]]
section
Additional Options
Main section
The [[tls]]
section
The [[topics]]
section
The [[[topic-name]]]
section
The [[[[field-name]]]]
section
Example individual Configuration
Example Configuration with multiple types