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

[Bug] When using UI editor, the yaml code gets altered #223

Open
AleXSR700 opened this issue Sep 10, 2024 · 3 comments
Open

[Bug] When using UI editor, the yaml code gets altered #223

AleXSR700 opened this issue Sep 10, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@AleXSR700
Copy link

AleXSR700 commented Sep 10, 2024

Checklist:

  • [ x] I updated to the latest version available
  • [x ] I cleared the cache of my browser

Release with the issue:
3.2.4
Last working release (if known):

Browser and Operating System:
Chrome, Windows 11

Description of problem:

When creating a card using yaml editor, the card seems to work fine.
But if after doing all the manual work, you change a setting (or just play with a setting in the UI) a whole bunch of code is added to the yaml code that is partially incorrect.

E.g., things like the fake CO2 sensor are force added:

convert_units_to: ''
co2_intensity_entity: sensor.co2_signal_co2_intensity
gas_co2_intensity: 2351.6459999999997
min_box_size: 3
min_box_distance: 5

and all the entities of the final child are converted from a nice list to a bunch of entities with no children:
from

          - sensor.fixed_value_consumers_energy_today
          - sensor.siemens_sx758x06te_42_energy_today
          - sensor.naim_audio_nsub_energy_today
          - sensor.light_dining_room_ambient_energy_today_0
          - sensor.light_dining_room_ambient_energy_today_1
          - sensor.office_energy_today

to

      - type: entity
        children: []
        entity_id: sensor.fixed_value_consumers_energy_today
      - type: entity
        children: []
        entity_id: sensor.siemens_sx758x06te_42_energy_today
      - type: entity
        children: []
        entity_id: sensor.naim_audio_nsub_energy_today
      - type: entity
        children: []
        entity_id: sensor.light_dining_room_ambient_energy_today_0

These changes are partially incorrect (adding fake sensor) and in part simply mess up the cleanliness of the code by adding lots of redundant lines. :(

Would it be possible to disable these adjustments and instead only write the specific lines of codes of the options that are adjusted?
E.g. when changing the height, only that line is needed. The rest of the code does not need to be touched :)

Thank you for your consideration (and cool card, of course!)

Alex

Javascript errors shown in the web inspector (if applicable):


Additional information:

@AleXSR700 AleXSR700 added the bug Something isn't working label Sep 10, 2024
@MindFreeze
Copy link
Owner

There is nothing incorrect here. It just adds the default values and expands entities into the long form format.
It would be nice to keep the format but that's a lot of work tbh, so I don't know if I'll get around to it

@MindFreeze MindFreeze added enhancement New feature or request and removed bug Something isn't working labels Sep 11, 2024
@MindFreeze MindFreeze changed the title When using UI editor, the yaml code gets altered incorrectly. When using UI editor, the yaml code gets altered Sep 11, 2024
@AleXSR700
Copy link
Author

Thank you for taking the time to respond :)

Why does it add the default code even though it is not needed? I am not aware of any other card doing this.
After all, the defaults do not need to be added because they are, well, default. Hence they carry no information and just crowd the code.

In addition, the placement is a bit strange 😄
Some default code is added at the top, some at the bottom.

And the long format is... long 😄 and makes it much more difficult to read and adjust.

It would be a cool enhancement especially for people new to the card. I think being able to play with settings via the UI makes it easier to test them. But since it changes the code the user has written, it kind of makes it less attractive to use the UI.

Of course just my opinion :-)

@AleXSR700
Copy link
Author

I noticed that the indentation is not correct when parts are added automatically. The indentation seems to be 4 spaces instead of 2.
Also, would it be possible to keep the entity_id at the top? Right now it is usually found below the children, which makes larger sections more difficult to keep organized.

@AleXSR700 AleXSR700 changed the title When using UI editor, the yaml code gets altered [Bug] When using UI editor, the yaml code gets altered Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants