mirror of
https://github.com/esphome/esphome.git
synced 2024-11-24 16:08:10 +01:00
[online_image] Bugfix: Use std::string instead of const char * (#7556)
Some checks are pending
CI / Check black (push) Blocked by required conditions
CI / Create common environment (push) Waiting to run
CI / Check flake8 (push) Blocked by required conditions
CI / Check pylint (push) Blocked by required conditions
CI / Check pyupgrade (push) Blocked by required conditions
CI / Run script/ci-custom (push) Blocked by required conditions
CI / Run pytest (push) Blocked by required conditions
CI / Check clang-format (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP32 Arduino 1/4 (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP32 Arduino 2/4 (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP32 Arduino 3/4 (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP32 Arduino 4/4 (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP32 IDF (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP8266 (push) Blocked by required conditions
CI / list-components (push) Blocked by required conditions
CI / Component test (push) Blocked by required conditions
CI / Split components for testing into 20 groups maximum (push) Blocked by required conditions
CI / Test split components (push) Blocked by required conditions
CI / CI Status (push) Blocked by required conditions
YAML lint / yamllint (push) Waiting to run
Some checks are pending
CI / Check black (push) Blocked by required conditions
CI / Create common environment (push) Waiting to run
CI / Check flake8 (push) Blocked by required conditions
CI / Check pylint (push) Blocked by required conditions
CI / Check pyupgrade (push) Blocked by required conditions
CI / Run script/ci-custom (push) Blocked by required conditions
CI / Run pytest (push) Blocked by required conditions
CI / Check clang-format (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP32 Arduino 1/4 (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP32 Arduino 2/4 (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP32 Arduino 3/4 (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP32 Arduino 4/4 (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP32 IDF (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP8266 (push) Blocked by required conditions
CI / list-components (push) Blocked by required conditions
CI / Component test (push) Blocked by required conditions
CI / Split components for testing into 20 groups maximum (push) Blocked by required conditions
CI / Test split components (push) Blocked by required conditions
CI / CI Status (push) Blocked by required conditions
YAML lint / yamllint (push) Waiting to run
This commit is contained in:
parent
1d91601094
commit
b8630363e0
4 changed files with 12 additions and 5 deletions
|
@ -125,7 +125,7 @@ async def online_image_action_to_code(config, action_id, template_arg, args):
|
||||||
var = cg.new_Pvariable(action_id, template_arg, paren)
|
var = cg.new_Pvariable(action_id, template_arg, paren)
|
||||||
|
|
||||||
if CONF_URL in config:
|
if CONF_URL in config:
|
||||||
template_ = await cg.templatable(config[CONF_URL], args, cg.const_char_ptr)
|
template_ = await cg.templatable(config[CONF_URL], args, cg.std_string)
|
||||||
cg.add(var.set_url(template_))
|
cg.add(var.set_url(template_))
|
||||||
return var
|
return var
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,7 @@ class OnlineImage : public PollingComponent,
|
||||||
template<typename... Ts> class OnlineImageSetUrlAction : public Action<Ts...> {
|
template<typename... Ts> class OnlineImageSetUrlAction : public Action<Ts...> {
|
||||||
public:
|
public:
|
||||||
OnlineImageSetUrlAction(OnlineImage *parent) : parent_(parent) {}
|
OnlineImageSetUrlAction(OnlineImage *parent) : parent_(parent) {}
|
||||||
TEMPLATABLE_VALUE(const char *, url)
|
TEMPLATABLE_VALUE(std::string, url)
|
||||||
void play(Ts... x) override {
|
void play(Ts... x) override {
|
||||||
this->parent_->set_url(this->url_.value(x...));
|
this->parent_->set_url(this->url_.value(x...));
|
||||||
this->parent_->update();
|
this->parent_->update();
|
||||||
|
@ -170,7 +170,6 @@ template<typename... Ts> class OnlineImageSetUrlAction : public Action<Ts...> {
|
||||||
template<typename... Ts> class OnlineImageReleaseAction : public Action<Ts...> {
|
template<typename... Ts> class OnlineImageReleaseAction : public Action<Ts...> {
|
||||||
public:
|
public:
|
||||||
OnlineImageReleaseAction(OnlineImage *parent) : parent_(parent) {}
|
OnlineImageReleaseAction(OnlineImage *parent) : parent_(parent) {}
|
||||||
TEMPLATABLE_VALUE(const char *, url)
|
|
||||||
void play(Ts... x) override { this->parent_->release(); }
|
void play(Ts... x) override { this->parent_->release(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -4,13 +4,13 @@ spi:
|
||||||
- id: spi_main_lcd
|
- id: spi_main_lcd
|
||||||
clk_pin: 16
|
clk_pin: 16
|
||||||
mosi_pin: 17
|
mosi_pin: 17
|
||||||
miso_pin: 15
|
miso_pin: 18
|
||||||
|
|
||||||
display:
|
display:
|
||||||
- platform: ili9xxx
|
- platform: ili9xxx
|
||||||
id: main_lcd
|
id: main_lcd
|
||||||
model: ili9342
|
model: ili9342
|
||||||
cs_pin: 12
|
cs_pin: 20
|
||||||
dc_pin: 13
|
dc_pin: 13
|
||||||
reset_pin: 21
|
reset_pin: 21
|
||||||
invert_colors: true
|
invert_colors: true
|
||||||
|
|
|
@ -34,4 +34,12 @@ time:
|
||||||
- online_image.set_url:
|
- online_image.set_url:
|
||||||
id: online_rgba_image
|
id: online_rgba_image
|
||||||
url: http://www.example.org/example.png
|
url: http://www.example.org/example.png
|
||||||
|
- online_image.set_url:
|
||||||
|
id: online_rgba_image
|
||||||
|
url: !lambda |-
|
||||||
|
return "http://www.example.org/example.png";
|
||||||
|
- online_image.set_url:
|
||||||
|
id: online_rgba_image
|
||||||
|
url: !lambda |-
|
||||||
|
return str_sprintf("http://homeassistant.local:8123");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue