hass-browser_mod: History Graph Cards are not rendered in Popup

My Home Assistant version: 2025.2.1

What I am doing: After updating HAOS from 2025.1.4 to 2025.2.1 I have the following issue: Opening a popup via fire-dom-event does not show embedded history-graph cards any more. Other cards like e.g. Entity are shown as they should.

What I expected to happen: I expect history-graph-cards working again in a popup. Here is an example of what it looked like when it was still working (before the upgrade to 2025.2.1)

Image

What happened instead: The place where the history-graph should be shown, is left empty.

Image

Minimal steps to reproduce: Add history-graph card to the code for the popup. Both boolean and value based history-graph cards are not rendered

# The least amount of code or steps possible to reproduce my error
    tap_action:
      action: fire-dom-event
      browser_mod:
        service: browser_mod.popup
        data:
          title: Lüften
          size: normal
          dismissable: true
          content:
            type: vertical-stack
            cards:
              - type: history-graph
                entities:
                  - entity: binary_sensor.ventilation_living
                    name: Lüften
                  - entity: binary_sensor.living_csw_01_contact
                    name: Tür
                  - entity: binary_sensor.living_csw_02_contact
                    name: Fenster
                  - entity: sensor.humidity_living_outdoor_difference
                    name: Differenz
                  - entity: >-
                      input_number.ventilation_living_absolute_humidity_threshold
                    name: Toleranz
                hours_to_show: 24
                card_mod:
                  style:
                    .: |
                      ha-card { border: none; }
              - type: entities
                show_header_toggle: false
                state_color: true
                entities:
                  - entity: binary_sensor.ventilation_living
                    secondary_info: last-changed
                    name: Lüften?
                  - entity: binary_sensor.living_csw_01_contact
                    secondary_info: last-changed
                    name: Terrassentür
                  - entity: binary_sensor.living_csw_02_contact
                    secondary_info: last-changed
                    name: Fenster
                  - entity: automation.ventilation_living
                    name: Automation
                    secondary_info: last-changed
                card_mod:
                  style:
                    .: |
                      ha-card { border: none; }
              - type: conditional
                conditions:
                  - condition: state
                    entity: automation.ventilation_living
                    state: "on"
                card:
                  type: entities
                  state_color: true
                  show_header_toggle: false
                  entities:
                    - entity: sensor.living_air_01_humidity
                      name: Innen relativ
                    - entity: >-
                        input_number.ventilation_living_relative_humidity_minimum_threshold
                      name: Innen min.
                    - entity: sensor.wohnzimmer_comfort_absolute_luftfeuchtigkeit
                      name: Innen
                      secondary_info: last-changed
                    - entity: sensor.humidity_outdoor_average
                      name: Außen
                      icon: mdi:water-outline
                      secondary_info: last-changed
                    - entity: sensor.humidity_living_outdoor_difference
                      name: Differenz
                      icon: mdi:water-minus-outline
                    - entity: >-
                        input_number.ventilation_living_absolute_humidity_threshold
                      name: Toleranz
                    - entity: >-
                        input_number.ventilation_living_absolute_humidity_threshold_hysterese
                      name: Hysterese
                    - entity: input_boolean.ventilation_living
                  card_mod:
                    style:
                      .: |
                        ha-card { border: none; }
# Put your code/steps here

Error messages from the browser console:

CARD-MOD 3.4.4 IS INSTALLED
browser_mod.js?2.3.3:385 BROWSER_MOD 2.3.3 IS INSTALLED    BrowserID: xxx
...
card-mod.js?hacstag=190927524344:1 Card-mod warning

ha-chart-base.ts:297  Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'darkMode')
    at i.value (ha-chart-base.ts:297:30)
    at i.value (ha-chart-base.ts:223:38)
