Use initial_value for fw_url

It should be available together with the component
This commit is contained in:
Edward Firmo
2024-04-09 08:30:29 +02:00
parent 75c35399f1
commit 376d91aa5a
2 changed files with 18 additions and 16 deletions

View File

@@ -32,8 +32,8 @@ api:
url: string url: string
then: then:
- ota_http.flash: - ota_http.flash:
md5_url: !lambda return id(fw_url).state + ".md5"; md5_url: !lambda return fw_url->state + ".md5";
url: !lambda return id(fw_url).state; url: !lambda return fw_url->state;
- lambda: |- - lambda: |-
static const char *const TAG = "prebuilt.button.bt_firmware_update"; static const char *const TAG = "prebuilt.button.bt_firmware_update";
ESP_LOGE(TAG, "Firmware update failed!"); ESP_LOGE(TAG, "Firmware update failed!");
@@ -50,8 +50,8 @@ button:
on_press: on_press:
then: then:
- ota_http.flash: - ota_http.flash:
md5_url: !lambda return id(fw_url).state + ".md5"; md5_url: !lambda return fw_url->state + ".md5";
url: !lambda return id(fw_url).state; url: !lambda return fw_url->state;
- lambda: |- - lambda: |-
static const char *const TAG = "prebuilt.button.bt_firmware_update"; static const char *const TAG = "prebuilt.button.bt_firmware_update";
ESP_LOGE(TAG, "Firmware update failed!"); ESP_LOGE(TAG, "Firmware update failed!");
@@ -70,12 +70,6 @@ esphome:
project: project:
name: esphome.NSPanel_HA_Blueprint name: esphome.NSPanel_HA_Blueprint
version: "${version}" version: "${version}"
on_boot:
- priority: 602.0
then:
- text.set:
id: fw_url
value: "https://raw.githubusercontent.com/Blackymas/NSPanel_HA_Blueprint/main/prebuilt/nspanel_esphome_prebuilt.bin"
platformio_options: platformio_options:
build_flags: build_flags:
- -D NSPANEL_HA_BLUEPRINT_PREBUILT - -D NSPANEL_HA_BLUEPRINT_PREBUILT
@@ -111,6 +105,16 @@ text:
icon: mdi:cloud-download icon: mdi:cloud-download
mode: text mode: text
optimistic: true optimistic: true
entity_category: config
internal: false
update_interval: never
restore_value: true
initial_value: "https://raw.githubusercontent.com/Blackymas/NSPanel_HA_Blueprint/main/prebuilt/nspanel_esphome_prebuilt.bin"
on_value:
then:
- lambda: |-
ESP_LOGD("text.fw_url", "New Firmware URL set: %s", x.c_str());
wifi: wifi:
networks: !remove networks: !remove

View File

@@ -28,10 +28,8 @@ esphome:
platformio_options: platformio_options:
build_flags: build_flags:
- -D NSPANEL_HA_BLUEPRINT_PREBUILT_WALL_DISPLAY - -D NSPANEL_HA_BLUEPRINT_PREBUILT_WALL_DISPLAY
on_boot:
- priority: 602.0 text:
then: - id: !extend fw_url
- text.set: initial_value: "https://raw.githubusercontent.com/Blackymas/NSPanel_HA_Blueprint/main/prebuilt/wall_display.bin"
id: fw_url
value: "https://raw.githubusercontent.com/Blackymas/NSPanel_HA_Blueprint/main/prebuilt/wall_display.bin"
... ...