This commit is contained in:
2025-12-28 13:10:36 +01:00
parent f5d2e46015
commit 14b03f45f4

View File

@@ -1,7 +1,8 @@
#include <libwebsockets.h>
#include <nlohmann/json.hpp>
#include <hass.hpp>
#include <log.hpp>
#include <nlohmann/json.hpp>
#include <string>
HomeAssistant::HomeAssistant(std::string addr, std::string ent) {
@@ -50,9 +51,9 @@ void HomeAssistant::event_handler(struct lws* wsi, enum lws_callback_reasons rea
if (ha_type == "event") {
json = json["event"];
if(json.contains("a"))
if (json.contains("a"))
state = std::stof(json["a"][entity]["s"].get<std::string>());
if(json.contains("c"))
if (json.contains("c"))
state = std::stof(json["c"][entity]["+"]["s"].get<std::string>());
break;
}