Blackymas / NSPanel_HA_Blueprint

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

`Bug` official wiki refers to the undefined script "setup_sequence" #2298

Closed vitalyrepin closed 3 weeks ago

vitalyrepin commented 3 weeks ago

TFT Version

4.3.11

Firmware Version

4.3.11

Blueprint Version

4.3.11

Panel Model

EU

What is the bug?

I follow instructions in the official wiki: https://github.com/Blackymas/NSPanel_HA_Blueprint/blob/main/docs/customization.md#restart-with-15s-button-press

After adding this part to the yaml, I am getting the following error:

Couldn't find ID 'setup_sequence'. Please check you have defined an ID with that name in your configuration.

and firmware does not compile.

Steps to Reproduce

Follow these instructions: https://github.com/Blackymas/NSPanel_HA_Blueprint/blob/main/docs/customization.md#restart-with-15s-button-press

Your Panel's YAML

(relevant part only)

# Restarts the Nextion display after pressing and holding the left button for 15s
  - id: !extend left_button
    on_multi_click:
      - timing:
          - ON for at least 15.0s
        invalid_cooldown: ${invalid_cooldown}
        then:  # Restart the display
          - switch.turn_off: screen_power
          - delay: 5s
          - switch.turn_on: screen_power
          - delay: 2s
          - lambda: disp1->soft_reset();
          - delay: 2s
          - script.execute: setup_sequence  
  # Restarts ESPHome after pressing and holding the right button for 15s
  - id: !extend right_button
    on_multi_click:
      - timing:
          - ON for at least 15.0s
        invalid_cooldown: ${invalid_cooldown}
        then:  # Restart the panel
          - button.press: restart_nspanel

ESPHome Logs

INFO ESPHome 2024.8.1
INFO Reading configuration /config/nspanel-2024.yaml...
Failed config

binary_sensor.gpio: [source /config/.esphome/packages/566b10a3/esphome/nspanel_esphome_core.yaml:1246]
  platform: gpio
  name: Left Button
  id: left_button
  pin: 
    number: 14
    inverted: True
    mode: 
      input: True
      output: False
      open_drain: False
      pullup: False
      pulldown: False
    ignore_pin_validation_error: False
    ignore_strapping_warning: False
    drive_strength: 20.0
  on_multi_click: 
    - timing: 
        - state: True
          min_length: 800ms
      invalid_cooldown: 100ms
      then: 
        - logger.log: 
            format: Left button - Long click
            level: DEBUG
            tag: main
            args: []
        - script.execute: 
            id: ha_button
            page: !lambda |-
              return current_page->state.c_str();
            component: hw_bt_left
            command: long_click
    - timing: 
        - state: True
          min_length: 0ms
          max_length: 800ms
      invalid_cooldown: 100ms
      then: 
        - logger.log: 
            format: Left button - Short click
            level: DEBUG
            tag: main
            args: []
        - if: 
            condition: 
              or: 
                - lambda: !lambda |-
                    return (id(relay_settings) & RelaySettings::Relay1_Local);
                - and: 
                    - lambda: !lambda |-
                        return (id(relay_settings) & RelaySettings::Relay1_Fallback);
                    - or: 
                        - not: 
                            and: 
                              - api.connected: {}
                        - not: 
                            and: 
                              - wifi.connected: {}
            then: 
              - switch.toggle: 
                  id: relay_1
        - script.execute: 
            id: ha_button
            page: !lambda |-
              return current_page->state.c_str();
            component: hw_bt_left
            command: short_click
    - timing: 
        - state: True
          min_length: 15s
      invalid_cooldown: 100ms
      then: 
        - switch.turn_off: 
            id: screen_power
        - delay: 5s
        - switch.turn_on: 
            id: screen_power
        - delay: 2s
        - lambda: !lambda |-
            disp1->soft_reset();
        - delay: 2s
        - script.execute: 

            Couldn't find ID 'setup_sequence'. Please check you have defined an ID with that name in your configuration.
            id: setup_sequence
  on_click: 
    - then: []

Home Assistant Logs

No response

edwardtfn commented 3 weeks ago

Good catch! Keeping the docs updated is the hardest part of this project. 😆

I've already updated in dev and it will be released soon. Meanwhile, you can just remove that line, as the boot sequence is now automatically called when the display is restarted.

# Restarts the Nextion display after pressing and holding the left button for 15s
  - id: !extend left_button
    on_multi_click:
      - timing:
          - ON for at least 15.0s
        invalid_cooldown: ${invalid_cooldown}
        then:  # Restart the display
          - switch.turn_off: screen_power
          - delay: 5s
          - switch.turn_on: screen_power
          - delay: 2s
          - lambda: disp1->soft_reset();

  # Restarts ESPHome after pressing and holding the right button for 15s
  - id: !extend right_button
    on_multi_click:
      - timing:
          - ON for at least 15.0s
        invalid_cooldown: ${invalid_cooldown}
        then:  # Restart the panel
          - button.press: restart_nspanel