Blackymas / NSPanel_HA_Blueprint

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

Slow button page load with automation entities `Bug` #1746

Closed brianmaas closed 9 months ago

brianmaas commented 9 months ago

TFT Version

4.2.4

ESPHome Version

4.2.4

Blueprint Version

4.2.4

Panel Model

NSPanel US Model

What is the bug?

Automation entities on button pages load very slowly

Steps to Reproduce

I have a specific page which only contains automation entities. I have the setting selected to show pages while loading. Each button shows up on the screen with the icon highlighted in the active color. Then it slowly turns to the white or gray color. Then this repeats for each button. My page with 7 buttons takes about 6 seconds to load completely.

In the advanced settings I also have changed the "button action for automation entities" to "Trigger". I've also tried the "Toggle" setting. The button load time doesn't change.

Your panel's YAML

substitutions:
  ###### CHANGE ME START ######
  device_name: "nsfamilyroom" 
  wifi_ssid: "NETGEAR75"
  wifi_password: ""

  nextion_update_url: "http://10.0.74.138:1180/nspanel_us.tft"
  nextion_blank_url: "http://10.0.74.138:1180/nspanel_blank.tft"

# Limit the amount of resources used for compiling

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

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

packages:
  remote_package:
    url: https://github.com/Blackymas/NSPanel_HA_Blueprint
    ref: main
    files:
      - nspanel_esphome.yaml # Core package
      # - advanced/esphome/nspanel_esphome_advanced.yaml # activate advanced (legacy) elements - can be useful for troubleshooting
      # - nspanel_esphome_addon_climate_cool.yaml # activate for local climate (cooling) control
      # - nspanel_esphome_addon_climate_heat.yaml # activate for local climate (heater) control
    refresh: 1s

esp32:
  framework:
    type: arduino

#### type: esp-idf
##### My customization - Start #####
##### My customization - End #####

ESPHome logs

No response

Home Assistant logs

No response

edwardtfn commented 9 months ago

Is this a new system or have you updated from a previous version? Was the system also slow in the previous versions or can you correlate this with the new version? This page is basically created on Home Assistant side, then it is sent to ESPHome button by button, so ESPHome doesn't have that much role here. If it is slow, it's on your Home Assistant (most likely) or the network. And in many time we can improve the code to be lighter to those bottlenecks. I woukd appreciate if you take a look at Home Assistant logs (Settings > System > Logs) for any error related to this, as that could give some tips for where to start looking for.

brianmaas commented 9 months ago

I originally installed 4.1.4 and just recently updated to 4.2.4. I didn't have the page full of automation entities before so I don't know if it was slow before. I do know that if I create a scene entity that calls that automation, then the button loads very quickly.

This is a sample of the nspanel log in home assistant:

2024-01-28 14:59:28,362 INFO 304 GET /devices (0.0.0.0) 3.53ms
2024-01-28 14:59:33,565 INFO 304 GET /devices (0.0.0.0) 2.68ms
2024-01-28 14:59:38,671 INFO 304 GET /devices (0.0.0.0) 3.79ms
2024-01-28 14:59:43,676 INFO 304 GET /devices (0.0.0.0) 2.69ms
2024-01-28 15:01:11,931 INFO 200 GET /devices (0.0.0.0) 3.58ms

I don't see anything else related to this in the Home Assistant Core logs.

edwardtfn commented 9 months ago

Ok. I will try to start from this. Thanks!

edwardtfn commented 9 months ago

I've done some clean-up on dev and I believe the performance will improve a bit. This will be included in the next release and I would appreciate if you give some feedback after updating, then we can re-open if needed more work.

edwardtfn commented 9 months ago

We just released a patch with solves this: v4.2.5 - Celebrating 1000 Stars with Enhanced Functionality and UI Improvements Could you please update your system and let me know if the issue was solved?

brianmaas commented 9 months ago

I loaded v4.2.5 and it has no change for the speed of the automation buttons load time.

https://share.icloud.com/photos/09bpjGRmtKK83ayN7MJOesmvw

Here's a video showing how fast regular buttons load compared to the automation buttons. page 1 - the goodnight, start spa, and stop spa are automations. The other buttons are switches. page 2 - all of the buttons are automations.

You can see how on the automations the icon first is colored in by the color in the blueprint, and then it changes to the light gray before moving on to start the next button rendering.

edwardtfn commented 9 months ago

Ok, I just realize the issue was related specifically with automation entities, which was in your original message. 😥

Anyways, I believe now it is fixed in dev. Please let me know if the issue persists after the next release.

brianmaas commented 8 months ago

All fixed. Thank you!