diff --git a/esphome/nspanel_esphome_core.yaml b/esphome/nspanel_esphome_core.yaml index 8450774..9a8acb4 100644 --- a/esphome/nspanel_esphome_core.yaml +++ b/esphome/nspanel_esphome_core.yaml @@ -1756,11 +1756,6 @@ text_sensor: nextion_id: disp1 component_name: localevent internal: true - # filters: - # - lambda: |- - # x = x.c_str(); - # x.shrink_to_fit(); - # return x; on_value: then: - lambda: |- @@ -1835,20 +1830,22 @@ text_sensor: {"type", "service_call"}, {"service", "light.turn_on"}, {"key", "rgb_color"}, - {"red",std::to_string(rgb_color[0].as())}, - {"green",std::to_string(rgb_color[1].as())}, - {"blue",std::to_string(rgb_color[2].as())}, + {"red",to_string(rgb_color[0].as())}, + {"green",to_string(rgb_color[1].as())}, + {"blue",to_string(rgb_color[2].as())}, {"entity", detailed_entity->state.c_str()} }); } } } else if (page == "media_player") { - if (key == "volume_mute") + if (key == "volume_mute") { ha_call_service->execute("media_player.volume_mute", "is_volume_muted", value.c_str(), detailed_entity->state.c_str()); - else if (key == "volume_set") - ha_call_service->execute("media_player.volume_set", "volume_level", to_string(stof(value) / 100), detailed_entity->state.c_str()); - else if (!key.empty()) + } else if (key == "volume_set") { + const float value_float = json["value"].as(); + ha_call_service->execute("media_player.volume_set", "volume_level", to_string(value_float / 100.0f), detailed_entity->state.c_str()); + } else if (!key.empty()) { ha_call_service->execute((std::string("media_player.") + key.c_str()), "", "", detailed_entity->state.c_str()); + } } }