Merge pull request #2160 from proddy/dev

value_json['%s']['%s'] for Domoticz (to test)
This commit is contained in:
Proddy
2024-10-31 22:29:56 +01:00
committed by GitHub
6 changed files with 30 additions and 64 deletions

View File

@@ -4,14 +4,18 @@ For more details go to [www.emsesp.org](https://www.emsesp.org/).
## [3.7.1]
## **IMPORTANT! BREAKING CHANGES with 3.7.0**
## **IMPORTANT! BREAKING CHANGES since v3.7.0**
## Added
- Include HA "unit_of_meas", "stat_cla" and "dev_cla" attributes for Number sensors [#2149](https://github.com/emsesp/EMS-ESP32/issues/2149)
- include HA "unit_of_meas", "stat_cla" and "dev_cla" attributes for Number sensors [#2149](https://github.com/emsesp/EMS-ESP32/issues/2149)
- Bosch CS6800i AW - Silent Mode + Electrical Power Reduction (HP) [#2147](https://github.com/emsesp/EMS-ESP32/issues/2147)
## Fixed
- Modbus integration in 3.7.0 missing offset [#2148](https://github.com/emsesp/EMS-ESP32/issues/2148)
- fix changing TZ in NTPsettings without clearing enable+server, added DST support [#2142](https://github.com/emsesp/EMS-ESP32/issues/2142)
## Changed
- MQTT discovery template to support Domoticz [#2138](https://github.com/emsesp/EMS-ESP32/discussions/2138)

View File

@@ -47,7 +47,7 @@
"@preact/preset-vite": "^2.9.1",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/formidable": "^3",
"@types/node": "^22.8.5",
"@types/node": "^22.8.6",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@types/react-router-dom": "^5.3.3",

View File

@@ -1435,12 +1435,12 @@ __metadata:
languageName: node
linkType: hard
"@types/node@npm:^22.8.5":
version: 22.8.5
resolution: "@types/node@npm:22.8.5"
"@types/node@npm:^22.8.6":
version: 22.8.6
resolution: "@types/node@npm:22.8.6"
dependencies:
undici-types: "npm:~6.19.8"
checksum: 10c0/5e43553026c83f18bfa381d35c8fd608e69d12d0f0fe4601e8bb98b651a3b240be9d66c1f2f4decdbebb41d55b18e89238b02f3992d820d89801b9b3625ba8ab
checksum: 10c0/d3a11f2549234a91a4c5d0ff35ab4bdcb7ba34db4d3f1d189be39b8bd41c19aac98d117150a95a9c5a9d45b1014135477ea240b2b8317c86ae3d3cf1c3b3f8f4
languageName: node
linkType: hard
@@ -1657,7 +1657,7 @@ __metadata:
"@table-library/react-table-library": "npm:4.1.7"
"@trivago/prettier-plugin-sort-imports": "npm:^4.3.0"
"@types/formidable": "npm:^3"
"@types/node": "npm:^22.8.5"
"@types/node": "npm:^22.8.6"
"@types/react": "npm:^18.3.12"
"@types/react-dom": "npm:^18.3.1"
"@types/react-router-dom": "npm:^5.3.3"

View File

@@ -136,26 +136,10 @@ const char * EMSdevice::device_type_2_device_name(const uint8_t device_type) {
return F_(gateway);
case DeviceType::SWITCH:
return F_(switch);
case DeviceType::CONTROLLER:
return F_(controller);
case DeviceType::CONNECT:
return F_(connect);
case DeviceType::ALERT:
return F_(alert);
case DeviceType::EXTENSION:
return F_(extension);
case DeviceType::GENERIC:
return F_(generic);
case DeviceType::HEATSOURCE:
return F_(heatsource);
case DeviceType::VENTILATION:
return F_(ventilation);
case DeviceType::WATER:
return F_(water);
case DeviceType::POOL:
return F_(pool);
default:
return Helpers::translated_word(FL_(unknown), true);
case DeviceType::CONTROLLER : return F_(controller); case DeviceType::CONNECT : return F_(connect); case DeviceType::ALERT : return F_(alert);
case DeviceType::EXTENSION : return F_(extension); case DeviceType::GENERIC : return F_(generic);
case DeviceType::HEATSOURCE : return F_(heatsource); case DeviceType::VENTILATION : return F_(ventilation);
case DeviceType::WATER : return F_(water); case DeviceType::POOL : return F_(pool); default : return Helpers::translated_word(FL_(unknown), true);
}
}
@@ -234,46 +218,22 @@ uint8_t EMSdevice::device_name_2_device_type(const char * topic) {
return DeviceType::MIXER;
}
if (!strcmp(lowtopic, F_(switch))) {
return DeviceType::SWITCH;
}
if (!strcmp(lowtopic, F_(gateway))) {
return DeviceType::GATEWAY;
}
if (!strcmp(lowtopic, F_(alert))) {
return DeviceType::SWITCH;
}
if (!strcmp(lowtopic, F_(gateway))) { return DeviceType::GATEWAY; } if (!strcmp(lowtopic, F_(alert))) {
return DeviceType::ALERT;
}
if (!strcmp(lowtopic, F_(extension))) {
return DeviceType::EXTENSION;
}
if (!strcmp(lowtopic, F_(heatsource))) {
} if (!strcmp(lowtopic, F_(extension))) { return DeviceType::EXTENSION; } if (!strcmp(lowtopic, F_(heatsource))) {
return DeviceType::HEATSOURCE;
}
if (!strcmp(lowtopic, F_(ventilation))) {
return DeviceType::VENTILATION;
}
if (!strcmp(lowtopic, F_(water))) {
} if (!strcmp(lowtopic, F_(ventilation))) { return DeviceType::VENTILATION; } if (!strcmp(lowtopic, F_(water))) {
return DeviceType::WATER;
}
if (!strcmp(lowtopic, F_(pool))) {
return DeviceType::POOL;
}
} if (!strcmp(lowtopic, F_(pool))) { return DeviceType::POOL; }
// non EMS
if (!strcmp(lowtopic, F_(custom))) {
return DeviceType::CUSTOM;
}
if (!strcmp(lowtopic, F_(temperaturesensor))) {
if (!strcmp(lowtopic, F_(custom))) { return DeviceType::CUSTOM; } if (!strcmp(lowtopic, F_(temperaturesensor))) {
return DeviceType::TEMPERATURESENSOR;
}
if (!strcmp(lowtopic, F_(analogsensor))) {
return DeviceType::ANALOGSENSOR;
}
if (!strcmp(lowtopic, F_(scheduler))) {
} if (!strcmp(lowtopic, F_(analogsensor))) { return DeviceType::ANALOGSENSOR; } if (!strcmp(lowtopic, F_(scheduler))) {
return DeviceType::SCHEDULER;
}
if (!strcmp(lowtopic, F_(system))) {
return DeviceType::SYSTEM;
}
} if (!strcmp(lowtopic, F_(system))) { return DeviceType::SYSTEM; }
return DeviceType::UNKNOWN;
}
@@ -1845,9 +1805,9 @@ void EMSdevice::mqtt_ha_entity_config_create() {
uint16_t count = 0;
// check the state of each of the device values
// create climate if roomtemp is visible
// create the discovery topic if if hasn't already been created, not a command (like reset) and is active and visible
for (auto & dv : devicevalues_) {
// create climate when we reach the haclimate entity
if (!strcmp(dv.short_name, FL_(haclimate)[0]) && !dv.has_state(DeviceValueState::DV_API_MQTT_EXCLUDE) && dv.has_state(DeviceValueState::DV_ACTIVE)) {
if (*(int8_t *)(dv.value_p) == 1 && (!dv.has_state(DeviceValueState::DV_HA_CONFIG_CREATED) || dv.has_state(DeviceValueState::DV_HA_CLIMATE_NO_RT))) {
if (Mqtt::publish_ha_climate_config(dv.tag, true, false, dv.min, dv.max)) { // roomTemp

View File

@@ -1102,7 +1102,7 @@ bool Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdev
char val_obj[100];
char val_cond[200];
if (is_nested() && tag >= DeviceValueTAG::TAG_HC1) {
snprintf(val_obj, sizeof(val_obj), "value_json.%s['%s']", EMSdevice::tag_to_mqtt(tag), entity);
snprintf(val_obj, sizeof(val_obj), "value_json['%s']['%s']", EMSdevice::tag_to_mqtt(tag), entity);
snprintf(val_cond, sizeof(val_cond), "value_json.%s is defined and %s is defined", EMSdevice::tag_to_mqtt(tag), val_obj);
} else {
snprintf(val_obj, sizeof(val_obj), "value_json['%s']", entity);
@@ -1255,6 +1255,8 @@ void Mqtt::add_ha_uom(JsonObject doc, const uint8_t type, const uint8_t uom, con
}
bool Mqtt::publish_ha_climate_config(const int8_t tag, const bool has_roomtemp, const bool remove, const int16_t min, const uint32_t max) {
// TODO: check if Domoticz supports climate via MQTT discovery, otherwise exit this function if (discovery_type() != discoveryType::HOMEASSISTANT
uint8_t hc_num = tag;
char topic[Mqtt::MQTT_TOPIC_MAX_SIZE];

View File

@@ -1 +1 @@
#define EMSESP_APP_VERSION "3.7.1-dev.1"
#define EMSESP_APP_VERSION "3.7.1-dev.2"