Before we get started on the requirements for enabling History on MQTT Engine Tags, one should take note of the two ways that MQTT Engine historical event processing can result in historical inserts into the database:
Note: Store and Forward does not guarantee all data is stored and forwarded. There are some edge cases that are not currently handled with regard to data loss in the event of connection failures related to MQTT keep alive timeouts. This window of potential missed data can be reduced by decreasing MQTT Transmission and MQTT Engine configurable keep alive timeouts.
There are caveats to configuration option 2 above (to write historical events directly to the Tag):
If MQTT Engine is configured to write historical events directly to the Tag, history on the Edge (i.e., Transmission side) must be configured to flush history in order. This means that when the Edge side client comes back online and flushes history, it must flush the oldest historical events first (in order) before sending live Tag changes events to Engine. This is because Ignition will ignore writes to the Tag if the timestamp on the Tag change is older that the current value. Please see the screenshots below for context:
Having the [MQTT Engine Settings -> General -> Miscellaneous -> Store Historical Events] setting unchecked/false…
Requires the [MQTT Transmission Settings -> Transmitters -> [Your Transmitter… Default/Custom] -> Configuration -> In-Order History] setting to be checked/true
There are some rules for enabling history on MQTT Engine Tags. They are:
One can determine the current size of the History Store by examining the History Store metric tags under [MQTT Transmission]Transmission Info/History Store. These tags will show the number of historical metrics stored per edgenode/device and how much memory/disk is being consumed by these metrics. These tags update live (count down) as historical data is flushed.
Configuring history on tags indirectly referencing MQTT Engine tags will work properly if the referencing tag is a Reference tag only. Derived, Expression and OPC tags (expose MQTT Engine tag provider through OPCUA server) will not properly store history when MQTT Engine tags are updated with historical data at a high rate of speed. This is a limitation within the Ignition platform and may be addressed in a future release.
In order for historical tag changes at the MQTT Engine tag to propagate to the referencing tag, MQTT Engine must be configured to write historical data directly to its tags and MQTT Transmission must be configured to flush history in-order. See this section above for more details on these configuration requirements.