# Sparkplug and historyEnabled property. (node-red)

**URL:** <https://forum.inductiveautomation.com/t/sparkplug-and-historyenabled-property-node-red/30101>\
**Category:** 3rd Party Modules\
**Created:** [November 20, 2019, 9:21am UTC](https://forum.inductiveautomation.com/t/sparkplug-and-historyenabled-property-node-red/30101 "2019-11-20T09:21:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tordvd](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tordvd/32/11525_2.png) [@tordvd](https://forum.inductiveautomation.com/u/tordvd)\
**Post date:** [November 20, 2019, 9:21am UTC](https://forum.inductiveautomation.com/t/sparkplug-and-historyenabled-property-node-red/30101/1 "2019-11-20T09:21:52Z")

</div>

Hi 🧐

I am having troubles getting history enabled through the MQTT engine. I actually got it to work a while ago, and im not sure what i did to the code in the meanwhile.

I am currently sending the folloing metrics in the NBIRTH.  
All the below properties are initialized in the MQTT engine, with the exception of historyProvider, and  
historyEnabled. Any idea why? 😕

```auto
var metrics= [
        {
            "name" : Equipment08/Temperature/value",
            "value" : 0,
            "type" : "float",
            "properties" : {
                   "engUnit" : {
                        "value" : "mm",
                        "type" : "string"
                    },
                    "engHigh" : {
                        "value" : 1337,
                        "type" : "double"
                    },
                    "engLow" : {
                        "value" : 13,
                        "type" : "double"
                    },
                    "historyProvider" : {
                        "value" :"Dobot_DBUtility",
                        "type" :"string"
                    },
                    "historyEnabled" : {
                        "value" :true,
                        "type" : "Boolean"
                    }
                }
        }];

```

A previous version of the metric had the “missing” properties defined something like this.

```auto
"historyProvider" : {
                        "propertyValue" :"Dobot_DBUtility",
                        "type" :"string"
}

```

Attached is a screenshot of the tag browser just after birth

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/3/35da0b4e005062e57e028659ac8500c6e0ab7475.png)

😵

---

<div class="post-metadata">

**Author:** ![tordvd](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tordvd/32/11525_2.png) [@tordvd](https://forum.inductiveautomation.com/u/tordvd)\
**Post date:** [November 22, 2019, 11:59am UTC](https://forum.inductiveautomation.com/t/sparkplug-and-historyenabled-property-node-red/30101/2 "2019-11-22T11:59:51Z")

</div>

bump

---

<div class="post-metadata">

**Author:** ![jhottell](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jhottell/32/6472_2.png) [@jhottell](https://forum.inductiveautomation.com/u/jhottell)\
**Post date:** [February 6, 2020, 7:37pm UTC](https://forum.inductiveautomation.com/t/sparkplug-and-historyenabled-property-node-red/30101/3 "2020-02-06T19:37:48Z")

</div>

Seems like having MQTT Engine save tag history would be a popular feature with or without SparkplugB. I am trying to find any solution where the MQTT tags automatically save history.

---

<div class="post-metadata">

**Author:** ![tordvd](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tordvd/32/11525_2.png) [@tordvd](https://forum.inductiveautomation.com/u/tordvd)\
**Post date:** [February 7, 2020, 6:26am UTC](https://forum.inductiveautomation.com/t/sparkplug-and-historyenabled-property-node-red/30101/4 "2020-02-07T06:26:22Z")

</div>

I dont like to put configuration like that out on the MQTT equipment.

What we do to sentralize the managment, is to make reference tags to all MQTT tags. Or even better, an UDT that encapsulate all data from each MQTT device. Then the UDT containing several reference tags, will have history enabled, as well as alarms, or “tag change event” scripts.

Now, everytime a new MQTT device connects to the broker, we manually add one UDT tag, and the configuration is finished (and centralised).

---

<div class="post-metadata">

**Author:** ![tordvd](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tordvd/32/11525_2.png) [@tordvd](https://forum.inductiveautomation.com/u/tordvd)\
**Post date:** [February 14, 2020, 8:29am UTC](https://forum.inductiveautomation.com/t/sparkplug-and-historyenabled-property-node-red/30101/5 "2020-02-14T08:29:11Z")

</div>

I think i found out why history enabled was not possible. See the screenshot below:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/7/7d98fbb2cedec67fcb7fd1e440c176226df1eebe.png)

Will try to remove the filter later
