Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[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
2 tasks
peca89 opened this issue Feb 23, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@peca89
Copy link

peca89 commented Feb 23, 2024

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!

  • Provide your apps.yaml (or your config):
  apps.yaml here:

      - type: cardGrid
        entities:
          - entity: service.vacuum.start
            data:
              entity_id: vacuum.ijai_v3_robot_cleaner
            icon: mdi:robot-vacuum
            name: Clean now
            state_template: '{{ states("vacuum.ijai_v3_robot_cleaner") != "docked" }}'
          - entity: service.vacuum.return_to_base
            data:
              entity_id: vacuum.ijai_v3_robot_cleaner
            icon: mdi:robot-vacuum
            name: Go back
            state_template: '{{ states("vacuum.ijai_v3_robot_cleaner") == "docked" }}'
          - entity: light.kitchen
            name: Kitchen
          - entity: sensor.midea_indoor_temperature
            name: Temperature
          - entity: scene.curtains_closed
            icon: mdi:bed
          - entity: scene.curtains_open
            icon: mdi:weather-sunny
          - entity: sensor.pm2_5
            name: PM2.5
        title: Switches 

  • 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

@peca89 peca89 added the bug Something isn't working label Feb 23, 2024
joBr99 added a commit that referenced this issue Feb 25, 2024
@joBr99
Copy link
Owner

joBr99 commented Feb 25, 2024

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)

@joBr99 joBr99 closed this as completed Feb 25, 2024
@peca89
Copy link
Author

peca89 commented Feb 27, 2024

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 

@joBr99 joBr99 reopened this Feb 27, 2024
@marek-vrana
Copy link
Contributor

That workaround didn't work because first iteration overwrites cardGrid1 to cardGrid (785-786) and then number of entities in cardGrid comes into play and reverts it back to cardGrid2 (783-784).

# Switch to page
if send_page_type:
if card.cardType == "cardGrid" and len(card.entities) > 6:
card.cardType = "cardGrid2"
if card.cardType == "cardGrid1":
card.cardType = "cardGrid"
self.page_type(card.cardType)

If you want a quick fix, edit this file locally by commenting out lines 783-784 and restart appdaemon until it's officially fixed in proper way.
I think cardGrid1 should get a dedicated page same as cardGrid2 so cardGrid becomes a "dynamic" page compared to the 1&2 static ones with 6&8 entities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants