Blackymas / NSPanel_HA_Blueprint

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

Can't Build with BLE Tracker Addon #2155

Closed Airey001 closed 1 month ago

Airey001 commented 3 months ago

TFT Version

4.3.8

ESPHome Version

204.5.5

Blueprint Version

4.3.8

Panel Model

US

What is the bug?

Whn trying to build or clean with the BLE Tracker add on i get this with all 3 panels i have

Failed config

binary_sensor.template: [source /data/packages/566b10a3/esphome/nspanel_esphome_addon_ble_tracker.yaml:28] platform: template

ID ble_component_status redefined! Check binary_sensor->3->id. id: ble_component_status name: BLE component status icon: mdi:bluetooth entity_category: diagnostic lambda: !lambda |- return ble_component->is_active(); disabled_by_default: False

Steps to Reproduce

unComment the BLE Tracker line in the YAML and build

Your Panel's YAML

No response

ESPHome Logs

No response

Home Assistant Logs

No response

danir-de commented 3 months ago

I'm having the same issue when upgrading from 4.3.7. Disabling the Bluetooth tracker addon "fixes" the issue, when compiling a new firmware.

edwardtfn commented 3 months ago

This is odd. I had no issues compiling with ESPHome 2024.5.5.

Have you tried cleaning-up the build files? Could you please share your yaml? Please remove any sensitive info before sharing.

Airey001 commented 3 months ago

So yes the error happens when trying to to clean too.

Here is my YAML NSPANEL.YAML.txt

edwardtfn commented 3 months ago

Ok, please comment out ble_tracking, as ble_proxy already contains that.

You can also remove your reference to ota, api, logger and esp-idf, as all of those are part of the Basic package.

This should work:

substitutions:
  ###### CHANGE ME START ######
  device_name: "livingroom-nspanel" 
  wifi_ssid: !secret wifi_ssid
  wifi_password: !secret wifi_password

  nextion_update_url: "http://172.16.1.20:8123/local/nspanel_us.tft"
  nextion_blank_url: "http://172.16.1.20:8123/local/nspanel_blank.tft"
  temp_units: "F"

  ##### addon-configuration #####
  ## addon_climate ##
  # addon_climate_heater_relay: "1" # possible values: 1/2

  ##### CHANGE ME END #####

web_server:
  port: 80
  # https://esphome.io/components/web_server.html

packages:
  remote_package:
    url: https://github.com/Blackymas/NSPanel_HA_Blueprint
    ref: main
    refresh: 300s
    files:
      - nspanel_esphome.yaml # Basic package
      # Optional advanced and add-on configurations
      # - esphome/nspanel_esphome_advanced.yaml
      # - esphome/nspanel_esphome_addon_ble_tracker.yaml
      - esphome/nspanel_esphome_addon_bluetooth_proxy.yaml
      # - esphome/nspanel_esphome_addon_climate_cool.yaml
      # - esphome/nspanel_esphome_addon_climate_heat.yaml
      # - esphome/nspanel_esphome_addon_climate_dual.yaml
illuzn commented 3 months ago

Issue appears to arrive from this commit: https://github.com/Blackymas/NSPanel_HA_Blueprint/blob/afb9cd4bc5dacd9d388935f4f6000243fd0e94af/esphome/nspanel_esphome_addon_bluetooth_proxy.yaml#L20

Which was previously this: https://github.com/Blackymas/NSPanel_HA_Blueprint/blob/544b2bc9cf31d9f108f2e2c966e688f077354f16/esphome/nspanel_esphome_addon_bluetooth_proxy.yaml#L15-L16

This undocumented changed seems to cause a circular reference which throws this error. The previous behaviour did not have this circular reference and was not an issue.

Suggest a change to the release notes as follows (emphasis is on added sentence):

Bluetooth Proxy Addon Crash Fixed (https://github.com/Blackymas/NSPanel_HA_Blueprint/issues/2119) Criticality: Major Affected Components: ESPHome Issue Number: https://github.com/Blackymas/NSPanel_HA_Blueprint/issues/2119 Description: Resolved a critical issue where the Bluetooth Proxy addon caused the NSPanel to crash. This fix stabilizes the Bluetooth functionality, ensuring reliable performance when the Bluetooth Proxy addon is enabled. Please note, it is not necessary to enable both ble tracker and bluetooth proxy packages (doing so will result in a build crash).

I'll PR a documentation update to the addon page for this too since those of us who are used to the ESPHome world would naturally enable both thinking we are doing the right thing.

danir-de commented 3 months ago

Does this mean that the bluetooth proxy package automatically infers and thus enables the ble tracker functionality?

Edit: Yes it does! See the updated documentation:

[!IMPORTANT] This add-on includes the BLE Tracker add-on as well. Do not include that package in your configuration (or otherwise include esp32_ble_tracker in your configuration) otherwise you may experience build errors.

edwardtfn commented 3 months ago

And this is from ESPHome... Every time you add bluetooth_proxy, the components ble_client and ble_tracker are automatically added.

https://github.com/esphome/esphome/blob/b09781afa5d2fec5936b8ba71cad6b89b7f49a64/esphome/components/bluetooth_proxy/__init__.py#L7