ha: completly removed last_reset support

This commit is contained in:
Gilles Grandou 2022-02-08 13:59:50 +01:00
parent d84447f00c
commit d276b62bd9

View File

@ -14,7 +14,6 @@ typedef struct {
const char *device_class; // HA Device Class const char *device_class; // HA Device Class
const char *name; // HA name const char *name; // HA name
const char *unit; // HA unit const char *unit; // HA unit
const bool last_reset; // HA LastReset present
const char *value_template; // HA Template for value const char *value_template; // HA Template for value
} ha_config_desc; } ha_config_desc;
@ -22,9 +21,9 @@ typedef struct {
static ha_config_desc ha_config_descs[] = { static ha_config_desc ha_config_descs[] = {
{ "PAPP", "measurement", "power", "Puissance Apparente", "VA", }, { "PAPP", "measurement", "power", "Puissance Apparente", "VA", },
{ "IINST", "measurement", "current", "Intensité Instantanée", "A", }, { "IINST", "measurement", "current", "Intensité Instantanée", "A", },
{ "HCHP", "total_increasing", "energy", "Energie Heures Pleines", "kWh", false, "{{ (value | float) / 1000 }}" }, { "HCHP", "total_increasing", "energy", "Energie Heures Pleines", "kWh", "{{ (value | float) / 1000 }}" },
{ "HCHC", "total_increasing", "energy", "Energie Heures Creuses", "kWh", false, "{{ (value | float) / 1000 }}" }, { "HCHC", "total_increasing", "energy", "Energie Heures Creuses", "kWh", "{{ (value | float) / 1000 }}" },
{ "PTEC", NULL, NULL, "Période Tarifaire en cours", NULL, false, { "PTEC", NULL, NULL, "Période Tarifaire en cours", NULL,
"{% if value == \"TH..\" %}Toutes les Heures" "{% if value == \"TH..\" %}Toutes les Heures"
"{% elif value == \"HC..\" %}Heures Creuses" "{% elif value == \"HC..\" %}Heures Creuses"
"{% elif value == \"HP..\" %}Heures Pleines" "{% elif value == \"HP..\" %}Heures Pleines"
@ -89,10 +88,6 @@ void ha_config_init(const char *tic_name, struct mosquitto *mosq_tic)
json_object_object_add(obj, "unit_of_measurement", json_object_new_string(desc->unit)); json_object_object_add(obj, "unit_of_measurement", json_object_new_string(desc->unit));
if (desc->value_template) if (desc->value_template)
json_object_object_add(obj, "value_template", json_object_new_string(desc->value_template)); json_object_object_add(obj, "value_template", json_object_new_string(desc->value_template));
if (desc->last_reset) {
json_object_object_add(obj, "last_reset_topic", json_object_new_string(vtopic));
json_object_object_add(obj, "last_reset_value_template", json_object_new_string("1970-01-01T00:00:00+00:00"));
}
const char *payload = json_object_to_json_string(obj); const char *payload = json_object_to_json_string(obj);
unescape_str(payload); unescape_str(payload);