Coder Social home page Coder Social logo

blinds_sun_control's Introduction

hacs_badge

HACS python script for sun-based blinds control

A python script that can open and close cover entities in home assistant based on the sun.

Prequisits

  • enable sun azimuth- and elevation-entities in the default sun-integration
  • add the following template sensor to your configuration
      sun_direction:
        friendly_name: "Sun direction"
        value_template: >-
          {% if states("sensor.sun_solar_azimuth") | int > 12.5 and states("sensor.sun_solar_azimuth") | int < 57.5 %}
          N/E
          {% elif states("sensor.sun_solar_azimuth") | int > 57.6 and states("sensor.sun_solar_azimuth") | int < 102.5 %}
          E
          {% elif states("sensor.sun_solar_azimuth") | int > 102.6 and states("sensor.sun_solar_azimuth") | int < 147.5 %}
          S/E
          {% elif states("sensor.sun_solar_azimuth") | int > 147.6 and states("sensor.sun_solar_azimuth") | int < 192.5 %}
          S
          {% elif states("sensor.sun_solar_azimuth") | int > 192.6 and states("sensor.sun_solar_azimuth") | int < 237.5 %}
          S/W
          {% elif states("sensor.sun_solar_azimuth") | int > 237.6 and states("sensor.sun_solar_azimuth") | int < 282.5 %}
          W
          {% elif states("sensor.sun_solar_azimuth") | int > 282.6 and states("sensor.sun_solar_azimuth") | int < 327.5 %}
          N/W
          {% else %}
          N
          {% endif %}

Example automation

- alias: Blinds Control
  description: 'sun based control for blinds'
  trigger:
  - platform: state
    entity_id: sensor.sun_direction
    id: changed
  condition:
    - condition: numeric_state
      entity_id: weather.forecast_home
      attribute: temperature
      above: 25
  action:
  - service: python_script.blinds_sun_control
    data:
      blinds:
        - entity: cover.balcony_door
          direction: "W"
        - entity: cover.livingroom
          direction: "W"
        - entity: cover.office
          direction: "W"
        - entity: cover.bathroom
          direction: "N"
        - entity: cover.storage
          direction: "N"
        - entity: cover.bedroom
          direction: "S"
      control_entity: sensor.sun_direction
  mode: single
  id: blindscontrol

Versions

0.0.1

Initial Release

blinds_sun_control's People

Contributors

maxgeilert avatar

Watchers

 avatar

blinds_sun_control's Issues

find a way to restore the state of the blind

when the sun has moved out of the direction of a blind, it should reset to its previous state instead of fully open.
this should eliminate opening blinds automatically when they where closed before as well.

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.