Clean-up new json

This commit is contained in:
Edward Firmo
2024-03-29 21:53:47 +01:00
parent ae05f133e1
commit c3d55a284e

View File

@@ -1756,11 +1756,6 @@ text_sensor:
nextion_id: disp1 nextion_id: disp1
component_name: localevent component_name: localevent
internal: true internal: true
# filters:
# - lambda: |-
# x = x.c_str();
# x.shrink_to_fit();
# return x;
on_value: on_value:
then: then:
- lambda: |- - lambda: |-
@@ -1835,22 +1830,24 @@ text_sensor:
{"type", "service_call"}, {"type", "service_call"},
{"service", "light.turn_on"}, {"service", "light.turn_on"},
{"key", "rgb_color"}, {"key", "rgb_color"},
{"red",std::to_string(rgb_color[0].as<int>())}, {"red",to_string(rgb_color[0].as<int>())},
{"green",std::to_string(rgb_color[1].as<int>())}, {"green",to_string(rgb_color[1].as<int>())},
{"blue",std::to_string(rgb_color[2].as<int>())}, {"blue",to_string(rgb_color[2].as<int>())},
{"entity", detailed_entity->state.c_str()} {"entity", detailed_entity->state.c_str()}
}); });
} }
} }
} else if (page == "media_player") { } 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()); ha_call_service->execute("media_player.volume_mute", "is_volume_muted", value.c_str(), detailed_entity->state.c_str());
else if (key == "volume_set") } 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()); const float value_float = json["value"].as<float>();
else if (!key.empty()) 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()); ha_call_service->execute((std::string("media_player.") + key.c_str()), "", "", detailed_entity->state.c_str());
} }
} }
}
##### Versioning ##### ##### Versioning #####
- id: version_tft - id: version_tft