joBr99 / nspanel-lovelace-ui

Custom Firmware for NsPanel with the design of HomeAssistant's lovelace UI in mind, works with Tasmota.
GNU General Public License v3.0
854 stars 187 forks source link

[BUG] Grid Card showing 6 visible entities in 4x2 layout instead of 3x2 in case some entities are hidden by state (EU version) #1190

Open peca89 opened 4 months ago

peca89 commented 4 months ago

PROBLEM DESCRIPTION

If you have 6 entities defined in the Grid Card, everything is fine. As soon as you define 7th entity in YAML, layout switches to 4x2 despite that 7th entity is hidden by state.

I'm trying to make the first position on the Grid Card switch between two entities based on the opposite state. These two can never be shown at the same time. Yet, the software still seems like trying to accommodate for possible 7th entity shown.

Take a look at the first two entities. They are service calls to vacuum cleaner to start cleaning or stop cleaning which obviously cannot exist at the same time.

REQUESTED INFORMATION

Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!

- [ ] Go to Settings>Add-ons>AppDaemon>Log (or the output of your TS script) and then, provide the output of the log during your issue/bug occurs:

Log output here:



### TO REPRODUCE
_Steps to reproduce the behavior:_
Create Grid Card with 7 entities, set `state: "off"` to one of them which is currently off to hide it, remaining 6 entities show in 4x2 layout with the last two spots empty

### EXPECTED BEHAVIOUR
_A clear and concise description of what you expected to happen._
If 6 entities are visible, show them in 3x2 layout. Switch to 4x2 layout only when 7th or 8th entity becomes visible

### SCREENSHOTS
_If applicable, add screenshots/pictures to help explain your problem._

### ADDITIONAL CONTEXT
_Add any other context about the problem here._
_Please note here in case you are using ioBroker_

### PANEL / FIRMWARE VERSION
_Please add the Panel/Firmware Version you are using (EU, US-L or US-P)_
EU
joBr99 commented 4 months ago

hey, the decision on which page is going to be used is made before any further rendering of the config, so it's purely based on the number of entities in the config

I added a workaround for this use the page type "cardGrid1" instead of "cardGrid" to force it to the 3x2 layout.

https://docs.nspanel.pky.eu/stable/faq/#how-to-upgrade-from-a-release-to-the-current-development-version

(No need to update the tft firmware, just update the appdaemon app to main)

peca89 commented 4 months ago

Hmm, this seem to work only first time the screen is touched after app restart. If I scroll to another card and then scroll back, then 4x2 layout with 6 visible buttons is displayed.

Subsequently touching the screensaver brings 4x2 card again

2024-02-27 22:28:06.204925 INFO nspanel-1: MQTT callback for: {'topic': 'tele/nspanel/RESULT', 'wildcard': None, 'payload': '{"CustomRecv":"event,buttonPress2,screensaver,bExit,1"}'}
2024-02-27 22:28:06.208704 INFO nspanel-1: Received Message from Screen: event,buttonPress2,screensaver,bExit,1
2024-02-27 22:28:06.212403 INFO nspanel-1: Button Press Event; entity_id: screensaver; button_type: bExit; value: 1 
2024-02-27 22:28:15.663991 INFO nspanel-1: MQTT callback for: {'topic': 'tele/nspanel/RESULT', 'wildcard': None, 'payload': '{"CustomRecv":"event,sleepReached,cardGrid"}'}
2024-02-27 22:28:15.667839 INFO nspanel-1: Received Message from Screen: event,sleepReached,cardGrid
2024-02-27 22:28:15.670892 INFO nspanel-1: Button Press Event; entity_id: cardGrid; button_type: sleepReached; value: None