add control status

This commit is contained in:
2024-12-21 22:02:16 +01:00
parent 9abf64f9dd
commit 4ef6c8bd08
6 changed files with 95 additions and 18 deletions

View File

@ -12,6 +12,7 @@
#include "inputs.h"
#include "safety.h"
#include "sntp.h"
#include "control.h"
static const char *TAG = "smart-oil-heater-control-system-metrics";
@ -181,15 +182,15 @@ void taskMetrics(void *pvParameters)
aMetrics[u16MetricCounter].fMetricValue = getReturnFlowTemperature().average60s.fValue;
u16MetricCounter++;
/*Sensor status*/
/*Sensor State*/
sSensorSanityCheck aChecks[NUMBER_OF_SENSOR_SANITY_CHECKS];
getSensorSanityStates(aChecks);
for (size_t i = 0; i < NUMBER_OF_SENSOR_SANITY_CHECKS; i++)
{
strcpy(aMetrics[u16MetricCounter].caMetricName, aChecks[i].name);
strcat(aMetrics[u16MetricCounter].caMetricName, "_status");
strcat(aMetrics[u16MetricCounter].caMetricName, "_state");
aMetrics[u16MetricCounter].type = INTEGER_U8;
aMetrics[u16MetricCounter].u8MetricValue = aChecks[i].status;
aMetrics[u16MetricCounter].u8MetricValue = aChecks[i].state;
u16MetricCounter++;
}
@ -199,8 +200,14 @@ void taskMetrics(void *pvParameters)
aMetrics[u16MetricCounter].u8MetricValue = getSafetyState();
u16MetricCounter++;
/*SNTP Status*/
strcpy(aMetrics[u16MetricCounter].caMetricName, "sntp_status");
/*Control State*/
strcpy(aMetrics[u16MetricCounter].caMetricName, "control_state");
aMetrics[u16MetricCounter].type = INTEGER_U8;
aMetrics[u16MetricCounter].u8MetricValue = getControlState();
u16MetricCounter++;
/*SNTP State*/
strcpy(aMetrics[u16MetricCounter].caMetricName, "sntp_state");
aMetrics[u16MetricCounter].type = INTEGER_U8;
aMetrics[u16MetricCounter].u8MetricValue = getSntpState();
u16MetricCounter++;