Clean-up new json
This commit is contained in:
@@ -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<int>())},
|
||||
{"green",std::to_string(rgb_color[1].as<int>())},
|
||||
{"blue",std::to_string(rgb_color[2].as<int>())},
|
||||
{"red",to_string(rgb_color[0].as<int>())},
|
||||
{"green",to_string(rgb_color[1].as<int>())},
|
||||
{"blue",to_string(rgb_color[2].as<int>())},
|
||||
{"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<float>();
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user