Logo   LOGGER MQTT

Home
Dragonnorth...
Modules
Published Source License
Screen Shots
SD Card Issues
Updating Firmware

Reference Information
Airflow Setup
Development Environment
I2C Addresses
Module Setup
MQTT
Network Setup
Processor Module Pinning
WattNode Modbus Adapter

Development History
Breadboard
Project Status
Software Revisions

References
PJRC hardware
ESP8266 Information

Logger MQTT Implementation

The LOGGER has multiple uplink interfaces. The interface parameters shown in the screenshot below are for the MQTT interface. Key attributes are:
NamePurpose
MQTT_SERVER The URL of the server that the MQTT interface should publish and/or subscribe to. Changing the server requires a reboot.
IOT_UPLINK_SIGNATURE The signature is passed to the server so that messages can be checked to see if they are from a vaild source. MQTT servers do not do this type of checking. It is effectively a password.
IOT_UPLINK_DEVICE The device name is passed to the server so that the server can identify what device the message is coming from. MQTT servers do not use this identification at this time. A possible future enhancement is to include this name as part of the Topic prefix.
IOT_UPLINK_SEC_BETWEEN_POSTS The number of seconds between LOGGER attempts to publish sensor data as topics. When this value is zero all publication stops.

The table below the parameters shows the sensors that can be sent to MQTT. The sensor name is in the StreamID column and the sensor value is in the next column. Each sensor can be enabled or disabled for MQTT publishing.

MQTT publications are made to the topic: LOGGER-E8:68:E7:64:45:06 where E8:68:E7:64:45:06 is the MAC address of the LOGGER.

Each enabled sensor gets an individual message published.

The text is tab separated it looks like this:

    $SAMPLE DeskTop1 device-name 1631711498 5748 MS_Temperature 27.65
    $SAMPLE DeskTop1 device-name 1631711498 5748 MS_Pressure 1008.53

$SAMPLE this allows the reader to know how to parse the message.
DeskTop1 whatever is set in the IOT_UPLINK_SIGNATURE field
device-name whatever is set in the IOT_UPLINK_DEVICE field
1631711498 the unix time the sample was taken
5748 a sequence number, if you have received sequence # x and x+1 you have all the samples that exist
MS_Temperature the name of the sensor
27.65 the value of the sensor

The LOGGER also publishes each latest value to the topic LOGGER-E8:68:E7:64:45:06/latest/MS_Temperature where MS_Temperature is changed for each publication to the name from the StreamID column.

The LOGGER subscribes to the topic LOGGER-E8:68:E7:64:45:06-Command (the same topic name as what is published to with -Command appended). The intent is to allow the listener to observe the sequence number and decide to request publication of a particular sequence number (or time) by publishing a request on the LOGGER-E8:68:E7:64:45:06-Command topic. Right now the LOGGER just reports the most recent command it received. The eventual intent is to have the logger publish historical sensor values based on requests for particular sequence numbers made to this topic. The requests will be:

    $REPORT-TIME unix-time
    $REPORT-SEQUENCE sequence-number

Publications responding to these report requests will not publish to the 'latest' topic, just to LOGGER-E8:68:E7:64:45:06.

                                                                                                                                                       
LOGGER pages copyright 2016-2021 by Dragonnorth Group (Michael Newman).
Send comments and corrections to:
Webmaster: mnewman@dragonnorth.com