Change picture-element base image (day/night)

Hi, i’m trying to make a 3d floor plan and i want to use two base images, on by day and another by night if its posible. How can i change de base image of the picture element with that condition?

thanks in advance

type: picture-elements
image: /local/home3d/casadenoche.png
panel: true
elements:
  - type: image
    action: none
    tap_action:
      action: none
    hold_action:
      action: none
    entity: light.luz_de_lectura
    state_image:
      'on': /local/home3d/casabanoencendido.png
      'off': /local/home3d/transparente.png
    style:
      top: 50%
      left: 50%
      width: 100%

Probably you can use time conditions as done here:

https://community.home-assistant.io/t/picture-elements-with-conditions-depending-on-time-of-the-day/275787

Hope it helps you.

1 Like

Thanks. i finally used a sensor template. i post it in case anyone need it

{% set time = states.sensor.time.state %}
{% set elevation = states.sun.sun.attributes.elevation %}
{% set night_from = '21:27' %}
{% if -2 < elevation < 4 %}
  {{ 'sunrise' if time < '12:00' else 'sunset' }}
{% elif time < '06:00' or time > night_from %} noche
{% elif time < '09:00' %} manana
{% elif time < '12:00' %} mediodia
{% elif time < '17:00' %} mediatarde
{% elif time < night_from %} tarde
{% else %} noche
{% endif %}

And in the card

type: picture-elements
image: /local/CasaHA/casanoche.png
elements:
  - type: image
    entity: sensor.sunstate
    image: /local/CasaHA/casanoche.png
    state_image:
      manana: /local/CasaHA/casamanana.png
      mediodia: /local/CasaHA/casamediodia.png
      mediatarde: /local/CasaHA/casamediatarde.png
      tarde: /local/CasaHA/casatarde.png
      noche: /local/CasaHA/casanoche.png
1 Like