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

Lovelace card configuration gets scrambled/reordered #3913

Closed
ghost opened this issue Oct 4, 2019 · 8 comments
Closed

Lovelace card configuration gets scrambled/reordered #3913

ghost opened this issue Oct 4, 2019 · 8 comments
Labels
Feature Request Should be a discussion

Comments

@ghost
Copy link

ghost commented Oct 4, 2019

move[bot] commented on Mar 9, 2019, 9:08 PM UTC:

move[bot] commented on Jan 28, 2019, 12:54 AM UTC:

rs443 commented on Jan 26, 2019, 8:03 AM UTC:

Home Assistant release with the issue:
0.86

Last working Home Assistant release (if known):
N/A

Operating environment (Hass.io/Docker/Windows/etc.):
Home Assistant on Windows 10, Python 3.6.8

Component/platform:
Lovelace UI

Description of problem:
I started using lovelace in the gui in the 0.86 release. I noticed a cosmetic "issue". When editing a card the lines in the configuration is scrambled. . The configuration is still valid but the lines has switched places. Possibly reordered alphabetically.

This makes is hard to edit a card in the editor, sometimes impossible.

This is an easy example of a card that was created and is readable and easy to understand:

type: horizontal-stack
cards:
  - type: sensor
    entity: sensor.inside_temperature
    detail: 1
    graph: line
    hours_to_show: 24
  - type: sensor
    entity: sensor.outside_temperature
    detail: 1
    graph: line
    hours_to_show: 24

When editing the same card this is the result:

cards:
  - detail: 1
    entity: sensor.inside_temperature
    graph: line
    hours_to_show: 24
    type: sensor
  - detail: 1
    entity: sensor.outside_temperature
    graph: line
    hours_to_show: 24
    type: sensor
type: horizontal-stack

Here is a more complex card that was once readable:

type: horizontal-stack
cards:
  - type: entity-filter
    entities:
      - device_tracker.iphone1
      - device_tracker.iphone2
    show_empty: false
    state_filter:
      - home
    card:
      type: glance
      show_name: false
      show_state: true
      title: Family
  - type: entity-filter
    entities:
      - device_tracker.iphone2
    show_empty: false
    state_filter:
      - not_home
    card:
      type: map
      entities:
        - entity: device_tracker.iphone2
      default_zoom: 12
  - type: entity-filter
    entities:
      - device_tracker.iphone2
    show_empty: false
    state_filter:
      - not_home
    card:
      type: map
      entities:
        - entity: device_tracker.iphone2
      default_zoom: 12

Now its a nightmare to edit:

cards:
  - card:
      show_name: false
      show_state: true
      title: Family
      type: glance
    entities:
      - device_tracker.iphone1
      - device_tracker.iphone2
    show_empty: false
    state_filter:
      - home
    type: entity-filter
  - card:
      default_zoom: 12
      entities:
        - entity: device_tracker.iphone1
      type: map
    entities:
      - device_tracker.iphone1
    show_empty: false
    state_filter:
      - not_home
    type: entity-filter
  - card:
      default_zoom: 12
      entities:
        - entity: device_tracker.iphone2
      type: map
    entities:
      - device_tracker.iphone2
    show_empty: false
    state_filter:
      - not_home
    type: entity-filter
type: horizontal-stack

It is possible to save the configuration without reordering the values?

This issue was moved by cgarwood from home-assistant/home-assistant#20450.

This issue was moved by iantrich from home-assistant/home-assistant-polymer#2601.

This issue was moved by iantrich from home-assistant/ui-schema#248.

@ghost
Copy link
Author

ghost commented Oct 4, 2019

move[bot] commented on Mar 9, 2019, 9:08 PM UTC:

move[bot] commented on Jan 28, 2019, 12:54 AM UTC:

cgarwood commented on Jan 28, 2019, 12:54 AM UTC:

Moving this to the frontend repo so it can get more visibility

/move to home-assistant-polymer

@ghost
Copy link
Author

ghost commented Oct 4, 2019

move[bot] commented on Mar 9, 2019, 9:08 PM UTC:

balloob commented on Jan 28, 2019, 1:08 AM UTC:

The cause is simple, we don't store the config in yaml format but in json.

The solution is not simple (I know of none)

@ghost
Copy link
Author

ghost commented Oct 4, 2019

move[bot] commented on Mar 9, 2019, 9:08 PM UTC:

iantrich commented on Mar 9, 2019, 9:08 PM UTC:

Going to move this to ui-schema as this is not really a bug, but a preference

@ghost
Copy link
Author

ghost commented Oct 4, 2019

@corbosman commented on May 31, 2019, 10:32 AM UTC:

I really hope something can be done about this. Once you start adding multiple stacks, it becomes absolutely horrendous to edit because of this problem.

@iantrich iantrich added Feature Request Should be a discussion editor: card labels Oct 4, 2019
@olijouve
Copy link

olijouve commented Oct 9, 2019

It used to drive me crazy until I switch to Lovelace yaml mode, I wouldn't say we're facing a need to fixed issue 'cause UI editor is more intended to be used by non tech users.

Honestly if your're skilled enough to write your cards in editor mode, just do exactly the same in yaml files with the "Configurator" Hassio plugin.
It's even better as you can split your views by including yaml file of isolated cards, this is so much more clean and more maintainable, especially when using vertical or horizontal stack !
https://www.home-assistant.io/lovelace/yaml-mode/

Good start is to :

  • Think to snapshot your system first
  • Edit your views to copy past them your Yaml into a flat text file(notepad) you will save as /ui-lovelace.yaml BEFORE to restart HA.

Once done it's up to you if you want to isolate your cards in separate files and !include them in your view.

@iantrich
Copy link
Member

@balloob does this look viable? yaml/pyyaml#254

@valantur
Copy link

valantur commented Jan 4, 2020

I just wanted to say I spent 2 hours un-scrambling my configuration and reverting back to yaml mode because of this. I'm tech-savvy but I'm not trained in reading scrambled yaml code.

@zsarnett
Copy link
Contributor

Resolved in 0.115

@github-actions github-actions bot locked and limited conversation to collaborators Jul 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Feature Request Should be a discussion
Projects
None yet
Development

No branches or pull requests

4 participants