Switch program based on lux

Hi Guys,

Build a simple blueprint that switches a input_select to a specific state so you can switch the lights!

blueprint:
  name: Verlichting op lichtsterkte
  description: Laat een input_select de verlicht inschakelen of uitschakelen aan de hand van een behaalde lichtsterkte. 
  domain: automation
  input:
    lux_sensor:
      name: Lux sensor
      description: Sensor die de lichtsterkte registreert.
      selector:
        entity:
          domain: sensor
          device_class: illuminance
    switch_on_sensor:
      name: Inschakel sensor
      description: Sensor die de inschakelwaarde bepaald.
      selector:
        entity:
          domain: input_number
    switch_off_sensor:
      name: Uitschakel sensor
      description: Sensor die de uitschakelwaarde bepaald.
      selector:
        entity:
          domain: input_number
    switch_helper:
      name: Programma sensor
      description: Sensor die geschakeld moet worden aan de hand vand de lichtsterkte.
      selector:
        entity:
          domain: input_select
    hysterese_duration_on:      
      name: Inschakeltijd      
      description: Hysterese in minuten voordat programma wordt ingeschakeld.      
      default: 2      
      selector:        
        number:
          min: 1.0
          max: 15.0
          unit_of_measurement: min
          mode: slider
    hysterese_duration_off:      
      name: Uitschakeltijd      
      description: Hysterese in minuten voordat programma wordt uitgeschakeld.      
      default: 5     
      selector:        
        number:
          min: 1.0
          max: 30.0
          unit_of_measurement: min
          mode: slider
  
trigger:
  - platform: numeric_state
    entity_id: !input 'lux_sensor'
    for:
      hours: 0
      minutes: !input 'hysterese_duration_on'
      seconds: 0
    below: !input 'switch_on_sensor'
    id: turn_on
    enabled: true
    alias: Inschakelen
  - platform: numeric_state
    entity_id: !input 'lux_sensor'
    for:
      hours: 0
      minutes: !input 'hysterese_duration_off'
      seconds: 0
    above: !input 'switch_off_sensor'
    id: turn_off
    alias: Uitschakelen
condition:
  - condition: not
    conditions:
      - condition: state
        entity_id: !input switch_helper
        state: Uitgeschakeld
action:
  - choose:
      - conditions:
          - condition: trigger
            id: turn_on
        sequence:
          - service: input_select.select_option
            data:
              option: Inschakelen
            target:
              entity_id: !input switch_helper
      - conditions:
          - condition: trigger
            id: turn_off
        sequence:
          - service: input_select.select_option
            data:
              option: Uitschakelen
            target:
              entity_id: !input switch_helper
mode: single

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

1 Like