mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
修改MQTT通讯数据解析问题
This commit is contained in:
@@ -128,6 +128,8 @@ public:
|
||||
|
||||
static std::map<std::string, HandlerOptions> g_mapHttpHandlerGet =
|
||||
{
|
||||
{"/queryBaseinfo", HandlerOptions(&HttpEntity::logqueryBaseinfoin, {})},
|
||||
|
||||
{"/login", HandlerOptions(&HttpEntity::login, {DMUser::ACCOUNT, DMUser::PASSWD})},
|
||||
{"/queryUserList", HandlerOptions(&HttpEntity::queryUserList, {})},
|
||||
{"/deleteUser", HandlerOptions(&HttpEntity::deleteUser, { DMUser::USER_ID})},
|
||||
@@ -155,8 +157,8 @@ static std::map<std::string, HandlerOptions> g_mapHttpHandlerGet =
|
||||
|
||||
|
||||
{"/queryPolicyList", HandlerOptions(&HttpEntity::queryPolicyList, {})},
|
||||
|
||||
{"/deletePolicy", HandlerOptions(&HttpEntity::deletePolicy, { DMPolicy::POLICY_ID})},
|
||||
{"/queryPolicyByType", HandlerOptions(&HttpEntity::queryPolicyByType, {"type"})},
|
||||
|
||||
{"/querySystemLogList", HandlerOptions(&HttpEntity::querySystemLogList, {})},
|
||||
|
||||
@@ -280,6 +282,7 @@ void HttpEntity::runHandler(std::string name, const HandlerOptions& handler, con
|
||||
jsonresp["errmsg"] = ErrcodeStr(errcode) + (errmsg.empty() ? "" : (":"+errmsg));
|
||||
resp.set_content(jsonresp.dump(), "text/plain; charset=utf-8");
|
||||
resp.status = 200;
|
||||
spdlog::info("[http] request: {}, response: {}.", name, int(errcode));
|
||||
}
|
||||
|
||||
void HttpEntity::registGet(std::string name, void (HttpEntity::* func)(const httplib::Request& req, httplib::Response& resp))
|
||||
@@ -287,6 +290,18 @@ void HttpEntity::registGet(std::string name, void (HttpEntity::* func)(const htt
|
||||
this->httpsvr.Get(name, std::bind(func, this, std::placeholders::_1, std::placeholders::_2));
|
||||
}
|
||||
|
||||
Errcode HttpEntity::logqueryBaseinfoin(const httplib::Request& req, njson& json, std::string& errmsg)
|
||||
{
|
||||
json["data"] = {
|
||||
{"encryption", Config::option.http.encryption},
|
||||
{"encryptKey", Config::option.http.encryptKey},
|
||||
{"latitude", Config::option.view.latitude},
|
||||
{"longitude", Config::option.view.longitude},
|
||||
{"altitude", Config::option.view.altitude}
|
||||
};
|
||||
return Errcode::OK;
|
||||
}
|
||||
|
||||
Errcode HttpEntity::login(const httplib::Request& req, njson& json, std::string& errmsg)
|
||||
{
|
||||
std::string userId;
|
||||
@@ -602,12 +617,13 @@ Errcode HttpEntity::insertStation(const httplib::Request& req, njson& json, std:
|
||||
Errcode HttpEntity::updateStation(const httplib::Request& req, njson& json, std::string& errmsg)
|
||||
{
|
||||
Fields params;
|
||||
GetRequestParam(req, {"station_id", "name", "address", "lon", "lat", "tel", "capacity", "status", "work_mode", "policy_id"}, params);
|
||||
GetRequestParam(req, {"station_id", "name", "address", "lon", "lat", "tel", "capacity", "status", "work_mode", "policy_id", "operation_date"}, params);
|
||||
std::string stationId = params.value("station_id");
|
||||
params.check("capacity", "", "0.0");
|
||||
params.check("lon", "", "0.0");
|
||||
params.check("lat", "", "0.0");
|
||||
params.check("status", "", "1");
|
||||
params.check("policy_id", "", "NULL");
|
||||
Errcode err = DAO::updateStationById(params);
|
||||
if (err == Errcode::OK)
|
||||
{
|
||||
@@ -621,16 +637,11 @@ Errcode HttpEntity::updateStation(const httplib::Request& req, njson& json, std:
|
||||
}
|
||||
else
|
||||
{
|
||||
if (result.size() > 0)
|
||||
auto station = Application::data().getStation(Utils::toInt(stationId));
|
||||
if (result.size() > 0 && station)
|
||||
{
|
||||
auto station = Application::data().getStation(Utils::toInt(stationId));
|
||||
if (station)
|
||||
{
|
||||
station->setFields(result[0]);
|
||||
station->setGarewayWorkMode();
|
||||
}
|
||||
station->setFields(result[0]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return err;
|
||||
@@ -681,6 +692,15 @@ Errcode HttpEntity::queryStationOverview(const httplib::Request& req, njson& jso
|
||||
njson jsonCharge = njson::parse(R"({"category":2, "count":0, "power":0.0})");
|
||||
njson jsonSolar = njson::parse(R"({"category":3, "count":0, "power":0.0})");
|
||||
njson jsonSecurity = njson::parse(R"({"category":4, "count":0, "power":0.0})");
|
||||
auto videoInfo = Config::getVideoInfo(stationId);
|
||||
if (videoInfo)
|
||||
{
|
||||
jsonSecurity["host"] = videoInfo->host;
|
||||
jsonSecurity["port"] = videoInfo->port;
|
||||
jsonSecurity["user"] = videoInfo->user;
|
||||
jsonSecurity["passwd"] = videoInfo->passwd;
|
||||
}
|
||||
|
||||
for (auto& fields : result)
|
||||
{
|
||||
int category = fields.get<int>("category");
|
||||
@@ -743,17 +763,21 @@ Errcode HttpEntity::queryStationInfo(const httplib::Request& req, njson& json, s
|
||||
}
|
||||
Errcode HttpEntity::queryStationData(const httplib::Request& req, njson& json, std::string& errmsg)
|
||||
{
|
||||
// 温度, 电压、电流、功率、功率因数、
|
||||
std::string stationId = req.get_param_value("station_id");
|
||||
auto station = Application::data().getStation(Utils::toInt(stationId));
|
||||
njson jsondata;
|
||||
jsondata["voltage"] = Utils::toStr(200.32);
|
||||
jsondata["current"] = Utils::toStr(20.56);
|
||||
jsondata["power"] = Utils::toStr(200.32);
|
||||
jsondata["powerFactor"] = Utils::toStr(1);
|
||||
jsondata["envTemp"] = Utils::toStr(200.32);
|
||||
jsondata["envhum"] = Utils::toStr(200.32);
|
||||
jsondata["aircStatus"] = Utils::toStr(1);
|
||||
jsondata["coolingStatus"] = Utils::toStr(0);
|
||||
|
||||
if (station)
|
||||
{
|
||||
// 温度, 电压、电流、功率、功率因数、
|
||||
jsondata["voltage"] = Utils::toStr(station->voltage, 0);
|
||||
jsondata["current"] = Utils::toStr(station->current, 0);
|
||||
jsondata["power"] = Utils::toStr(station->power, 0);
|
||||
jsondata["powerFactor"] = Utils::toStr(station->powerFactor, 0);
|
||||
jsondata["envTemp"] = Utils::toStr(station->temperature, 0);
|
||||
jsondata["envhum"] = Utils::toStr(station->humidity, 0);
|
||||
jsondata["aircStatus"] = station->aircStatus;
|
||||
jsondata["coolingStatus"] = station->coolingStatus;
|
||||
}
|
||||
json["data"] = jsondata;
|
||||
return Errcode::OK;
|
||||
}
|
||||
@@ -899,10 +923,28 @@ Errcode HttpEntity::queryDevicCharts(const httplib::Request& req, njson& json, s
|
||||
|
||||
Errcode HttpEntity::queryDeviceBCUDetail(const httplib::Request& req, njson& json, std::string& errmsg)
|
||||
{
|
||||
Fields params;
|
||||
GetRequestParam(req, {"station_id", "device_id"}, params);
|
||||
if (!params.contains("station_id")) { errmsg = "缺少参数[station_id]"; return Errcode::ERR_PARAM; }
|
||||
if (!params.contains("device_id")) { errmsg = "缺少参数[device_id]"; return Errcode::ERR_PARAM; }
|
||||
|
||||
int stationId = params.get<int>("station_id");
|
||||
int deviceId = params.get<int>("device_id");
|
||||
auto device = Application::data().getDevice(stationId, deviceId);
|
||||
|
||||
njson jsondata = njson::array();
|
||||
for (int i = 0; i<=100; ++i)
|
||||
if (device)
|
||||
{
|
||||
jsondata.push_back({{"SOC", "1"}, {"SOH", "1"}, {"V", "1"}, {"T", "1"}, {"R_i", "1"}});
|
||||
for (int i = 0; i<=device->bcuCount && i<device->vecBCUUnit.size(); ++i)
|
||||
{
|
||||
auto& row = device->vecBCUUnit[i];
|
||||
std::string soc = Utils::toStr(row[0], 1);
|
||||
std::string soh = Utils::toStr(row[1], 1);
|
||||
std::string u = Utils::toStr(row[2], 0);
|
||||
std::string t = Utils::toStr(row[3], 2);
|
||||
std::string r_i = Utils::toStr(row[4], 0);
|
||||
jsondata.push_back({{"SOC", soc}, {"SOH", soh}, {"V", u}, {"T", t}, {"R_i", r_i}});
|
||||
}
|
||||
}
|
||||
json["data"] = jsondata;
|
||||
return Errcode::OK;
|
||||
@@ -937,6 +979,14 @@ Errcode HttpEntity::deletePolicy(const httplib::Request& req, njson& json, std::
|
||||
GetRequestParam(req, {"policy_id"}, params);
|
||||
return DAO::deletePolicyById(params.value("policy_id"));
|
||||
};
|
||||
Errcode HttpEntity::queryPolicyByType(const httplib::Request& req, njson& json, std::string& errmsg)
|
||||
{
|
||||
std::string type = req.get_param_value("type");
|
||||
std::string sql = "SELECT policy_id, `type`, name from policy WHERE `type`='" + type + "';";
|
||||
std::vector<Fields> result;
|
||||
int ret = DaoEntity::execOnce(sql, result);
|
||||
return Errcode(ret);
|
||||
}
|
||||
|
||||
Errcode HttpEntity::querySystemLogList(const httplib::Request& req, njson& json, std::string& errmsg)
|
||||
{
|
||||
@@ -1048,7 +1098,7 @@ Errcode HttpEntity::queryStatStationGroup(const httplib::Request& req, njson& js
|
||||
|
||||
auto dao = DaoEntity::create("");
|
||||
std::string sql = R"(SELECT s.station_id, s.name station_name, ss.income_elect, ss.income_charge, ss.storage_usage FROM station s LEFT JOIN
|
||||
(SELECT station_id, SUM(income_elect ) income_elect , SUM(income_charge) income_charge, avg(storage_usage) storage_usage FROM stat_station GROUP BY station_id) AS ss
|
||||
(SELECT station_id, SUM(income_elect ) income_elect , SUM(income_charge) income_charge, avg(storage_usage) storage_usage FROM stat_day GROUP BY station_id) AS ss
|
||||
ON ss.station_id = s.station_id)";
|
||||
std::vector<Fields> vecStations;
|
||||
auto err = dao->exec(sql, vecStations);
|
||||
@@ -1106,9 +1156,9 @@ static std::string VerifyStatSqlCondition(Fields& params)
|
||||
return sqlCondition;
|
||||
}
|
||||
|
||||
static std::string GetRequestStatParams(const httplib::Request& req)
|
||||
static std::string GetRequestStatParams(const httplib::Request& req, Fields& params)
|
||||
{
|
||||
Fields params;
|
||||
|
||||
GetRequestParam(req, {"station_id", "category", "start_date", "end_date"}, params);
|
||||
VerifyRequstParamsStatDate(params);
|
||||
return VerifyStatSqlCondition(params);
|
||||
@@ -1116,8 +1166,9 @@ static std::string GetRequestStatParams(const httplib::Request& req)
|
||||
|
||||
Errcode HttpEntity::queryStatTotal(const httplib::Request& req, njson& json, std::string& errmsg)
|
||||
{
|
||||
std::string sqlCondition = GetRequestStatParams(req);
|
||||
std::string sql = R"(SELECT SUM(ss.storage_elect_in) storage_elect_in,
|
||||
Fields params;
|
||||
std::string sqlCondition = GetRequestStatParams(req, params);
|
||||
std::string sql = R"(SELECT
|
||||
SUM(storage_elect_in) storage_elect_in,
|
||||
SUM(storage_elect_out) storage_elect_out,
|
||||
SUM(storage_num_in) storage_num_in,
|
||||
@@ -1133,14 +1184,24 @@ Errcode HttpEntity::queryStatTotal(const httplib::Request& req, njson& json, std
|
||||
AVG(charge_usage) charge_usage,
|
||||
SUM(income_elect) income_elect,
|
||||
SUM(income_charge) income_charge
|
||||
FROM stat_station ss)" + sqlCondition + ";";
|
||||
FROM stat_day ss)" + sqlCondition + ";";
|
||||
|
||||
std::string stationId = params.value("station_id");
|
||||
|
||||
njson jsondata;
|
||||
|
||||
auto station = Application::data().getStation(Utils::toInt(stationId));
|
||||
if (station)
|
||||
{
|
||||
jsondata["launch_date"] = station->launchDate;
|
||||
}
|
||||
|
||||
std::vector<Fields> result;
|
||||
DaoEntity::execOnce(sql, result);
|
||||
if (result.size() > 0)
|
||||
{
|
||||
auto& fields = result[0];
|
||||
njson jsondata;
|
||||
|
||||
// jsondata["launch_date"] = "2025-09-01"; //场站上线日期
|
||||
// jsondata["station_id"] = station_id;
|
||||
jsondata["storage_elect_in"] = fields.value("storage_elect_in"); //储能充电电量(kWh),精度:0.001
|
||||
@@ -1170,16 +1231,63 @@ Errcode HttpEntity::queryStatDayList(const httplib::Request& req, njson& json, s
|
||||
std::string category = params.value("category");
|
||||
std::string startDate = params.value("start_date");
|
||||
std::string endDate = params.value("end_date");
|
||||
if (endDate.empty())
|
||||
{
|
||||
int64_t t = Utils::time();
|
||||
endDate = Utils::dateStr(t);
|
||||
startDate = Utils::dateStr(t - 86400*7);
|
||||
}
|
||||
std::vector<Fields> result;
|
||||
auto err = DAO::queryStatStationGroup(NULL, stationId, category, startDate, endDate, result);
|
||||
json["data"] = FieldsToJsonArray(result);
|
||||
|
||||
if (!startDate.empty() && !endDate.empty())
|
||||
{
|
||||
int64_t t0 = Utils::time(startDate + " 00:00:00");
|
||||
int64_t t1 = Utils::time(endDate + " 00:00:00");
|
||||
int i = 0;
|
||||
|
||||
njson jsondata = njson::array();
|
||||
for (int64_t t = t0; t<=t1; t += 86400)
|
||||
{
|
||||
njson jsonrow;
|
||||
std::string dt = Utils::dateStr(t);
|
||||
Fields* fields = NULL;
|
||||
if (i<result.size() && result[i].value("dt") == dt)
|
||||
{
|
||||
fields = &(result[i]);
|
||||
i++;
|
||||
}
|
||||
jsonrow["dt"] = dt.substr(5);
|
||||
jsonrow["storage_elect_in"] = fields ? fields->value("storage_elect_in") : "0";
|
||||
jsonrow["storage_elect_out"] = fields ? fields->value("storage_elect_out") : "0";
|
||||
jsonrow["storage_num_in"] = fields ? fields->value("storage_num_in") : "0";
|
||||
jsonrow["storage_num_out"] = fields ? fields->value("storage_num_out") : "0";
|
||||
jsonrow["storage_num_err"] = fields ? fields->value("storage_num_err") : "0";
|
||||
jsonrow["solar_elect_gen"] = fields ? fields->value("solar_elect_gen") : "0";
|
||||
jsonrow["solar_elect_grid"] = fields ? fields->value("solar_elect_grid") : "0";
|
||||
jsonrow["solar_num_err"] = fields ? fields->value("solar_num_err") : "0";
|
||||
jsonrow["storage_usage"] = fields ? fields->value("storage_usage") : "0";
|
||||
jsonrow["charge_elect"] = fields ? fields->value("charge_elect") : "0";
|
||||
jsonrow["charge_num"] = fields ? fields->value("charge_num") : "0";
|
||||
jsonrow["charge_num_err"] = fields ? fields->value("charge_num_err") : "0";
|
||||
jsonrow["charge_usage"] = fields ? fields->value("charge_usage") : "0";
|
||||
jsonrow["income_elect"] = fields ? fields->value("income_elect") : "0";
|
||||
jsonrow["income_charge"] = fields ? fields->value("income_charge") : "0";
|
||||
jsondata.push_back(jsonrow);
|
||||
}
|
||||
json["data"] = jsondata;
|
||||
}
|
||||
else
|
||||
{
|
||||
json["data"] = FieldsToJsonArray(result);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
//Errcode HttpEntity::queryStatDayList(const httplib::Request& req, njson& json, std::string& errmsg)
|
||||
//{
|
||||
// std::string sqlCondition = GetRequestStatParams(req);
|
||||
// std::string sql = R"(SELECT ss.*, d.name device_name, ddt.name device_type FROM stat_station ss
|
||||
// std::string sql = R"(SELECT ss.*, d.name device_name, ddt.name device_type FROM stat_day ss
|
||||
// LEFT JOIN device d ON d.device_id = ss.device_id
|
||||
// LEFT JOIN def_device_type ddt ON ddt.device_type_id = d.`type`)" + sqlCondition + ";";
|
||||
//
|
||||
@@ -1200,7 +1308,8 @@ Errcode HttpEntity::queryStatDetailList(const httplib::Request& req, njson& json
|
||||
|
||||
std::vector<Fields> result;
|
||||
auto err = DAO::queryStatStationList(pageinfo, params, result);
|
||||
json["data"] = FieldsToJsonArray(result);
|
||||
//json["data"] = FieldsToJsonArray(result);
|
||||
HttpHelper::setPagination(pageinfo, result, json);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -1286,40 +1395,38 @@ Errcode HttpEntity::queryEnvironment(const httplib::Request& req, njson& json, s
|
||||
auto& unit = iter->second;
|
||||
njson node;
|
||||
node["pos"] = "#" + std::to_string(iter->first);
|
||||
node["temp"] = unit.temp;
|
||||
node["hum"] = unit.hum;
|
||||
node["temp"] = Utils::toStr(unit.temp);
|
||||
node["hum"] = Utils::toStr(unit.hum);
|
||||
nodearray.push_back(node);
|
||||
}
|
||||
jsondata["temp_hum"] = nodearray;
|
||||
}
|
||||
{ //空调
|
||||
auto& mapAircUnit = station->mapAircUnit;
|
||||
AircUnit unitTmp;
|
||||
AircUnit* unit = (mapAircUnit.size() > 0) ? &(mapAircUnit[0]) : &unitTmp;
|
||||
njson nodearray = njson::array();
|
||||
if (unit)
|
||||
for (auto& item: mapAircUnit)
|
||||
{
|
||||
nodearray.push_back({{"pos", "开关"}, {"status", unit->powerOn == 0 ? "关机" : "开机"}});
|
||||
nodearray.push_back({{"pos", "启动制冷指令"}, {"status", unit->cooling == 0 ? "启动" : "关闭"}});
|
||||
nodearray.push_back({{"pos", "启动送风指令"}, {"status", unit->airSupply == 0 ? "关闭" : "启动"}});
|
||||
nodearray.push_back({{"pos", "启动待机指令"}, {"status", unit->standby == 0 ? "关闭" : "启动"}});
|
||||
nodearray.push_back({{"pos", "启动加热指令"}, {"status", unit->heating == 0 ? "关闭" : "启动"}});
|
||||
nodearray.push_back({{"pos", "传感器故障"}, {"status", unit->sensorAlarm == 0 ? "正常" : "告警"}});
|
||||
nodearray.push_back({{"pos", "高低电压告警"}, {"status", unit->voltageAlarm == 0 ? "正常" : "告警"}});
|
||||
nodearray.push_back({{"pos", "高低温告警"}, {"status", unit->tempAlarm == 0 ? "正常" : "告警"}});
|
||||
nodearray.push_back({{"pos", "高低压告警"}, {"status", unit->pressureAlarm == 0 ? "正常" : "告警"}});
|
||||
nodearray.push_back({{"pos", "压缩机告警"}, {"status", unit->compressorAlarm == 0 ? "正常" : "告警"}});
|
||||
nodearray.push_back({{"pos", "当前温度"}, {"status", std::to_string(unit->temp) + "℃"}});
|
||||
nodearray.push_back({{"pos", "当前湿度"}, {"status", std::to_string(unit->hum) + "%"}});
|
||||
auto& unit = item.second;
|
||||
nodearray.push_back({{"pos", "开关"}, {"status", unit.powerOn == 0 ? "关机" : "开机"}});
|
||||
nodearray.push_back({{"pos", "启动制冷指令"}, {"status", unit.cooling == 0 ? "启动" : "关闭"}});
|
||||
nodearray.push_back({{"pos", "启动送风指令"}, {"status", unit.airSupply == 0 ? "关闭" : "启动"}});
|
||||
nodearray.push_back({{"pos", "启动待机指令"}, {"status", unit.standby == 0 ? "关闭" : "启动"}});
|
||||
nodearray.push_back({{"pos", "启动加热指令"}, {"status", unit.heating == 0 ? "关闭" : "启动"}});
|
||||
nodearray.push_back({{"pos", "传感器故障"}, {"status", unit.sensorAlarm == 0 ? "正常" : "告警"}});
|
||||
nodearray.push_back({{"pos", "高低电压告警"}, {"status", unit.voltageAlarm == 0 ? "正常" : "告警"}});
|
||||
nodearray.push_back({{"pos", "高低温告警"}, {"status", unit.tempAlarm == 0 ? "正常" : "告警"}});
|
||||
nodearray.push_back({{"pos", "高低压告警"}, {"status", unit.pressureAlarm == 0 ? "正常" : "告警"}});
|
||||
nodearray.push_back({{"pos", "压缩机告警"}, {"status", unit.compressorAlarm == 0 ? "正常" : "告警"}});
|
||||
nodearray.push_back({{"pos", "当前温度"}, {"status", std::to_string(unit.temp) + "℃"}});
|
||||
nodearray.push_back({{"pos", "当前湿度"}, {"status", std::to_string(unit.hum) + "%"}});
|
||||
break;
|
||||
}
|
||||
jsondata["airc"] = nodearray;
|
||||
}
|
||||
{ // 消防
|
||||
static std::map<int, std::string> mapFireStatusDef = { {0, "正常"}, {1,"预警"}, {2,"火警"} };
|
||||
|
||||
|
||||
std::map<int, string> mapStatusDef = {{0, "无效"}, {1, "掉线"}, {2, "正常"}, {3, "启动"}};
|
||||
|
||||
auto& mapFire40Unit = station->mapFire40Unit;
|
||||
njson nodearray = njson::array();
|
||||
for (auto iter = mapFire40Unit.begin(); iter!=mapFire40Unit.end(); ++iter)
|
||||
@@ -1338,20 +1445,19 @@ Errcode HttpEntity::queryEnvironment(const httplib::Request& req, njson& json, s
|
||||
}
|
||||
{ // 冷机
|
||||
auto& mapCoolingUnit = station->mapCoolingUnit;
|
||||
CoolingUnit unitTmp;
|
||||
CoolingUnit* unit = (mapCoolingUnit.size() > 0) ? &(mapCoolingUnit[0]) : &unitTmp;
|
||||
njson nodearray = njson::array();
|
||||
if (unit)
|
||||
for (auto& item: mapCoolingUnit)
|
||||
{
|
||||
auto& unit = item.second;
|
||||
njson node;
|
||||
nodearray.push_back({{"pos", "开关"}, {"status", unit->powerOn == 0 ? "关机" : "开机"}});
|
||||
nodearray.push_back({{"pos", "采样模式"}, {"status", unit->mode == 0 ? "出水温度" : "电芯温度"}});
|
||||
nodearray.push_back({{"pos", "制冷状态"}, {"status", unit->cooling == 0 ? "关闭" : "启动"}});
|
||||
nodearray.push_back({{"pos", "制热状态"}, {"status", unit->heating == 0 ? "关闭" : "启动"}});
|
||||
nodearray.push_back({{"pos", "高温告警"}, {"status", unit->highTemp == 0 ? "正常" : "告警"}});
|
||||
nodearray.push_back({{"pos", "低温告警"}, {"status", unit->lowTemp == 0 ? "正常" : "告警"}});
|
||||
nodearray.push_back({{"pos", "高压告警"}, {"status", unit->highPressure == 0 ? "正常" : "告警"}});
|
||||
nodearray.push_back({{"pos", "低压告警"}, {"status", unit->lowPressure == 0 ? "正常" : "告警"}});
|
||||
nodearray.push_back({{"pos", "开关"}, {"status", unit.powerOn == 0 ? "关机" : "开机"}});
|
||||
nodearray.push_back({{"pos", "采样模式"}, {"status", unit.mode == 0 ? "出水温度" : "电芯温度"}});
|
||||
nodearray.push_back({{"pos", "制冷状态"}, {"status", unit.cooling == 0 ? "关闭" : "启动"}});
|
||||
nodearray.push_back({{"pos", "制热状态"}, {"status", unit.heating == 0 ? "关闭" : "启动"}});
|
||||
nodearray.push_back({{"pos", "高温告警"}, {"status", unit.highTemp == 0 ? "正常" : "告警"}});
|
||||
nodearray.push_back({{"pos", "低温告警"}, {"status", unit.lowTemp == 0 ? "正常" : "告警"}});
|
||||
nodearray.push_back({{"pos", "高压告警"}, {"status", unit.highPressure == 0 ? "正常" : "告警"}});
|
||||
nodearray.push_back({{"pos", "低压告警"}, {"status", unit.lowPressure == 0 ? "正常" : "告警"}});
|
||||
}
|
||||
jsondata["cooling"] = nodearray;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user