AalianKhan / mushroom-strategy

A strategy to automatically generate a dashboard using mushroom cards
MIT License
371 stars 37 forks source link

No Home View #60

Closed IzeQube closed 11 months ago

IzeQube commented 11 months ago

Describe the bug
I just started tryning Mushroom Strategy. I get the device-spcific views, but I don't get the Home-View with all of my Rooms or Areas.

In the Browser Dev Tools I can see the error message: "View 'home' couldn't be loaded!"

I've already tried deleting all my areas and creating some new ones, that didn't seem to help.

Versions

To Reproduce
Steps to reproduce the behavior:

  1. Install Mushroom-Strategy
  2. Create Dashboard
  3. Enter required YAML
  4. No Home View

Expected behavior
See the Home View

Screenshots
image

Additional context
n/a

Sooty70 commented 11 months ago

Thanks for raising this @IzeQube - I have exactly the same issue…

DigiLive commented 11 months ago

This is very surprisingly... could you enter the property debug in the configuration, set it's value to true and check the console again?

IzeQube commented 11 months ago

Yes, this is the error message in the console:

TypeError: s.W.entities.find(...) is undefined
    #m mushroom-strategy.js:1
    createViewCards mushroom-strategy.js:1
    getView mushroom-strategy.js:1
    generateDashboard mushroom-strategy.js:1
    a get-strategy.ts:84
    o get-strategy.ts:99
    value ha-panel-lovelace.ts:259
    value ha-panel-lovelace.ts:153
    _$AE reactive-element.ts:1376
    performUpdate reactive-element.ts:1343
    scheduleUpdate reactive-element.ts:1261
    _$Ej reactive-element.ts:1233
    requestUpdate reactive-element.ts:1208
    _$Eu reactive-element.ts:946
    _ reactive-element.ts:931
    A lit-element.ts:115
    o ha-panel-lovelace.ts:66
    C scoped-custom-element-registry.js:385
    t scoped-custom-element-registry.js:236
    value hass-router-page.ts:296
    value hass-router-page.ts:316
    _currentLoadProm hass-router-page.ts:214
    promise callback*value hass-router-page.ts:205
    performUpdate reactive-element.ts:1329
    scheduleUpdate reactive-element.ts:1261
    _$Ej reactive-element.ts:1233
    requestUpdate reactive-element.ts:1208
    set reactive-element.ts:726
    value hass-router-page.ts:281
    value partial-panel-resolver.ts:227
    value partial-panel-resolver.ts:88
    performUpdate reactive-element.ts:1327
    scheduleUpdate reactive-element.ts:1261
    _$Ej reactive-element.ts:1233
    requestUpdate reactive-element.ts:1208
    _$Eu reactive-element.ts:946
    _ reactive-element.ts:931
    o hass-router-page.ts:48
    r partial-panel-resolver.ts:44
    C 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
    G lit-html.ts:2183
    update lit-element.ts:165
    performUpdate reactive-element.ts:1329
    scheduleUpdate reactive-element.ts:1261
    _$Ej reactive-element.ts:1233
    requestUpdate reactive-element.ts:1208
    _$Eu reactive-element.ts:946
    _ reactive-element.ts:931
    A lit-element.ts:115
    a home-assistant-main.ts:52
    C scoped-custom-element-registry.js:385
    t scoped-custom-element-registry.js:236
    u lit-html.ts:1129
mushroom-strategy.js:1:24055
    generateDashboard mushroom-strategy.js:1
    a get-strategy.ts:84
    o get-strategy.ts:99
    value ha-panel-lovelace.ts:259
    value ha-panel-lovelace.ts:153
    _$AE reactive-element.ts:1376
    performUpdate reactive-element.ts:1343
    scheduleUpdate reactive-element.ts:1261
    _$Ej reactive-element.ts:1233
    requestUpdate reactive-element.ts:1208
    _$Eu reactive-element.ts:946
    _ reactive-element.ts:931
    A lit-element.ts:115
    o ha-panel-lovelace.ts:66
    C scoped-custom-element-registry.js:385
    t scoped-custom-element-registry.js:236
    value hass-router-page.ts:296
    value hass-router-page.ts:316
    _currentLoadProm hass-router-page.ts:214
    (Async: promise callback)
    value hass-router-page.ts:205
    performUpdate reactive-element.ts:1329
    scheduleUpdate reactive-element.ts:1261
    _$Ej reactive-element.ts:1233
    requestUpdate reactive-element.ts:1208
    set reactive-element.ts:726
    value hass-router-page.ts:281
    value partial-panel-resolver.ts:227
    value partial-panel-resolver.ts:88
    performUpdate reactive-element.ts:1327
    scheduleUpdate reactive-element.ts:1261
    _$Ej reactive-element.ts:1233
    requestUpdate reactive-element.ts:1208
    _$Eu reactive-element.ts:946
    _ reactive-element.ts:931
    o hass-router-page.ts:48
    r partial-panel-resolver.ts:44
    C 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
    G lit-html.ts:2183
    update lit-element.ts:165
    performUpdate reactive-element.ts:1329
    scheduleUpdate reactive-element.ts:1261
    _$Ej reactive-element.ts:1233
    requestUpdate reactive-element.ts:1208
    _$Eu reactive-element.ts:946
    _ reactive-element.ts:931
    A lit-element.ts:115
    a home-assistant-main.ts:52
    C scoped-custom-element-registry.js:385
    t scoped-custom-element-registry.js:236
    u lit-html.ts:1129
DigiLive commented 11 months ago

Thanks... I'll take a look at it.

IzeQube commented 11 months ago

I got it to work. The reason it wasn't working is because I didn't have any weather-entities. I added one and now everything is working.

The following line failed: const n = e?.weather_entity ?? s.W.entities.find((t=>t.entity_id.startsWith("weather.") && null == t.disabled_by && null == t.hidden_by)).entity_id;

DigiLive commented 11 months ago

@AalianKhan https://github.com/AalianKhan/mushroom-strategy/blob/f8f4cb194f60b2c19a49dedcdc11f3d0c70872b0/src/views/HomeView.js#L117 should be changed to )?.entity_id; to fix this issue.