GithubHelp home page GithubHelp logo

Comments (1)

DivanX10 avatar DivanX10 commented on September 27, 2024

I figured out how to implement what I wanted. I have created a sensor that shows the day of the week and the sunset or sunrise.

image

# Сенсор дня недели
sensor:
  - platform: template
    sensors:
      dayoftheweek:
        value_template: "{{ ['Monday','Tuesday','Wednesday', 'Thursday','Friday', 'Saturday', 'Sunday'][now().weekday()] }}"
        entity_id: sensor.time
        icon_template: mdi:calendar-month

# Day of the week and sun sensor
  - platform: template
    sensors:
      day_week_and_sun:
        friendly_name: "Day of the week and sun sensor"
        value_template: >
          {% set sunrise = is_state('sun.sun','above_horizon') %}
          {% set sunset = is_state('sun.sun','below_horizon') %}
          {% if sunrise %}
          {{ states.sensor.dayoftheweek.state }}. Sunrise
          {% elif sunset %}
          {{ states.sensor.dayoftheweek.state }}. Sunset
          {% endif %}
        icon_template: >-
          {% if is_state('sun.sun','above_horizon') %}
          mdi:sunrise
          {% elif is_state('sun.sun','below_horizon') %}
          mdi:sunset
          {% endif %}

And I made a wallpaper change not only by the days of the week, but also by sunset and sunrise

animated_background:
  default_url: /local/animated-background/day/01.mp4
  included_users:
    - users
  entity: sensor.day_week_and_sun
  state_url:
    Monday. Sunrise:
      - /local/animated-background/day/Switzerland_01.mp4
      - /local/animated-background/day/Switzerland_02.mp4
    Monday. Sunset:
      - /local/animated-background/night/Moon and lake.mp4
      - /local/animated-background/night/Mountain and lake.mp4
    Tuesday. Sunrise:
      - /local/animated-background/day/Switzerland_03.mp4
      - /local/animated-background/day/Switzerland_04.mp4
    Tuesday. Sunset:
      - /local/animated-background/night/03.mp4
      - /local/animated-background/night/04.mp4
    Wednesday. Sunrise:
      - /local/animated-background/day/Iceland_01.mp4
      - /local/animated-background/day/Iceland_02.mp4
    Wednesday. Sunset:
      - /local/animated-background/night/Space_01.mp4
      - /local/animated-background/night/Space_02.mp4
    Thursday. Sunrise:
      - /local/animated-background/day/Iceland_03.mp4
      - /local/animated-background/day/Iceland_04.mp4
    Thursday. Sunset:
      - /local/animated-background/night/Space_03.mp4
      - /local/animated-background/night/Space_04.mp4
    Friday. Sunrise:
      - /local/animated-background/day/Iceland_05.mp4
      - /local/animated-background/day/Iceland_06.mp4
    Friday. Sunset:
      - /local/animated-background/night/Space_05.mp4
      - /local/animated-background/night/Space_06.mp4
    Saturday. Sunrise:
      - /local/animated-background/day/Switzerland_05.mp4
      - /local/animated-background/day/Switzerland_06.mp4
    Saturday. Sunset:
      - /local/animated-background/night/Space_07.mp4
      - /local/animated-background/night/Space_08.mp4
    Sunday. Sunrise:
      - /local/animated-background/day/Switzerland_07.mp4
      - /local/animated-background/day/Switzerland_08.mp4
    Sunday. Sunset:
      - /local/animated-background/night/Space_03.mp4
      - /local/animated-background/night/Space_02.mp4

from lovelace-animated-background.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.