kalkih / mini-media-player

Minimalistic media card for Home Assistant Lovelace UI
MIT License
1.51k stars 206 forks source link

Code Editor-only options transform into `[object Object]` when using Lovelace Visual editor #478

Closed TheGroundZero closed 3 years ago

TheGroundZero commented 3 years ago

Some of the options for the custom:mini-media-player cannot be set via the Visual Editor of Lovelace.
To set these up, you need to click the Show Code Editor link and edit the yaml. Or you need to modify ui-lovelace.yaml.

However, if these settings are set using YAML (and saved) and the card is later re-opened in the Visual Editor, the relevant code pieces as replaced by [object Object] and the settings are undone.

For example, notice how the idle_view configuration has been replaced.

image

type: 'custom:mini-media-player'
idle_view: '[object Object]'
[... deleted irrelevant lines ...]

This change only occurs once the card is loaded in the Visual Editor. If you open the Code Editor for the full dashboard (or top-layer card when using nested cards), you can still see the original code.

type: vertical-stack
cards:
  - type: 'custom:mini-media-player'
    [... deleted irrelevant lines ...]
    idle_view:
      when_idle: true

These configurations should either be stored somehow, or Visual Editor shouldn't be an option if any of these config settings are used.

guaro2k commented 3 years ago

Same thing here

 image: {{ states('sensor.sonos_media') }}

this is me trying to pass a template variable for the image url

turns into this:

image:
     '[object Object]': null

Other options like wrapping the template in double quotes results in a colon added and single quotes thrown in like this:

image: "{{ states('sensor.sonos_media') }}"

becomes

 image: '{{ states(''sensor.sonos_media'') }}'

on its own

Any ideas?

kalkih commented 3 years ago

Removed it for now, needs a more advanced config UI if we want to add it back in the future, see #468