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] Add fallback for bUp Navigation without History #535

Closed
2 tasks done
ClaireRovic opened this issue Oct 24, 2022 · 3 comments
Closed
2 tasks done

[BUG] Add fallback for bUp Navigation without History #535

ClaireRovic opened this issue Oct 24, 2022 · 3 comments
Labels
bug Something isn't working
Milestone

Comments

@ClaireRovic
Copy link

ClaireRovic commented Oct 24, 2022

PROBLEM DESCRIPTION

When using the defaultCard to point to a HiddenCards, the navigation arrows will not let me move back up through the menu system. I use this to set the NSPanel default for different rooms in the house depending on where the panel is located. At the top level of the menu I have all the rooms that can be selected.

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: 
nspanel-1:
  module: nspanel-lovelace-ui
  class: NsPanelLovelaceUIManager
  config:
    panelRecvTopic: "tele/master_nsp/RESULT"
    panelSendTopic: "cmnd/master_nsp/CustomSend"
    model: "us-p"
    locale: "en_Au"
    dateFormat: "%A, %d %B"
    sleepTimeout: 99
    sleepBrightness:
      - time: "sunrise"
        value: 45
      - time: "sunset + 4:00:00"
        value: 1
    sleepOverride:
      entity: light.master_lights
      brightness: 40
    screensaver:
      entity: weather.bom
      alternativeLayout: false
      defaultCard: navigate.cardGrid_masterKey
      theme:
        time: [255, 150, 0]
        date: [255, 150, 0]
        bar: [255, 150, 0]
        tMainIcon: [220, 0, 25]
        tMainText: [220, 0, 25]
        tForecast1: [0, 255, 0]
        tForecast1Val: [0, 255, 0]
        autoWeather: true
    cards:
      - type: cardGrid
        title: Upstairs
        key: homemenuKey
        entities:
          - entity: navigate.cardGrid_guestKey
            name: Guest
            icon: mdi:emoticon-cool-outline
          - entity: navigate.cardGrid_masterKey
            name: Master
            icon: mdi:emoticon-wink-outline
          - entity: navigate.cardEntities_officeKey
            name: Office
            icon: mdi:robot-outline
          - entity: navigate.cardEntities_taraKey
            name: Tara
            icon: mdi:emoticon-outline
          - entity: navigate.cardEntities_landingKey
            name: Landing
            icon: mdi:cat
      - type: cardGrid
        title: Downstairs
        entities:
          - entity: navigate.cardGrid_studyKey
            name: Study
            icon: mdi:star-face
      - type: cardGrid
        title: Outside
        entities:
          - entity: light.pergola_lights
            name: Pergola Lights
            icon:
              "on": mdi:lamp
              "off": mdi:lamp-outline
          - entity: light.rope_light
            name: Rope Lights
            icon:
              "on": mdi:string-lights
              "off": mdi:string-lights-off
          - entity: light.porch_fairy
            name: Fairy Lights
            icon:
              "on": mdi:string-lights
              "off": mdi:string-lights-off
          - entity: light.porch_light
            name: Porch Lights
            icon:
              "on": mdi:coach-lamp
              "off": mdi:coach-lamp
      - type: cardGrid
        title: Shutters
        entities:
          - entity: scene.home_shutters_open
            name: Open
            icon: window-shutter-open
          - entity: scene.home_shutters_closed
            name: Close
            icon: window-shutter
          - entity: scene.home_shutters_morning
            name: Morning
            icon: window-shutter-alert
          - entity: delete
          - entity: delete
          - entity: navigate.cardEntities_shuttersKey
            name: Shutters
            icon: window-shutter-cog
      - type: cardQR
        title: Guest Wifi
        qrCode: "WIFI:S:HSHome;T:WPA;P:zaq1xsw2cde3vfr4;;"
        entities:
          - entity: iText.HSHome
            name: Name
            icon: mdi:wifi
          - entity: iText.******
            name: Password
            icon: mdi:key
    hiddenCards:
      - type: cardGrid
        title: Guest
        key: guestKey
        entities:
          - entity: light.guest_wall_lamp
            name: Wall Lamp
            icon:
              "on": mdi:lamp
              "off": mdi:lamp-outline
          - entity: light.guest_window_lamp
            name: Window Lamp
            icon:
              "on": mdi:lamp
              "off": mdi:lamp-outline
          - entity: light.guest_light
            icon: mdi:globe-light
          - entity: cover.guest_shutter
          - entity: button.guest_shutter_my_position
            name: Shutter Partial
      - type: cardGrid
        title: Master
        key: masterKey
        entities:
          - entity: light.master_wall_lamp
            name: Wall
            icon:
              "on": mdi:lamp
              "off": mdi:lamp-outline
          - entity: light.master_window_lamp
            name: Window 
            icon:
              "on": mdi:lamp
              "off": mdi:lamp-outline
              "unavailable": mdi:card-off-outline
          - entity: light.master_lights
            name: Lights 
            icon:
              "on": mdi:light-recessed
              "off": mdi:light-recessed
          - entity: switch.master_heater
            name: Heater
            icon:
              "on": mdi:radiator
              "off": mdi:radiator-disabled
          - entity: navigate.cardEntities_masterdetailKey
          - entity: navigate.cardMedia_mastermediaKey
      - type: cardEntities
        title: Master Detail
        key: masterdetailKey
        entities:
          - entity: light.master_robe_light
            name: Robe Light
            icon:
              "on": mdi:light-recessed
              "off": mdi:light-recessed
          - entity: light.master_ensuite_light
            name: Ensuite Light
            icon:
              "on": mdi:light-recessed
              "off": mdi:light-recessed
          - entity: switch.ensuite_heater
            name: En. Heater
            icon:
              "on": mdi:radiator
              "off": mdi:radiator-disabled
          - entity: button.master_shutter_my_position
            name: Morning
          - entity: cover.master_shutter
            name: Shutter
      - type: cardMedia
        title: Speaker
        key: mastermediaKey
        entity: media_player.study_speaker
      - type: cardEntities
        title: Office
        key: officeKey
        entities:
          - entity: light.office_light
            name: Main Light
            icon:
              "on": mdi:globe-light
              "off": mdi:globe-light-outline
          - entity: delete
          - entity: button.office_shutter_my_position
            name: Shutter Crack
          - entity: cover.office_shutter
            name: Shutter
      - type: cardEntities
        title: Landing
        key: landingKey
        entities:
          - entity: light.landing_lights
            name: lights
          - entity: switch.loft_switch1
            name: Loft
      - type: cardEntities
        title: Tara
        key: taraKey
        entities:
          - entity: light.tara_light
            name: Main Light
            icon:
              "on": mdi:globe-light
              "off": mdi:globe-light-outline
          - entity: delete
          - entity: button.tara_shutter_my_position
            name: Shutter Crack
          - entity: cover.tara_shutter
            name: Shutter
      - type: cardGrid
        title: Study
        key: studyKey
        entities:
          - entity: switch.study_heater
            icon: mdi:radiator
          - entity: light.study_light
            icon: mdi:vanity-light
      - type: cardEntities
        title: Detail Shutters
        key: shuttersKey
        entities:
          - entity: cover.guest_shutter
            name: Guest
          - entity: cover.landing_shutter
            name: Landing
          - entity: cover.master_shutter
            name: Master
          - entity: cover.office_shutter
            name: Office
          - entity: cover.tara_shutter
            name: Tara

  • 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:
