Hi2UAll,
I have a question about the Long-Term Statistics (LTS) used by recorder, stored in the Home Assistant (HA) default Database (DB).
As an example I use a Virtual Entity (VE) configured by MQTT using Node-RED (NR).
Reason:
I have an old config (>5 years) which uses security states like who is at home, burgler/fire/flood states, Presence Detection and so on.
The VE MQTT sensors I use presents the state in a text string. For example the home state of my house is presented as Thuis, Bewaakt, Weg, Slaap, Vakantie (Home/Waiting to arrive/Away/Sleeping/Holliday).
In Node-Red I configured a sensor by using a Function Node configured to add it to MQTT, installing the sensor automatically in HA.
Part of my payload:
var _payload = {
"name": "Bewonersstatus",
"icon": "hassio:home-circle-outline",
"unique_id": "mqtt_bewonerstatus",
"platform": "mqtt",
"state_topic": _topic + "/state",
"device": {
"name": "Mqtt Security",
"manufacturer": "MQTT Hass.io",
"model": "Custom",
"identifiers": ["Mqtt Security"],
"sw_version": "20230803",
"suggested_area": "Algemeen"
}
};
The question:
How can I configure my VE to store a text-value to the LTS?
Do I have just to add "state_class": "measurement", or do I have to add also "device_class": "WHATIS_NEEDED_HERE" to get it working?
Please help, I would highly appreciate it.