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

Dynamically change background image #893

Open
ggonmar opened this issue Jul 29, 2024 · 2 comments
Open

Dynamically change background image #893

ggonmar opened this issue Jul 29, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@ggonmar
Copy link

ggonmar commented Jul 29, 2024

I would like to be able to have a dynamic background that I can set based on the state of a sensor or some other element.

My intention is to use the card for showing the sun position in regards to my house (which picture I'd put in the compass card), and ideally I would have the image changing in order to show the shade moving with the sun position.

I tried unsuccessfully to apply it like such:

type: custom:compass-card
indicator_sensors:
  - sensor: sun.sun
    attribute: azimuth
    indicator:
      type: circle
    state_abbreviation:
      show: false
language: es
compass:
  north:
    offset: 110
    show: false
  circle:
    background_image: >
      {% set azimuth = state_attr('sun.sun', 'azimuth') | float %} {% if azimuth
      < 45 %}
        /local/images/home_sun/home1.png
      {% elif azimuth < 135 %}
        /local/images/home_sun/home2.png
      {% elif azimuth < 225 %}
        /local/images/home_sun/home3.png
      {% elif azimuth < 315 %}
        /local/images/home_sun/home4.png

This would be great to have!
Thank you!

@tomvanswam
Copy link
Owner

Thanks for the feature request, I'll put it on my list.

@tomvanswam tomvanswam added the enhancement New feature or request label Aug 20, 2024
@tomvanswam tomvanswam self-assigned this Aug 20, 2024
@vingerha
Copy link

Also interested, the documentation seems to indicate that dynamic is available in 'circle', it can hide the image by show: false but the dynamic style does not work based on band.
In line with above I would like to show a moon when the sun is down and another picture when sun is up
Note that I tried to use card config template but that is not stable enough on picking either the sun.sun or sensor.moon_api

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

3 participants