2022-10-24 20:59:56.482948 INFO nspanel-1: MQTT callback for: {'topic': 'tele/master_nsp/RESULT', 'wildcard': None, 'payload': '{"CustomRecv":"event,buttonPress2,screensaver,bExit,1"}'}
2022-10-24 20:59:56.484338 INFO nspanel-1: Received Message from Screen: event,buttonPress2,screensaver,bExit,1
2022-10-24 20:59:56.485743 INFO nspanel-1: Button Press Event; entity_id: screensaver; button_type: bExit; value: 1 
2022-10-24 20:59:56.495250 INFO nspanel-1: Searching for the following page as defaultPage: navigate.cardGrid_masterKey
2022-10-24 20:59:56.496989 INFO nspanel-1: Result for the following page as defaultPage: <luibackend.config.Card object at 0x7f4e836d0970>
2022-10-24 20:59:56.498193 INFO nspanel-1: Started rendering of page None with type cardGrid
2022-10-24 20:59:56.499491 INFO nspanel-1: Sending MQTT Message: pageType~cardGrid
2022-10-24 20:59:56.519841 INFO nspanel-1: Sending MQTT Message: entityUpd~Master~2|0~light~light.master_wall_lamp~���~17299~Wall~0~light~light.master_window_lamp~���~17299~Window~0~light~light.master_lights~���~17299~Lights~0~switch~switch.master_heater~���~17299~Heater~0~button~navigate.cardEntities_masterdetailKey~���~17299~Master Detail~Press~button~navigate.cardMedia_mastermediaKey~���~17299~Speaker~Press
2022-10-24 21:00:00.012596 INFO nspanel-2: Sending MQTT Message: time~21:00~
2022-10-24 21:00:01.012909 INFO nspanel-1: Sending MQTT Message: time~21:00~
2022-10-24 21:00:11.929100 INFO nspanel-1: MQTT callback for: {'topic': 'tele/master_nsp/RESULT', 'wildcard': None, 'payload': '{"CustomRecv":"event,buttonPress2,cardGrid,bUp"}'}
2022-10-24 21:00:11.931392 INFO nspanel-1: Received Message from Screen: event,buttonPress2,cardGrid,bUp
2022-10-24 21:00:11.932694 INFO nspanel-1: Button Press Event; entity_id: cardGrid; button_type: bUp; value: None 
2022-10-24 21:00:11.932979 WARNING nspanel-1: ------------------------------------------------------------
2022-10-24 21:00:11.933162 WARNING nspanel-1: Unexpected error in worker for App nspanel-1:
2022-10-24 21:00:11.933606 WARNING nspanel-1: Worker Ags: {'id': '7480d13d9a4a4f12b4e59552658a78aa', 'name': 'nspanel-1', 'objectid': '7d0925e984524e5b97e1d5ea8fcc7a1d', 'type': 'event', 'event': 'MQTT_MESSAGE', 'function': <bound method LuiMqttListener.mqtt_event_callback of <luibackend.mqtt.LuiMqttListener object at 0x7f4e843a9900>>, 'data': {'topic': 'tele/master_nsp/RESULT', 'wildcard': None, 'payload': '{"CustomRecv":"event,buttonPress2,cardGrid,bUp"}'}, 'pin_app': True, 'pin_thread': 0, 'kwargs': {'topic': 'tele/master_nsp/RESULT', '__thread_id': 'thread-0'}}
2022-10-24 21:00:11.933907 WARNING nspanel-1: ------------------------------------------------------------
2022-10-24 21:00:11.934334 WARNING nspanel-1: Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/appdaemon/threading.py", line 950, in worker
    funcref(args["event"], data, self.AD.events.sanitize_event_kwargs(app, args["kwargs"]))
  File "/config/appdaemon/apps/nspanel-lovelace-ui/luibackend/mqtt.py", line 58, in mqtt_event_callback
    self._controller.button_press(entity_id, btype, value)
  File "/config/appdaemon/apps/nspanel-lovelace-ui/luibackend/controller.py", line 217, in button_press
    self._current_card = self._previous_cards.pop()