value @ ha-chart-base.ts:297
value @ ha-chart-base.ts:223
await in value
value @ ha-chart-base.ts:123
_$AE @ reactive-element.ts:1395
performUpdate @ reactive-element.ts:1345
scheduleUpdate @ reactive-element.ts:1262
_$Ej @ reactive-element.ts:1237
await in _$Ej
requestUpdate @ reactive-element.ts:1215
_$Eu @ reactive-element.ts:950
w @ reactive-element.ts:932
S @ lit-element.ts:115
i @ ha-chart-base.ts:31
k @ scoped-custom-element-registry.js:385
t @ scoped-custom-element-registry.js:236
u @ lit-html.ts:1129
g @ lit-html.ts:1543
_$AI @ lit-html.ts:1384
V @ lit-html.ts:2183
update @ lit-element.ts:166
performUpdate @ reactive-element.ts:1333
scheduleUpdate @ reactive-element.ts:1262
_$Ej @ reactive-element.ts:1237
await in _$Ej
requestUpdate @ reactive-element.ts:1215
_$Eu @ reactive-element.ts:950
w @ reactive-element.ts:932
S @ lit-element.ts:115
F @ state-history-chart-timeline.ts:26
k @ scoped-custom-element-registry.js:385
t @ scoped-custom-element-registry.js:236
u @ lit-html.ts:1129
g @ lit-html.ts:1543
_$AI @ lit-html.ts:1384
T @ lit-html.ts:1618
_$AI @ lit-html.ts:1403
v @ lit-html.ts:1192
g @ lit-html.ts:1553
_$AI @ lit-html.ts:1384
V @ lit-html.ts:2183
update @ lit-element.ts:166
performUpdate @ reactive-element.ts:1333
scheduleUpdate @ reactive-element.ts:1262
_$Ej @ reactive-element.ts:1237
await in _$Ej
requestUpdate @ reactive-element.ts:1215
set @ reactive-element.ts:731
j @ lit-html.ts:1883
_$AI @ lit-html.ts:1825
v @ lit-html.ts:1192
g @ lit-html.ts:1540
_$AI @ lit-html.ts:1384
v @ lit-html.ts:1192
g @ lit-html.ts:1540
_$AI @ lit-html.ts:1384
V @ lit-html.ts:2183
update @ lit-element.ts:166
performUpdate @ reactive-element.ts:1333
scheduleUpdate @ reactive-element.ts:1262
_$Ej @ reactive-element.ts:1237
await in _$Ej
requestUpdate @ reactive-element.ts:1215
set @ reactive-element.ts:731
(anonym) @ hui-history-graph-card.ts:135
(anonym) @ history.ts:258
(anonym) @ connection.js:23
_handleMessage @ connection.js:15

ha-chart-base.ts:297  Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'darkMode')
    at i.value (ha-chart-base.ts:297:30)
    at i.value (ha-chart-base.ts:223:38)
value @ ha-chart-base.ts:297
value @ ha-chart-base.ts:223
await in value
value @ ha-chart-base.ts:123
_$AE @ reactive-element.ts:1395
performUpdate @ reactive-element.ts:1345
scheduleUpdate @ reactive-element.ts:1262
_$Ej @ reactive-element.ts:1237
await in _$Ej
requestUpdate @ reactive-element.ts:1215
_$Eu @ reactive-element.ts:950
w @ reactive-element.ts:932
S @ lit-element.ts:115
i @ ha-chart-base.ts:31
k @ scoped-custom-element-registry.js:385
t @ scoped-custom-element-registry.js:236
u @ lit-html.ts:1129
g @ lit-html.ts:1543
_$AI @ lit-html.ts:1384
V @ lit-html.ts:2183
update @ lit-element.ts:166
performUpdate @ reactive-element.ts:1333
scheduleUpdate @ reactive-element.ts:1262
_$Ej @ reactive-element.ts:1237
await in _$Ej
requestUpdate @ reactive-element.ts:1215
_$Eu @ reactive-element.ts:950
w @ reactive-element.ts:932
S @ lit-element.ts:115
F @ state-history-chart-line.ts:30
k @ scoped-custom-element-registry.js:385
t @ scoped-custom-element-registry.js:236
u @ lit-html.ts:1129
g @ lit-html.ts:1543
_$AI @ lit-html.ts:1384
T @ lit-html.ts:1618
_$AI @ lit-html.ts:1403
v @ lit-html.ts:1192
g @ lit-html.ts:1553
_$AI @ lit-html.ts:1384
V @ lit-html.ts:2183
update @ lit-element.ts:166
performUpdate @ reactive-element.ts:1333
scheduleUpdate @ reactive-element.ts:1262
_$Ej @ reactive-element.ts:1237
await in _$Ej
requestUpdate @ reactive-element.ts:1215
set @ reactive-element.ts:731
j @ lit-html.ts:1883
_$AI @ lit-html.ts:1825
v @ lit-html.ts:1192
g @ lit-html.ts:1540
_$AI @ lit-html.ts:1384
v @ lit-html.ts:1192
g @ lit-html.ts:1540
_$AI @ lit-html.ts:1384
V @ lit-html.ts:2183
update @ lit-element.ts:166
performUpdate @ reactive-element.ts:1333
scheduleUpdate @ reactive-element.ts:1262
_$Ej @ reactive-element.ts:1237
await in _$Ej
requestUpdate @ reactive-element.ts:1215
set @ reactive-element.ts:731
(anonym) @ hui-history-graph-card.ts:135
(anonym) @ history.ts:258
(anonym) @ connection.js:23
_handleMessage @ connection.js:15

