PiotrMachowski / Home-Assistant-Lovelace-Local-Conditional-card

This card can show and hide a specific card on current device while not affecting other windows. It does not require any integration to run.
MIT License
61 stars 6 forks source link

In HA 2023.12.1 card showing camera image is not working #25

Open majkers opened 6 months ago

majkers commented 6 months ago

Hello, I have a vertical stack card with 'Live' button at the top to conditionally display custom:webrtc-camera card or picture-entity card. After upgrading to 2023.12.1 I've noticed that only custom:webrtc-camera is working now.

My card looks more or leass like that:

type: vertical-stack       
cards:
  - show_name: true
    show_icon: false
    name: Widok live
    type: button
    tap_action:
      action: fire-dom-event
      local_conditional_card:
        action: toggle
        ids:
          - front_live
          - front_static
    icon: mdi:video-switch
  - type: custom:local-conditional-card
    default: hide
    id: front_live
    card:
      type: custom:webrtc-camera
      url: front_camera_stream
      title: Front
      poster: https://home-assistant.io/images/cast/splash.png
      intersection: 0.75
      mode: webrtc,mse,mp4,mjpeg
      muted: true
  - type: custom:local-conditional-card
    default: show
    id: front_static
    card:
      camera_image: camera.front
      camera_view: auto
      image: >-
        http://XXX
      entity: camera.front
      name: Front
      show_state: false
      type: picture-entity

It was working ok in HA 2023.11.x and before. Picture-entity card taken away for conditional card is working OK

PiotrMachowski commented 6 months ago

Do you have a picture elements card somewhere else in the view? Can you try following config? (it consists of 2 cards)

 -  camera_image: camera.front
    camera_view: auto
    image: >-
      http://XXX
    entity: camera.front
    name: Front
    show_state: false
    type: picture-entity

 -  type: vertical-stack       
    cards:
      - show_name: true
        show_icon: false
        name: Widok live
        type: button
        tap_action:
          action: fire-dom-event
          local_conditional_card:
            action: toggle
            ids:
              - front_live
              - front_static
        icon: mdi:video-switch
      - type: custom:local-conditional-card
        default: hide
        id: front_live
        card:
          type: custom:webrtc-camera
          url: front_camera_stream
          title: Front
          poster: https://home-assistant.io/images/cast/splash.png
          intersection: 0.75
          mode: webrtc,mse,mp4,mjpeg
          muted: true
      - type: custom:local-conditional-card
        default: show
        id: front_static
        card:
          camera_image: camera.front
          camera_view: auto
          image: >-
            http://XXX
          entity: camera.front
          name: Front
          show_state: false
          type: picture-entity
majkers commented 6 months ago

Jus like I mentioned in my issue, I've already tried that and it is working. Picture entity card is working OK when taken away from conditional card. It also doesn't matter if this card is hidden or shown by default.

PiotrMachowski commented 6 months ago

The purpose of my check is different - it makes sure that picture-elements card is loaded from the cache

majkers commented 6 months ago

To be clear.It is picture entity card not picture elements.

PiotrMachowski commented 6 months ago

You are right, apparently I was still partially sleeping. Nevertheless, does it work in the local conditional card when picture entity card is also added directly?

majkers commented 6 months ago

I did what You asked me for and the result is that picture-entity card added somewhere else in my dashboard works but the one in local conditional card is not :(

majkers commented 6 months ago

@PiotrMachowski any idea what might cause the problem?

PiotrMachowski commented 6 months ago

Unfortunately I haven't found any solution so far :(

dafunkydan commented 5 months ago

picture-entity card added somewhere else in my dashboard works but the one in local conditional card is not :(

I thought i am smart by using Custom Button Card to display an Image - Unfortunatly, same goes for Custom Button Card containing an Image. Doesn't get displayed. When the Image is removed from the Button Card, it gets displayed again :(

jordandrako commented 4 months ago

Try wrapping your card in a grid card, that fixed it for me when using cards the local condition card wouldn't render, like vertical-stack or frigate card.

type: custom:local-conditional-card
id: your-id
default: show
card:
  type: grid
  columns: 1
  square: false
  cards:
    - type: picture-entity
       ...
majkers commented 4 months ago

Thanks @jordandrako it is working for me too