From b6f6d875bb79ff0bb7eb775f981e980434a13585 Mon Sep 17 00:00:00 2001 From: Gilles Grandou Date: Tue, 8 Feb 2022 13:59:50 +0100 Subject: [PATCH] ha: completly removed last_reset support --- homeassistant.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/homeassistant.c b/homeassistant.c index 528f809..cf1fba7 100644 --- a/homeassistant.c +++ b/homeassistant.c @@ -14,7 +14,6 @@ typedef struct { const char *device_class; // HA Device Class const char *name; // HA name const char *unit; // HA unit - const bool last_reset; // HA LastReset present const char *value_template; // HA Template for value } ha_config_desc; @@ -22,9 +21,9 @@ typedef struct { static ha_config_desc ha_config_descs[] = { { "PAPP", "measurement", "power", "Puissance Apparente", "VA", }, { "IINST", "measurement", "current", "Intensité Instantanée", "A", }, - { "HCHP", "total_increasing", "energy", "Energie Heures Pleines", "kWh", false, "{{ (value | float) / 1000 }}" }, - { "HCHC", "total_increasing", "energy", "Energie Heures Creuses", "kWh", false, "{{ (value | float) / 1000 }}" }, - { "PTEC", NULL, NULL, "Période Tarifaire en cours", NULL, false, + { "HCHP", "total_increasing", "energy", "Energie Heures Pleines", "kWh", "{{ (value | float) / 1000 }}" }, + { "HCHC", "total_increasing", "energy", "Energie Heures Creuses", "kWh", "{{ (value | float) / 1000 }}" }, + { "PTEC", NULL, NULL, "Période Tarifaire en cours", NULL, "{% if value == \"TH..\" %}Toutes les Heures" "{% elif value == \"HC..\" %}Heures Creuses" "{% 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)); if (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); unescape_str(payload);