dermotduffy / frigate-hass-card

A Lovelace card for Frigate in Home Assistant
MIT License
538 stars 60 forks source link

Picture elements card - Conditional does not work after update to beta 6.0.0-beta.1 #1547

Closed S-Przybylski closed 1 week ago

S-Przybylski commented 1 week ago

Checklist:

Release with the issue: v6..0.0-beta.1

Last working release (if known): v5.2.0 Browser and Operating System: Windows11 Firefox, Edge Android, Chrome

Description of problem:

After migration of frigate-hass-card a error appeared that the configuration is invalid!

Compared syntax with Picture Elements Card: OK https://www.home-assistant.io/dashboards/picture-elements/

Frigate card diagnostic information

not available!

Editor error: Invalid configuration: [ "elements[0] -> conditions[0] -> condition", "elements[0] -> type", "elements[0] -> icon", "elements[0] -> entity", "elements[0] -> items", "elements[0] -> title", "elements[0] -> service", "elements[0] -> image", "elements[0] -> string" ]

type: custom:frigate-card
cameras:
  - camera_entity: camera.cam3
elements:
  - type: conditional
    conditions:
      - entity: binary_sensor.cam3_person_occupancy
        state: 'on'
    elements:
      - type: icon
        icon: hass:run
        entity: binary_sensor.cam3_person_occupancy

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

Additional information:

dermotduffy commented 1 week ago

Add condition: state to each one and it will work, e.g.:

type: custom:frigate-card
cameras:
  - camera_entity: camera.cam3
elements:
  - type: conditional
    conditions:
      - condition: state
        entity: binary_sensor.cam3_person_occupancy
        state: 'on'
    elements:
      - type: icon
        icon: hass:run
        entity: binary_sensor.cam3_person_occupancy

Interestingly, it seems HA now has two different ways of specifying conditions. I updated the card to match a recent HA change, and so this appears to have broken compatibility for elements.

Syntax 1 (elements): https://www.home-assistant.io/dashboards/picture-elements/#conditional-element Syntax 2 (actions): https://www.home-assistant.io/docs/scripts/conditions/#state-condition

Now in this case, it is completely reasonable to expect elements configuration to just work. For card automations, it's completely reasonable for actions based configuration to just work. Thinking...

S-Przybylski commented 6 days ago

@dermotduffy : Thanks it work! One question: After I upgraded all my cards, i noticed that they are all visible in a single column on my desktop (where i expect at least 3 rows). In the raw Yaml I see a GRID statement while in UI mode it is not visible. Strange. Have you also noted that too?