home-assistant / frontend

:lollipop: Frontend for Home Assistant
https://demo.home-assistant.io
Other
4.13k stars 2.81k forks source link

Lovelace: view UI configuration (badge tab) not usable when badge is stored ith "null" value #2974

Closed ghost closed 5 years ago

ghost commented 5 years ago

@bigcookie commented on Mar 19, 2019, 6:03 PM UTC:

Home Assistant release with the issue: 0.89.1

Last working Home Assistant release (if known):

Operating environment (Hass.io/Docker/Windows/etc.): Docker

Component/platform: Lovelace UI

Description of problem: By accident I had a badge entered through the configuration UI (enable view configuration by tapping top right corner and select configuration), then click "edit" icon for view, click "Badges" tab, add badge entity. I was able by deleting and adding to have an "empty entity" field between the already entered and the last entity. Saving works and an empty badge is shown in the UI at the correct place. When now entering the configuration UI to change the badges, the list is completely empty - no entity is shown, nor is a field shown to enter a new entity. I selected as next step the "raw configuration access" - the shown file was empty. Reloading the page still kept the error for the UI configurator, but I could access the raw configuration and remove the badge entity ith value "- null". Now all works again.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant): view raw configuration lines (copied only the first lines) - issue is in fourth last line, which I removed to make it work again.

title: Home
views:
  - badges:
      - binary_sensor.schlafzimmer_sz_fenster
      - binary_sensor.kinderzimmer_kz_fenster
      - binary_sensor.arbeitszimmer_az_fenster
      - binary_sensor.wohnzimmer_wz_fenster_links
      - binary_sensor.wohnzimmer_wz_fenster_rechts
      - sensor.yr_symbol
      - sun.sun
    cards:
      - entity: climate.gastebad_gbad_heizung
        name: Gästebad
        type: thermostat
      - entity: climate.wohnzimmer_wz_wandthermostat
        name: Wohnzimmer
        type: thermostat
      - entity: climate.badezimmer_bad_heizung
        name: Bad
        type: thermostat
      - entity: climate.arbeitszimmer_az_heizung
        name: Arbeitszimmer
        type: thermostat
      - entity: climate.kinderzimmer_kz_heizung
        name: Kinderzimmer
        type: thermostat
      - entity: climate.schlafzimmer_sz_heizung
        type: thermostat
      - entity: weather.dark_sky
        icons: /local/custom-lovelace/weather-card/icons/
        name: Wettervorhersage
        type: 'custom:weather-card'
      - entity: media_player.philips_tv
        type: media-control
    icon: 'mdi:home'
    path: default_view
    title: Home
  - cards:
      - entities:
          - entity: sensor.dark_sky_summary
            name: Zusammenfassung
          - entity: sensor.dark_sky_daily_summary
            name: Vorhersage
          - entity: sensor.dark_sky_cloud_coverage
            name: Wolkendecke
          - entity: sensor.dark_sky_humidity
            name: Luftfeuchtigkeit
          - entity: sensor.dark_sky_pressure
            name: Luftdruck
          - entity: sensor.dark_sky_visibility
            name: Sichtgrenze
          - entity: sensor.dark_sky_uv_index
            name: UV Index
          - entity: sensor.dark_sky_temperature
            name: Temperatur
          - entity: sensor.dark_sky_apparent_temperature
            icon: 'mdi:thermometer-lines'
            name: Gefühlte Temperatur
          - entity: sensor.dark_sky_precip_probability
            name: Regenwahrscheinlichkeit
          - entity: sensor.dark_sky_precip_intensity
            name: Regenintensität
          - entity: sensor.dark_sky_wind_speed
            name: Windgeschwindigkeit
          - entity: sensor.dark_sky_wind_gust
            name: Windböen
          - entity: sensor.dark_sky_wind_bearing
            name: Windrichtung
          - entity: sensor.dark_sky_nearest_storm_distance
            name: Gewitter-/Sturmentfernung
          - entity: sensor.dark_sky_nearest_storm_bearing
            name: Gewitter-/Sturmrichtung
        show_header_toggle: false
        title: Wetterdaten (now)
        type: entities
      - cards:
          - entities:
              - entity: sensor.dark_sky_temperature
                name: Temperatur
              - entity: sensor.dark_sky_apparent_temperature
                name: Gefühlte Temperatur
            hours_to_show: 168
            refresh_interval: 300
            title: Temperatur
            type: history-graph
          - entities:
              - entity: sensor.dark_sky_precip_probability
                name: Regenwahrscheinlichkeit
              - entity: sensor.dark_sky_humidity
                name: Luftfeuchtigkeit
            hours_to_show: 168
            refresh_interval: 300
            title: Regen und Luftfeuchte
            type: history-graph
          - entities:
              - entity: sensor.dark_sky_pressure
                name: Luftdruck
            hours_to_show: 168
            refresh_interval: 300
            title: Luftdruck
            type: history-graph
        type: vertical-stack
      - type: vertical-stack
        cards:
          - type: weather-forecast
            entity: weather.dark_sky
            name: Wetterzusammenfassung
          - type: picture-glance
            camera_image: camera.rain
            title: Regenradar
            entities:
              - camera.rain
          - type: picture-glance
            camera_image: camera.cloud_and_sun
            title: Wolkenradar
            entities:
              - camera.cloud_and_sun
    badges:
      - sensor.dark_sky_summary
      - sensor.dark_sky_temperature
      - sensor.dark_sky_apparent_temperature
      - sensor.yr_symbol
      - sensor.dark_sky_cloud_coverage
      - sun.sun
      - null
      - sensor.season
    icon: 'mdi:weather-partlycloudy'
    title: Wetter

Traceback (if applicable): n.a.

Additional information: The issue came most likely due to timing/refresh/updating issues and I was too fast. Request is: when saving, HA should not store badges with "null" value.

This issue was moved by MartinHjelmare from home-assistant/home-assistant#22190.

bigcookie commented 5 years ago

Need to correct above: Also raw editor is not usable - no file gets opened and screen stays empty.

iantrich commented 5 years ago

I was able to replicate your initial issue, in that the UI editor does not show the badges once a null has been inserted. However, I'm not able to replicate the inability to open the raw editor.

bigcookie commented 5 years ago

Replicating the first one already is good, right? I will try to check the other issue. Probably it was temporary. It happened twice to me. I suggest to potentially split the two issues. I an happy to investigate further and create a new ticket when having more details. Whatbis your preferred way?

iantrich commented 5 years ago

I think it is good as is. An issue with the badges UI editor

iantrich commented 5 years ago

Possibly related; compute-unused-entities fails if a badge is null as it doesn't check for undefined before trying to access the entity