format
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user