By replacing the space in the checkboxes ([ ]) with an X below, I indicate that I:

  • Understand that this is a channel for reporting bugs, not a support forum (https://community.home-assistant.io/).

  • Have made sure I am using the latest version of the plugin.

  • Have followed the troubleshooting steps of the “Common Problems” section of https://github.com/thomasloven/hass-config/wiki/Lovelace-Plugins.

  • Understand that leaving one or more boxes unticked or failure to follow the template above may increase the time required to handle my bug-report, or cause it to be closed without further action.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 13
  • Comments: 38

Most upvoted comments

Sorry for any confusion. The idea of a workaround was not one that anyone can implement easily. However I have attempted a workaround which does what I was describing.

As I am not sure it is the best way to manage I am not creating a pull request yet, but you can check out on my fork - see Commit

To test take browser_mod.js and replace in your local HA config… /custom_components/browser_mod. You will need to clear browsser cache.

As for final fix being in HA or browser_mod ?? ha-chart-base uses context for getting themes but not much else uses contexts, instead relying on hass element. If we need to manage contexts for browser-mod, then a bit more investigation on best way to consume context from another DOM root.

Sorry for any confusion. The idea of a workaround was not one that anyone can implement easily. However I have attempted a workaround which does what I was describing.

As I am not sure it is the best way to manage I am not creating a pull request yet, but you can check out on my fork - see Commit

To test take browser_mod.js and replace in your local HA config… /custom_components/browser_mod. You will need to clear browsser cache.

As for final fix being in HA or browser_mod ?? ha-chart-base uses context for getting themes but not much else uses contexts, instead relying on hass element. If we need to manage contexts for browser-mod, then a bit more investigation on best way to consume context from another DOM root.

Thank you very much to helping us out here. You solution worked for me also 👍 @thomasloven it would be great, if you can fix this, so we have a sustainable solution.

Facing the same here. Seems a new bug. Almost wasted the whole night blaming myself 😃

This is fixed in a new browser_mod Version 2.3.4 available via my fork. See V2.3.4 Disussion

@dcapslock this is great news, thanks! Do you know if this version will be merged into the main repo at some point, or should we jump and start using this fork going forward?

EDIT: I´ve seen the comment in the fork that clarifies my question, and after moving to this new repo everything works like a charm:

The Phoenix fork of Browser Mod 2 starts with Version 2.3.4. The version was made by @dcasplock given a backlog of PRs for the (main) repo by @thomasloven. Depending on actvity of the main repo, this fork may become the main repo and HACS adjusted accordingly.

@DNC74 @yuralcfr thank you for confirming the workaround fixes the issue. I want to confirm that the method is teh best before creating a PR.

@dcapslock Sorry, I have to correct myself in part. It works in the normal browser on the PC, such as Google Chrome, Firefox or Edge, but the problem persists in the Companion App. Can anyone confirm this and if so, how do we solve the problem at this point?

Edit: found a solution for the Companion App by clearing its cache: https://github.com/thomasloven/hass-config/wiki/Clearing-your-browser-cache#home-assistant-companion-app

@DNC74 @yuralcfr thank you for confirming the workaround fixes the issue. I want to confirm that the method is teh best before creating a PR.

To test take browser_mod.js and replace in your local HA config… /custom_components/browser_mod. You will need to clear browsser cache.

It’s working for me, thanks.

I have had a close look at this and the element ha-chart-base subscribes to themesContext, but as the ha-chart-base is being created dynamically by createCardElement it does not get the inital context update. Hence _themes is undefined.

I also believe issues relating to button-card also are due to the same construct as button-card also subscibes to contexts for updates.

How to fix? It would be best for the HA Frontend code for createCardElement to bubble the context to the created card. Otherwise, the only workaround for browser_mod/popup is to set any known consume states manually from the hass attribute of the create element.