Blackymas / NSPanel_HA_Blueprint

This allows you to configure your complete NSPanel via Blueprint with UI and without changing anything in the code
1.33k stars 247 forks source link

Failure to do updates #1402

Closed Emrill closed 8 months ago

Emrill commented 8 months ago

I have had a NSpanel running this blue print for a few months now then all of a sudden when it updates it comes up a error this is the log, I have turned everything thats showing as different colour (red or blue) into bold

INFO ESPHome 2023.11.6
INFO Reading configuration /config/esphome/nspanel_esphome.yaml...
**Failed config**

**api: [source /config/esphome/nspanel_esphome.yaml:160]
  services:** 
    - service: upload_tft
      then: 
        - binary_sensor.template.publish: 
            id: nextion_init
            state: False
        - lambda: id(disp1)->upload_tft();
    - service: upload_tft_url
      variables: 
        url: string
      then: 
        - binary_sensor.template.publish: 
            id: nextion_init
            state: False
        - lambda: id(disp1)->set_tft_url(url.c_str());
        - lambda: id(disp1)->upload_tft();
    - service: send_command_printf
      variables: 
        cmd: string
      then: 
        - lambda: id(disp1).send_command_printf("%s", cmd.c_str());
    - service: send_command_text_printf
      variables: 
        component: string
        message: string
      then: 
        - wait_until: 
            binary_sensor.is_on: nextion_init
        - lambda: id(disp1).set_component_text_printf(component.c_str(), "%s", message.c_str());
    - service: send_command_value
      variables: 
        component: string
        message: int
      then: 
        - wait_until: 
            binary_sensor.is_on: nextion_init
        - lambda: id(disp1).set_component_value(component.c_str(), message);
    - service: send_command_hide
      variables: 
        component: string
      then: 
        - wait_until: 
            binary_sensor.is_on: nextion_init
        - lambda: id(disp1).hide_component(component.c_str());
    - service: send_command_show
      variables: 
        component: string
      then: 
        - wait_until: 
            binary_sensor.is_on: nextion_init
        - lambda: id(disp1).show_component(component.c_str());
    - service: send_command_show_all
      then: 
        - wait_until: 
            binary_sensor.is_on: nextion_init
        - lambda: id(disp1).show_component("255");
    - service: send_command_font_color
      variables: 
        component: string
        message: int
      then: 
        - wait_until: 
            binary_sensor.is_on: nextion_init
        - lambda: id(disp1).set_component_font_color(component.c_str(), message);
    - service: send_command_background_color
      variables: 
        component: string
        message: int
      then: 
        - wait_until: 
            binary_sensor.is_on: nextion_init
        - lambda: id(disp1).set_component_background_color(component.c_str(), message);
    - service: notification_show
      **variables:** 
        label: string

        **[text] is an invalid option for [variables].**
        text: string
      then: 
        - wait_until: 
            binary_sensor.is_on: nextion_init
        - lambda: |-
            id(disp1).send_command_printf("page notification");
            id(disp1).set_component_text_printf("notification.notifi_label", "%s", label.c_str());
            id(disp1).set_component_text_printf("notification.notifi_text01", "%s", text.c_str());
            id(notification_label).publish_state(label.c_str());
            id(notification_text).publish_state(text.c_str());
        - switch.turn_on: notification_unread
        - if: 
            condition: 
              switch.is_on: notification_sound
            then: 
              - rtttl.play: two short:d=4,o=5,b=100:16e6,16e6
    - service: notification_clear
      then: 
        - wait_until: 
            binary_sensor.is_on: nextion_init
        - lambda: |-
            id(notification_label).publish_state("");
            id(notification_text).publish_state("");
        - switch.turn_off: notification_unread
    - service: set_settings_entity
      variables: 
        entity: string
      then: 
        - wait_until: 
            binary_sensor.is_on: nextion_init
        - lambda: id(settings_entity).publish_state(entity.c_str());
    - service: play_rtttl
      variables: 
        song_str: string
      then: 
        - rtttl.play: 
            rtttl: !lambda |-
              return song_str;
    - service: qr_code
      variables: 
        qrdata: string
      then: 
        - wait_until: 
            binary_sensor.is_on: nextion_init
        - lambda: |-
            id(disp1).send_command_printf("page qrcode");
            id(disp1).set_component_text_printf("qrcode.qrcode_value", "%s", qrdata.c_str());
    - service: set_climate
      variables: 
        current_temp: float
        target_temp: float
        temp_step: int
        total_steps: int
        slider_val: int
        temp_offset: int
        climate_icon: string
      then: 
        - wait_until: 
            binary_sensor.is_on: nextion_init
        - lambda: |-
            if (target_temp > -999)
              {
                id(disp1).set_component_value("climateslider", slider_val);
                id(disp1).set_component_text_printf("target_temp", "%.1f°", target_temp);
                id(disp1).set_component_text_printf("target_icon", "%s", climate_icon.c_str());
                id(disp1).show_component("target_icon");
                id(disp1).show_component("target_temp");
                id(disp1).show_component("climateslider");
                id(disp1).show_component("decrease_temp");
                id(disp1).show_component("increase_temp");
              }
              else
              {
                id(disp1).hide_component("target_icon");
                id(disp1).hide_component("target_temp");
                id(disp1).hide_component("climateslider");
                id(disp1).hide_component("decrease_temp");
                id(disp1).hide_component("increase_temp");
              }
        - lambda: |-
            id(disp1).send_command_printf("climateslider.maxval=%i", total_steps);
            id(disp1).set_component_value("temp_offset", temp_offset);
            id(disp1).set_component_value("temp_step", temp_step);
            id(disp1).set_component_text_printf("current_temp", "%.1f°", current_temp);
            id(disp1).show_component("current_temp");
            id(disp1).show_component("current_icon");
    - service: set_button
      variables: 
        btn_id: string
        btn_pic: int
        btn_bg: int
        btn_icon_font: int
        btn_txt_font: int
        btn_bri_font: int
        btn_icon: string
        btn_label: string
        btn_bri_txt: string
      then: 
        - wait_until: 
            binary_sensor.is_on: nextion_init
        - lambda: |-
            // ESP_LOGD("nextion", "set button %s", btn_id.c_str());
            std::string btnicon = btn_id.c_str() + std::string("icon");
            std::string btntext = btn_id.c_str() + std::string("text");
            std::string btnbri = btn_id.c_str() + std::string("bri");
            id(disp1).send_command_printf("%spic.pic=%i", btn_id.c_str(), btn_pic);
            id(disp1).set_component_background_color(btnicon.c_str(), btn_bg);
            id(disp1).set_component_background_color(btntext.c_str(), btn_bg);
            id(disp1).set_component_background_color(btnbri.c_str(), btn_bg);
            id(disp1).set_component_font_color(btnicon.c_str(), btn_icon_font);
            id(disp1).set_component_font_color(btntext.c_str(), btn_txt_font);
            id(disp1).set_component_font_color(btnbri.c_str(), btn_bri_font);
            id(disp1).set_component_text_printf(btnicon.c_str(), "%s", btn_icon.c_str());
            id(disp1).set_component_text_printf(btntext.c_str(), "%s", btn_label.c_str());
            // id(disp1).set_component_text_printf(btnbri.c_str(), "%s", btn_bri_txt.c_str());
            if (strcmp(btn_bri_txt.c_str(), "0") != 0) {
              id(disp1).set_component_text_printf(btnbri.c_str(), "%s", btn_bri_txt.c_str());
            } else {
              id(disp1).set_component_text_printf(btnbri.c_str(), " ");
            }
    - service: wake_up_display
      variables: 
        option: string
      then: 
        - lambda: |-
            DynamicJsonDocument doc(1024);
            deserializeJson(doc, id(disp1_nspanel_event).state);
            std::string page = doc["page"];
            if (page == "screensaver") {
              id(disp1).send_command_printf("page home");
            } else {
              if (page == "home"){
                id(disp1).send_command_printf("dim=brightness.val");
              }
            }
        - if: 
            condition: 
              - lambda: return option == "keep_wake";
            then: 
              - lambda: id(disp1).send_command_printf("home.dimtimer.en=1");
              - lambda: id(disp1).send_command_printf("home.sleeptimer.en=1");
        - if: 
            condition: 
              - lambda: return option == "keep_page";
            then: 
              - lambda: id(disp1).send_command_printf("home.dimtimer.en=1");
              - lambda: id(disp1).send_command_printf("home.sleeptimer.en=1");
              - lambda: id(page_timer)->execute(int(id(page_timeout).state));
    - service: set_entity
      variables: 
        ent_id: string
        ent_icon: string
        ent_label: string
        ent_value: string
        ent_value_xcen: string
      then: 
        - wait_until: 
            binary_sensor.is_on: nextion_init
        - lambda: |-
            // ESP_LOGD("nextion", "set entity %s", ent_id.c_str());
            std::string enticon = ent_id.c_str() + std::string("_pic");
            std::string entlabel = ent_id.c_str() + std::string("_label");
            std::string entxcen = ent_id.c_str() + std::string(".xcen=") + ent_value_xcen.c_str();
            id(disp1).set_component_text_printf(enticon.c_str(), "%s", ent_icon.c_str());
            if (strcmp(ent_icon.c_str(), "0") != 0) {
              id(disp1).set_component_text_printf(enticon.c_str(), "%s", ent_icon.c_str());
            }
            id(disp1).set_component_text_printf(entlabel.c_str(), "%s", ent_label.c_str());
            id(disp1).set_component_text_printf(ent_id.c_str(), "%s", ent_value.c_str());
            if (strcmp(ent_value_xcen.c_str(), "0") != 0) {
              id(disp1).send_command_printf("%s", entxcen.c_str());
            }
edwardtfn commented 8 months ago

You are using an older version of this project's files. Try to clean your build files and make sure your settings are pointing to the repo, then it should work fine.

edwardtfn commented 8 months ago

By the way, looks like you are using the file nspanel_esphome.yaml locally. I would suggest you use the reference to the file in the server and keep on your local file only the customizations you need, so you will avoid this kind of issue in the future.

edwardtfn commented 8 months ago

Hey @Emrill, any update to this?

edwardtfn commented 8 months ago

I'm closing this as it is quiet here, but please feel free to reopen if you are still facing this issue.