Support for update entity in HA

This commit is contained in:
Gunnar Skjold
2025-02-03 17:51:36 +01:00
parent 9c42aab04f
commit 6668258b66
15 changed files with 110 additions and 40 deletions

View File

@@ -15,7 +15,7 @@
class HomeAssistantMqttHandler : public AmsMqttHandler {
public:
#if defined(AMS_REMOTE_DEBUG)
HomeAssistantMqttHandler(MqttConfig& mqttConfig, RemoteDebug* debugger, char* buf, uint8_t boardType, HomeAssistantConfig config, HwTools* hw) : AmsMqttHandler(mqttConfig, debugger, buf) {
HomeAssistantMqttHandler(MqttConfig& mqttConfig, RemoteDebug* debugger, char* buf, uint8_t boardType, HomeAssistantConfig config, HwTools* hw, AmsFirmwareUpdater* updater) : AmsMqttHandler(mqttConfig, debugger, buf, updater) {
#else
HomeAssistantMqttHandler(MqttConfig& mqttConfig, Stream* debugger, char* buf, uint8_t boardType, HomeAssistantConfig config, HwTools* hw) : AmsMqttHandler(mqttConfig, debugger, buf) {
#endif
@@ -28,6 +28,9 @@ public:
bool publishPrices(PriceService*);
bool publishSystem(HwTools* hw, PriceService* ps, EnergyAccounting* ea);
bool publishRaw(String data);
bool publishFirmware();
bool postConnect();
void onMessage(String &topic, String &payload);
@@ -37,7 +40,9 @@ public:
private:
uint8_t boardType;
String topic;
String pubTopic;
String subTopic;
String deviceName;
String deviceModel;
@@ -46,10 +51,11 @@ private:
String deviceUrl;
String statusTopic;
String discoveryTopic;
String sensorTopic;
String updateTopic;
String sensorNamePrefix;
bool l1Init, l2Init, l2eInit, l3Init, l3eInit, l4Init, l4eInit, rtInit, rteInit, pInit, sInit, rInit;
bool l1Init, l2Init, l2eInit, l3Init, l3eInit, l4Init, l4eInit, rtInit, rteInit, pInit, sInit, rInit, fInit;
bool tInit[32] = {false};
bool prInit[38] = {false};
uint32_t lastThresholdPublish = 0;