mirror of
https://github.com/openshwprojects/OpenBK7231T_App.git
synced 2026-03-07 15:57:51 +01:00
add flag to use kWh instead of Wh for energy
This commit is contained in:
@@ -385,7 +385,12 @@ HassDeviceInfo* hass_init_power_sensor_device_info(int index) {
|
||||
const char* device_class_value = counter_devClasses[index - OBK_CONSUMPTION_TOTAL];
|
||||
if (strlen(device_class_value) > 0) {
|
||||
cJSON_AddStringToObject(info->root, "dev_cla", device_class_value); //device_class=energy
|
||||
cJSON_AddStringToObject(info->root, "unit_of_meas", "Wh"); //unit_of_measurement
|
||||
if (CFG_HasFlag(OBK_FLAG_MQTT_ENERGY_IN_KWH)) {
|
||||
cJSON_AddStringToObject(info->root, "unit_of_meas", "kWh"); //unit_of_measurement
|
||||
}
|
||||
else {
|
||||
cJSON_AddStringToObject(info->root, "unit_of_meas", "Wh"); //unit_of_measurement
|
||||
}
|
||||
|
||||
//state_class can be measurement, total or total_increasing. Energy values should be total_increasing.
|
||||
cJSON_AddStringToObject(info->root, "stat_cla", "total_increasing");
|
||||
|
||||
@@ -2435,7 +2435,7 @@ const char* g_obk_flagNames[] = {
|
||||
"[WiFi] Quick connect to WiFi on reboot (TODO: check if it works for you and report on github)",
|
||||
"[Power] Set power and current to zero if all relays are open",
|
||||
"[MQTT] [Debug] Publish all channels (don't enable it, it will be publish all 64 possible channels on connect)",
|
||||
"error",
|
||||
"[MQTT] Use kWh unit for energy consumption (total, last hour, today) instead of Wh",
|
||||
"error",
|
||||
"error",
|
||||
"error",
|
||||
|
||||
Reference in New Issue
Block a user