IndexError: pop from empty list
2022-10-24 21:00:11.935192 WARNING nspanel-1: ------------------------------------------------------------


TO REPRODUCE

Steps to reproduce the behavior:
Set the defaultCard: navigate >> Hidden Card

EXPECTED BEHAVIOUR

To touch up arrow and move to the first top level Card

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 VERION

Please add the Panel/Firmware Version you are using (EU, US-L or US-P)
US-P

@ClaireRovic ClaireRovic added the bug Something isn't working label Oct 24, 2022
@joBr99
Copy link
Owner

joBr99 commented Oct 24, 2022

The default card cannot point to a hiddencard, as described in the docs.

default page after exiting screensaver; only works with top level cards defined in cards;

https://docs.nspanel.pky.eu/config-screensaver/?h=screensaver#possible-configuration-values-for-screensaver-config

However it might be possible to add a fallback to point it to the first card in case it doesn't find one on exiting a hidden card.

@ClaireRovic
Copy link
Author

Thanks for the fast feedback - apologies I have read the docs, just not everything sticks. The fallback option sounds like a sensible approach in the event of other unforeseen issues. Smile plus it will solve my problem 😂

joBr99 added a commit that referenced this issue Oct 24, 2022
@joBr99 joBr99 changed the title [BUG] [BUG] Add fallback for bUp Navigation without History Oct 24, 2022
@joBr99
Copy link
Owner

joBr99 commented Oct 24, 2022

Hey checkout the development version, you only need to update to main in HACS and restart AppDaemon, Firmware is not required.

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

If there is no card found to go up, it is no going to the first page.

@joBr99 joBr99 closed this as completed Oct 24, 2022
@joBr99 joBr99 added this to the 3.6.X milestone Oct 24, 2022
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

2 participants