Giter Site home page Giter Site logo

d8ahazard / hass-animated-scenes Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chazzu/hass-animated-scenes

0.0 2.0 0.0 684 KB

Custom component for Home Assistant which allows you to create animated color and brightness scenes with many options.

Python 100.00%

hass-animated-scenes's Introduction

Animated Scenes

A custom component for Home Assistant to create neat animated light scenes. These aren't really "scenes" in the sense of Home Assistant scenes, but rather switches to turn on/off to start and end an animation.

Features include:

  • Remember the state of the lights before animation started, and restore lights to prior state after animation is turned off.
  • Automatically disable other scenes when activating another scene.
  • Add additional switches to turn off (such as a Flux or Circadian Light switch) when an animation starts.
  • Scene switches work as expected with Google Assistant.
  • If you turn a light off during an animation, it won't turn it back on. If you turn one on, it will add it to the animation automatically.

Disclaimer

I have only tested this with my own system as of now. I do plan on fixing any bugs identified by others, and would like to hear feedback though.

Installation

  • Clone this repository: git clone https://github.com/chazzu/hass-animated-scenes.git
  • If you have not already done so, create a 'custom_components' folder inside the 'config' folder in your Home Assistant installation.
  • Create an 'animated_scenes' folder inside your custom_components folder.
  • Copy the repository files into the animated_scenes folder.
  • Update your configuration.yaml as documented below and then restart your Home Assistant.
  • Be sure to look for the new switch entities and add them to your Lovelace dashboard.

Configuration

First, we configure the Animated Scenes component:

animated_scenes:
    external_switches: # optional; list of entities to turn off when activating a scene
    - switch.circadian_lighting_circadian_light
    - switch.flux_light 

Then add scenes you want to set up:

switch
- platform: animated_scenes
  name: Red Lights # name of scene
  restore: False # don't restore lights to previous state after scene, defaults to True
  ignore_off: False # if a light in the list is off, turn it on. Defaults to True, meaning lights will be ignored if they are off.
  lights: # list of light entities to modify
  - light.hue_color_lamp_1
  - colors:
    color_type: rgb # use rgb colors
    color: [255, 0, 0]
    brightness: 255 # maximum brightness
    weight: 2 # optional; higher number makes a given color more likely to appear. Default is 10, so you can choose some numbers to be less frequent
    one_change_per_tick: False # optional; defaults to false; only change color OR brightness on each tick, don't do both
  - colors:
    color_type: ct # color temperature colors
    color: 500 # number in mireds
  transition: 2 # take 2 seconds to transition
  change_frequency: 15 # change lights every 15 seconds
  change_amount: all # change all lights every time
  animate_brightness: True # defaults to true to change brightness level
  animate_color: True # defaults to true to change color

Sample Configurations

I did this initially to create an animation that mimics the Haunted House animation for Philips Hue but give me greater control. Here is the setting I settled on:

switch:
  - platform: animated_scenes
    name: Spooky Scene
    lights:
      - be sure to list your light entities here
    brightness: [100, 255]
    colors:
      - color_type: rgb_color
        color: [ 247, 95, 28 ]
        one_change_per_tick: True
      - color_type: rgb_color
        color: [ 255, 154, 0 ]
        one_change_per_tick: True
        weight: 5
      - color_type: rgb_color
        color: [ 136, 30, 228 ]
        one_change_per_tick: True
      - color_type: rgb_color
        color: [ 133, 226, 31 ]
        one_change_per_tick: True
      - color_type: rgb_color
        color: [ 148,0,211 ]
        one_change_per_tick: True
      - color_type: rgb_color
        color: [ 200, 10, 10 ]
        one_change_per_tick: True
      - color_type: rgb_color
        color: [ 135, 169, 107 ]
        one_change_per_tick: True
      - color_type: rgb_color
        color: [ 103, 76, 71 ]
        one_change_per_tick: True
    transition: [1, 4]
    change_frequency: 5
    change_amount: 6

hacs_badge

hass-animated-scenes's People

Contributors

bjornsivertsen avatar chazzu avatar d8ahazard avatar

Watchers

 avatar  avatar

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.