Skip to content

Commit

Permalink
Merge pull request #1670 from proddy/dev
Browse files Browse the repository at this point in the history
fix minor lint warnings
  • Loading branch information
proddy authored Mar 24, 2024
2 parents 6905abf + cf489f7 commit 6cab020
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG_LATEST.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@
## Fixed

## Changed

- Refresh UI - moving settings to one location [#1665](https://github.com/emsesp/EMS-ESP32/issues/1665)
16 changes: 8 additions & 8 deletions src/mqtt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1310,18 +1310,18 @@ void Mqtt::add_ha_sections_to_doc(const char * name,
JsonArray avty = config["avty"].to<JsonArray>();
JsonDocument avty_json;

const char * tpl_draft = "{{'online' if %s else 'offline'}}";

char tpl[150];
// EMS-ESP status check
// snprintf(tpl, sizeof(tpl), "%s/status", Mqtt::base().c_str());
// avty_json["t"] = tpl;
// snprintf(tpl, sizeof(tpl), tpl_draft, "value == 'online'");
// avty_json["val_tpl"] = tpl;
// avty.add(avty_json); // returns 0 if no mem

// skip conditional Jinja2 templates if not home assistant
if (discovery_type() == discoveryType::HOMEASSISTANT) {
// EMS-ESP status check
// snprintf(tpl, sizeof(tpl), "%s/status", Mqtt::base().c_str());
// avty_json["t"] = tpl;
// snprintf(tpl, sizeof(tpl), tpl_draft, "value == 'online'");
// avty_json["val_tpl"] = tpl;
// avty.add(avty_json); // returns 0 if no mem
const char * tpl_draft = "{{'online' if %s else 'offline'}}";

// condition 1
avty_json.clear();
avty_json["t"] = state_t;
Expand Down
2 changes: 1 addition & 1 deletion src/web/WebCustomEntityService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ StateUpdateResult WebCustomEntity::update(JsonObject root, WebCustomEntity & web
if (root["entities"].is<JsonArray>()) {
for (const JsonObject ei : root["entities"].as<JsonArray>()) {
auto entityItem = CustomEntityItem();
entityItem.ram = ei["ram"] | 0;
entityItem.ram = ei["ram"];
entityItem.device_id = ei["device_id"]; // send as numeric, will be converted to string in web
entityItem.type_id = ei["type_id"];
entityItem.offset = ei["offset"];
Expand Down

0 comments on commit 6cab020

Please sign in to comment.