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

HabPanel not switching back to first dashboard #2569

Open
chevdor opened this issue May 8, 2024 · 4 comments
Open

HabPanel not switching back to first dashboard #2569

chevdor opened this issue May 8, 2024 · 4 comments
Labels
bug Something isn't working habpanel ui

Comments

@chevdor
Copy link

chevdor commented May 8, 2024

Background

HabPanel allows OH to control the currently displayed Dashboard using one of the panel settings:
image

It is usually defined as an item such as:

String    HabPanel_Screen          "HabPanel Screen"         <screen>         (VirtualSwitch)

The idea is that changing the content of the string, HabPanel will switch to that Dashboard, should the string match an existing Dashboard. Simple, yet very powerful.

Sample use case

I was experimenting with a simple use case that I provide here only to illustrate how I got there.

Let's consider I have 3 dashboards:

  • A: Main
  • B: Doors & Windows
  • C: Foobar

Below I will refer to Dasboards A, B and C since what they are does not matter much.

In my case, usually, HabPanel shows Main (A). When a door or window is opened, it will switch to Doors & Windows (B). After N seconds, it will come back to Main (A).

Nice story but that does not work.

The problem

The rule switching A -> B works fine. A window is opened (for instance), OH will update the HabPanel_Screen content and the B Dashboard will be shown.

So far, everthing works as expected.

The issue is related to coming back to Dashboard A. I am using a timer (but that part does not matter) and switching back to A is simply ignored.

Expected behavior

Considering 2 Dashboards both of the following work:

  • ✅ switch from A to B
  • ❌ switch from B back to A

A being the main "default" dashboard.

Steps to reproduce

  • from a standard install with one dashboard (A), create a second dashboard
  • create a switch to test
  • create an Item String HabPanel_Screen "HabPanel Screen" <screen>
  • Configure HabPanel to use HabPanel_Screen to switch dashboard
  • implement a rule that switch from A to B and from B to A

Your environment

runtimeInfo:
  version: 4.1.2
  buildString: Release Build
locale: en-DE
systemInfo:
  configFolder: /etc/openhab
  userdataFolder: /var/lib/openhab
  logFolder: /var/log/openhab
  javaVersion: 17.0.10
  javaVendor: Debian
  osName: Linux
  osVersion: 6.6.20+rpt-rpi-v8
  osArchitecture: aarch64
  availableProcessors: 4
  freeMemory: 378182888
  totalMemory: 805306368
  uptime: 233700
  startLevel: 70
addons:
  - automation-jsscripting
  - [... some more...]
  - binding-zigbee
  - binding-zwave
  - persistence-influxdb
  - persistence-mapdb
  - persistence-rrd4j
  - transformation-map
  - ui-basic
  - ui-habpanel
  - voice-voicerss
clientInfo:
  device:
    ios: false
    android: false
    androidChrome: false
    desktop: true
    iphone: false
    ipod: false
    ipad: false
    edge: false
    ie: false
    firefox: false
    macos: true
    windows: false
    cordova: false
    phonegap: false
    electron: false
    nwjs: false
    webView: false
    webview: false
    standalone: false
    os: macos
    pixelRatio: 2.200000047683716
    prefersColorScheme: dark
  isSecureContext: false
  locationbarVisible: true
  menubarVisible: true
  navigator:
    cookieEnabled: true
    deviceMemory: N/A
    hardwareConcurrency: 10
    language: en-US
    languages:
      - en-US
      - de
      - en-DE
      - en-IE
      - de-DE
      - fr-FR
      - fr
      - en-GB
      - en
    onLine: true
    platform: MacIntel
  screen:
    width: 2560
    height: 1440
    colorDepth: 24
  support:
    touch: false
    pointerEvents: true
    observer: true
    passiveListener: true
    gestures: false
    intersectionObserver: true
  themeOptions:
    dark: dark
    filled: true
    pageTransitionAnimation: default
    bars: light
    homeNavbar: default
    homeBackground: default
    expandableCardAnimation: default
  userAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36
    (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36
timestamp: 2024-05-08T08:31:33.304Z

Browser console

n/a : empty

Browser network traffic

n/a : no related traffic

Additional information

It is important to notice that I run into this issue ONLY if A is the first/default dashboard.
It you already have a dashboard and create 2 new dashboards for the test, it will be working all fine as it does for me.

@chevdor chevdor added bug Something isn't working main ui Main UI labels May 8, 2024
@chevdor
Copy link
Author

chevdor commented May 8, 2024

@chevdor
Copy link
Author

chevdor commented May 8, 2024

I see the issue directly in the browser:

I see the URL changing but the page does not reload with A.

@chevdor
Copy link
Author

chevdor commented May 8, 2024

I could fetch the following error in the console:

vendor.js:119 TypeError: Cannot read properties of undefined (reading 'widget_margin')
    at new DashboardViewController (http://domopi2:8080/habpanel/app/dashboard/dashboard.view.controller.js:14:32)
    at Object.instantiate (http://domopi2:8080/habpanel/vendor/vendor.js:42:109)
    at http://domopi2:8080/habpanel/vendor/vendor.js:91:374
    at Object.link (http://domopi2:8080/habpanel/vendor/vendor.js:332:274)
    at http://domopi2:8080/habpanel/vendor/vendor.js:16:71
    at sa (http://domopi2:8080/habpanel/vendor/vendor.js:82:244)
    at n (http://domopi2:8080/habpanel/vendor/vendor.js:68:6)
    at g (http://domopi2:8080/habpanel/vendor/vendor.js:59:428)
    at http://domopi2:8080/habpanel/vendor/vendor.js:59:67
    at http://domopi2:8080/habpanel/vendor/vendor.js:64:67 <main class="container ng-scope" snap-content="" snap-opt-disable="'right'" snap-opt-hyperextensible="false" ng-view="" ng-class="{ 'image-bg': settings.background_image, kiosk: kioskMode }" ng-style="{ 'background-image': (settings.background_image) ? 'url(' + settings.background_image +')' : '' }">

@chevdor
Copy link
Author

chevdor commented May 8, 2024

I ended up deleting my "first" dashboard as I think it was "corrupted".
Surprising though since I built the second dashboard by simply copying all the widgets from A to B and B works just fine.
So when I mentioned "First/Default" Dashboard above is NOT relevant. The issue is that somehow, my A Dashboard got corrupted, still loads as default dashboard but does not when switched to.

@florian-h05 florian-h05 added habpanel ui and removed main ui Main UI labels May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working habpanel ui
Projects
None yet
Development

No branches or pull requests

2 participants