Motion-lys: input_number parametre for gang/daniel/kontor, fix badevaerelse timeout, kompakt lys view
This commit is contained in:
@@ -49,10 +49,24 @@
|
|||||||
- platform: state
|
- platform: state
|
||||||
entity_id: binary_sensor.badevaerelse_bevaegelse
|
entity_id: binary_sensor.badevaerelse_bevaegelse
|
||||||
to: "off"
|
to: "off"
|
||||||
for:
|
|
||||||
minutes: 3 # Standard nat-timeout, kan ændres til 10 for dag, osv.
|
variables:
|
||||||
|
is_dag: >
|
||||||
|
{% set t = now().strftime('%H%M') | int %}
|
||||||
|
{% if is_state('binary_sensor.arbejdsdag', 'on') %}
|
||||||
|
{{ 600 <= t < 2200 }}
|
||||||
|
{% else %}
|
||||||
|
{{ 800 <= t < 2200 }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
action:
|
action:
|
||||||
|
- delay:
|
||||||
|
minutes: >
|
||||||
|
{{ states('input_number.badevaerelse_timeout_day') | int if is_dag
|
||||||
|
else states('input_number.badevaerelse_timeout_night') | int }}
|
||||||
|
- condition: state
|
||||||
|
entity_id: binary_sensor.badevaerelse_bevaegelse
|
||||||
|
state: "off"
|
||||||
- service: light.turn_off
|
- service: light.turn_off
|
||||||
target:
|
target:
|
||||||
area_id: badevaerelse
|
area_id: badevaerelse
|
||||||
|
|||||||
@@ -1,98 +1,60 @@
|
|||||||
# - alias: 'Lys Daniel dag - arbejdsdag - sunrise'
|
- id: daniel_motion_lys
|
||||||
# trigger:
|
alias: Daniel lys via bevaegelse
|
||||||
# platform: time
|
mode: restart
|
||||||
# at: '06:00:00'
|
|
||||||
# condition:
|
|
||||||
# - condition: state
|
|
||||||
# entity_id: binary_sensor.arbejdsdag
|
|
||||||
# state: 'on'
|
|
||||||
# action:
|
|
||||||
# - service: script.sunrise
|
|
||||||
|
|
||||||
|
|
||||||
- alias: 'Lys Daniel dag - arbejdsdag'
|
|
||||||
trigger:
|
trigger:
|
||||||
platform: state
|
- platform: state
|
||||||
entity_id: binary_sensor.hue_motion_sensor_2_motion
|
entity_id: binary_sensor.hue_motion_sensor_2_motion
|
||||||
to: 'on'
|
to: "on"
|
||||||
condition:
|
id: motion_on
|
||||||
- condition: numeric_state
|
|
||||||
entity_id: sensor.hue_motion_sensor_2_illuminance
|
- platform: state
|
||||||
below: 90
|
entity_id: binary_sensor.hue_motion_sensor_2_motion
|
||||||
- condition: state
|
to: "off"
|
||||||
entity_id: binary_sensor.arbejdsdag
|
id: motion_off
|
||||||
state: 'on'
|
|
||||||
- condition: time
|
variables:
|
||||||
after: '06:30:00'
|
lux_limit: "{{ states('input_number.daniel_lux_threshold') | int }}"
|
||||||
before: '19:30:00'
|
brightness: "{{ states('input_number.daniel_brightness') | int }}"
|
||||||
|
timeout: "{{ states('input_number.daniel_timeout') | int }}"
|
||||||
|
|
||||||
|
action:
|
||||||
|
- choose:
|
||||||
|
|
||||||
|
# Motion on: taend lys hvis lux lavt og indenfor tidsvindue
|
||||||
|
- conditions:
|
||||||
|
- condition: trigger
|
||||||
|
id: motion_on
|
||||||
|
- condition: template
|
||||||
|
value_template: >
|
||||||
|
{{ states('sensor.hue_motion_sensor_2_illuminance') | int < lux_limit }}
|
||||||
|
- condition: template
|
||||||
|
value_template: >
|
||||||
|
{% set t = now().strftime('%H%M') | int %}
|
||||||
|
{% if is_state('binary_sensor.arbejdsdag', 'on') %}
|
||||||
|
{{ 630 <= t < 1930 }}
|
||||||
|
{% else %}
|
||||||
|
{{ 1000 <= t < 1945 }}
|
||||||
|
{% endif %}
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ not is_state('input_select.daniel_status', 'syg') }}"
|
value_template: "{{ not is_state('input_select.daniel_status', 'syg') }}"
|
||||||
action:
|
sequence:
|
||||||
- service: homeassistant.turn_on
|
- service: light.turn_on
|
||||||
target:
|
target:
|
||||||
entity_id: light.daniels_vaerelse
|
entity_id: light.daniels_vaerelse
|
||||||
data:
|
data:
|
||||||
brightness_pct: 100
|
brightness_pct: "{{ brightness }}"
|
||||||
|
|
||||||
- alias: 'Lys Daniel dag - ikke arbejdsdag'
|
# Motion off: vent timeout, sluk hvis stadig ingen bevaegelse
|
||||||
trigger:
|
- conditions:
|
||||||
platform: state
|
- condition: trigger
|
||||||
entity_id: binary_sensor.hue_motion_sensor_2_motion
|
id: motion_off
|
||||||
to: 'on'
|
sequence:
|
||||||
condition:
|
- delay:
|
||||||
- condition: numeric_state
|
minutes: "{{ timeout }}"
|
||||||
entity_id: sensor.hue_motion_sensor_2_illuminance
|
|
||||||
below: 90
|
|
||||||
- condition: state
|
- condition: state
|
||||||
entity_id: binary_sensor.arbejdsdag
|
entity_id: binary_sensor.hue_motion_sensor_2_motion
|
||||||
state: 'off'
|
state: "off"
|
||||||
- condition: time
|
- service: light.turn_off
|
||||||
after: '10:00:00'
|
|
||||||
before: '19:45:00'
|
|
||||||
- condition: template
|
|
||||||
value_template: "{{ not is_state('input_select.daniel_status', 'syg') }}"
|
|
||||||
action:
|
|
||||||
- service: homeassistant.turn_on
|
|
||||||
target:
|
target:
|
||||||
entity_id: light.daniels_vaerelse
|
entity_id: light.daniels_vaerelse
|
||||||
data:
|
|
||||||
brightness_pct: 100
|
|
||||||
|
|
||||||
# - alias: 'Lys Daniel aften'
|
|
||||||
# trigger:
|
|
||||||
# platform: state
|
|
||||||
# entity_id: binary_sensor.hue_motion_sensor_2_motion
|
|
||||||
# to: 'on'
|
|
||||||
# condition:
|
|
||||||
# - condition: numeric_state
|
|
||||||
# entity_id: sensor.hue_motion_sensor_2_illuminance
|
|
||||||
# below: 90
|
|
||||||
# - condition: time
|
|
||||||
# after: '20:00:01'
|
|
||||||
# before: '21:00:00'
|
|
||||||
# action:
|
|
||||||
# - service: homeassistant.turn_on
|
|
||||||
# target:
|
|
||||||
# entity_id: light.daniels_vaerelse
|
|
||||||
# data:
|
|
||||||
# brightness_pct: 50
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- alias: 'Sluk lys i Daniel'
|
|
||||||
trigger:
|
|
||||||
platform: state
|
|
||||||
entity_id: binary_sensor.hue_motion_sensor_2_motion
|
|
||||||
to: 'off'
|
|
||||||
for:
|
|
||||||
minutes: 10
|
|
||||||
condition:
|
|
||||||
- condition: time
|
|
||||||
after: '05:00:00'
|
|
||||||
before: '22:00:00'
|
|
||||||
action:
|
|
||||||
- service: homeassistant.turn_off
|
|
||||||
data:
|
|
||||||
entity_id:
|
|
||||||
- light.daniels_vaerelse
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,171 +1,68 @@
|
|||||||
- alias: 'Lys i gang - arbejdsdag - dag'
|
- id: gang_motion_lys
|
||||||
|
alias: Gang lys via bevægelse
|
||||||
|
mode: restart
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
platform: state
|
- platform: state
|
||||||
entity_id: binary_sensor.gang_sensor_motion
|
entity_id: binary_sensor.gang_sensor_motion
|
||||||
to: 'on'
|
to: "on"
|
||||||
condition:
|
id: motion_on
|
||||||
- condition: state
|
|
||||||
entity_id: binary_sensor.arbejdsdag
|
- platform: state
|
||||||
state: 'on'
|
entity_id: binary_sensor.gang_sensor_motion
|
||||||
- condition: numeric_state
|
to: "off"
|
||||||
entity_id: sensor.gang_sensor_illuminance
|
id: motion_off
|
||||||
below: '70'
|
|
||||||
- condition: time
|
variables:
|
||||||
before: '21:30:00'
|
lux_limit: "{{ states('input_number.gang_lux_threshold') | int }}"
|
||||||
- condition: time
|
is_dag: >
|
||||||
after: '06:30:00'
|
{% set t = now().strftime('%H%M') | int %}
|
||||||
|
{% if is_state('binary_sensor.arbejdsdag', 'on') %}
|
||||||
|
{{ 630 <= t < 2130 }}
|
||||||
|
{% else %}
|
||||||
|
{{ 800 <= t < 2200 }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
action:
|
action:
|
||||||
|
- choose:
|
||||||
|
|
||||||
|
# Motion on - dag: taend bright scene hvis lux er lavt nok
|
||||||
|
- conditions:
|
||||||
|
- condition: trigger
|
||||||
|
id: motion_on
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ is_dag }}"
|
||||||
|
- condition: template
|
||||||
|
value_template: >
|
||||||
|
{{ states('sensor.gang_sensor_illuminance') | int < lux_limit }}
|
||||||
|
sequence:
|
||||||
- service: scene.turn_on
|
- service: scene.turn_on
|
||||||
data:
|
|
||||||
entity_id: scene.gang_bright
|
|
||||||
# brightness: 255
|
|
||||||
# color_temp: 396
|
|
||||||
|
|
||||||
- alias: 'Sluk Lys i gang - arbejdsdag - dag'
|
|
||||||
trigger:
|
|
||||||
platform: state
|
|
||||||
entity_id: binary_sensor.gang_sensor_motion
|
|
||||||
to: 'off'
|
|
||||||
for:
|
|
||||||
minutes: 3
|
|
||||||
condition:
|
|
||||||
- condition: state
|
|
||||||
entity_id: binary_sensor.arbejdsdag
|
|
||||||
state: 'on'
|
|
||||||
- condition: time
|
|
||||||
after: '06:30:10'
|
|
||||||
- condition: time
|
|
||||||
before: '21:30:00'
|
|
||||||
action:
|
|
||||||
service: light.turn_off
|
|
||||||
data:
|
|
||||||
entity_id: light.gang
|
|
||||||
|
|
||||||
- alias: 'Lys i gang - ikke arbejdsdag - dag'
|
|
||||||
trigger:
|
|
||||||
platform: state
|
|
||||||
entity_id: binary_sensor.gang_sensor_motion
|
|
||||||
to: 'on'
|
|
||||||
condition:
|
|
||||||
- condition: state
|
|
||||||
entity_id: binary_sensor.arbejdsdag
|
|
||||||
state: 'off'
|
|
||||||
- condition: numeric_state
|
|
||||||
entity_id: sensor.gang_sensor_illuminance
|
|
||||||
below: 70
|
|
||||||
- condition: time
|
|
||||||
after: '08:00:00'
|
|
||||||
- condition: time
|
|
||||||
before: '22:00:00'
|
|
||||||
action:
|
|
||||||
- service: scene.turn_on
|
|
||||||
data:
|
|
||||||
entity_id: scene.gang_bright
|
|
||||||
# brightness: 255
|
|
||||||
# color_temp: 396
|
|
||||||
|
|
||||||
- alias: 'Sluk Lys i gang - ikke arbejdsdag - dag'
|
|
||||||
trigger:
|
|
||||||
platform: state
|
|
||||||
entity_id: binary_sensor.gang_sensor_motion
|
|
||||||
to: 'off'
|
|
||||||
for:
|
|
||||||
minutes: 3
|
|
||||||
condition:
|
|
||||||
- condition: state
|
|
||||||
entity_id: binary_sensor.arbejdsdag
|
|
||||||
state: 'off'
|
|
||||||
- condition: time
|
|
||||||
after: '08:00:10'
|
|
||||||
- condition: time
|
|
||||||
before: '22:00:00'
|
|
||||||
action:
|
|
||||||
service: light.turn_off
|
|
||||||
target:
|
target:
|
||||||
entity_id: light.gang
|
entity_id: scene.gang_bright
|
||||||
|
|
||||||
########## NIGHT
|
# Motion on - nat: taend daempet scene (ingen lux-check)
|
||||||
|
- conditions:
|
||||||
- alias: 'Lys i gang - arbejdsdag - nat'
|
- condition: trigger
|
||||||
trigger:
|
id: motion_on
|
||||||
platform: state
|
- condition: template
|
||||||
entity_id: binary_sensor.gang_sensor_motion
|
value_template: "{{ not is_dag }}"
|
||||||
to: 'on'
|
sequence:
|
||||||
condition:
|
|
||||||
- condition: state
|
|
||||||
entity_id: binary_sensor.arbejdsdag
|
|
||||||
state: 'on'
|
|
||||||
- condition: numeric_state
|
|
||||||
entity_id: sensor.gang_sensor_illuminance
|
|
||||||
below: '70'
|
|
||||||
- condition: time
|
|
||||||
before: '06:30:00'
|
|
||||||
after: '21:30:00'
|
|
||||||
action:
|
|
||||||
- service: scene.turn_on
|
- service: scene.turn_on
|
||||||
data:
|
|
||||||
entity_id: scene.gang_daempet_nat
|
|
||||||
# brightness_pct: 1
|
|
||||||
# color_temp: 396
|
|
||||||
|
|
||||||
- alias: 'Sluk Lys i gang - arbejdsdag - nat'
|
|
||||||
trigger:
|
|
||||||
platform: state
|
|
||||||
entity_id: binary_sensor.gang_sensor_motion
|
|
||||||
to: 'off'
|
|
||||||
for:
|
|
||||||
minutes: 1
|
|
||||||
condition:
|
|
||||||
- condition: state
|
|
||||||
entity_id: binary_sensor.arbejdsdag
|
|
||||||
state: 'on'
|
|
||||||
- condition: time
|
|
||||||
after: '21:30:10'
|
|
||||||
before: '06:30:00'
|
|
||||||
action:
|
|
||||||
service: light.turn_off
|
|
||||||
target:
|
target:
|
||||||
entity_id: light.gang
|
|
||||||
|
|
||||||
- alias: 'Lys i gang - ikke arbejdsdag - nat'
|
|
||||||
trigger:
|
|
||||||
platform: state
|
|
||||||
entity_id: binary_sensor.gang_sensor_motion
|
|
||||||
to: 'on'
|
|
||||||
condition:
|
|
||||||
- condition: state
|
|
||||||
entity_id: binary_sensor.arbejdsdag
|
|
||||||
state: 'off'
|
|
||||||
# - condition: numeric_state
|
|
||||||
# entity_id: sensor.gang_sensor_light_level
|
|
||||||
# below: '70'
|
|
||||||
- condition: time
|
|
||||||
after: '22:00:00'
|
|
||||||
before: '08:00:00'
|
|
||||||
action:
|
|
||||||
- service: scene.turn_on
|
|
||||||
data:
|
|
||||||
entity_id: scene.gang_daempet_nat
|
entity_id: scene.gang_daempet_nat
|
||||||
# brightness_pct: 1
|
|
||||||
# color_temp: 396
|
|
||||||
|
|
||||||
|
# Motion off: vent timeout, sluk hvis stadig ingen bevaegelse
|
||||||
- alias: 'Sluk Lys i gang - ikke arbejdsdag - nat'
|
- conditions:
|
||||||
trigger:
|
- condition: trigger
|
||||||
platform: state
|
id: motion_off
|
||||||
entity_id: binary_sensor.gang_sensor_motion
|
sequence:
|
||||||
to: 'off'
|
- delay:
|
||||||
for:
|
minutes: >
|
||||||
minutes: 1
|
{{ states('input_number.gang_timeout_day') | int if is_dag
|
||||||
condition:
|
else states('input_number.gang_timeout_night') | int }}
|
||||||
- condition: state
|
- condition: state
|
||||||
entity_id: binary_sensor.arbejdsdag
|
entity_id: binary_sensor.gang_sensor_motion
|
||||||
state: 'off'
|
state: "off"
|
||||||
- condition: time
|
|
||||||
after: '22:00:10'
|
|
||||||
before: '08:00:00'
|
|
||||||
action:
|
|
||||||
- service: light.turn_off
|
- service: light.turn_off
|
||||||
target:
|
target:
|
||||||
entity_id: light.gang
|
entity_id: light.gang
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,10 @@
|
|||||||
to: "on"
|
to: "on"
|
||||||
|
|
||||||
condition:
|
condition:
|
||||||
- condition: numeric_state
|
- condition: template
|
||||||
entity_id: sensor.kontor_belysningsstyrke
|
value_template: >
|
||||||
below: 60
|
{{ states('sensor.kontor_belysningsstyrke') | int <
|
||||||
|
states('input_number.kontor_lux_threshold') | int }}
|
||||||
|
|
||||||
action:
|
action:
|
||||||
- service: scene.turn_on
|
- service: scene.turn_on
|
||||||
@@ -36,7 +37,8 @@
|
|||||||
- platform: state
|
- platform: state
|
||||||
entity_id: binary_sensor.kontor_motion_bevaegelse
|
entity_id: binary_sensor.kontor_motion_bevaegelse
|
||||||
to: "on"
|
to: "on"
|
||||||
timeout: "00:10:00"
|
timeout:
|
||||||
|
minutes: "{{ states('input_number.kontor_timeout_day') | int }}"
|
||||||
continue_on_timeout: true
|
continue_on_timeout: true
|
||||||
- condition: state
|
- condition: state
|
||||||
entity_id: binary_sensor.kontor_motion_bevaegelse
|
entity_id: binary_sensor.kontor_motion_bevaegelse
|
||||||
@@ -67,7 +69,8 @@
|
|||||||
- platform: state
|
- platform: state
|
||||||
entity_id: binary_sensor.kontor_motion_bevaegelse
|
entity_id: binary_sensor.kontor_motion_bevaegelse
|
||||||
to: "on"
|
to: "on"
|
||||||
timeout: "00:05:00"
|
timeout:
|
||||||
|
minutes: "{{ states('input_number.kontor_timeout_night') | int }}"
|
||||||
continue_on_timeout: true
|
continue_on_timeout: true
|
||||||
- condition: state
|
- condition: state
|
||||||
entity_id: binary_sensor.kontor_motion_bevaegelse
|
entity_id: binary_sensor.kontor_motion_bevaegelse
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
daniel_lux_threshold:
|
||||||
|
name: Daniel lux grænse
|
||||||
|
min: 0
|
||||||
|
max: 500
|
||||||
|
step: 5
|
||||||
|
unit_of_measurement: lux
|
||||||
|
initial: 90
|
||||||
|
|
||||||
|
daniel_timeout:
|
||||||
|
name: Daniel lys timeout
|
||||||
|
min: 1
|
||||||
|
max: 60
|
||||||
|
step: 1
|
||||||
|
unit_of_measurement: min
|
||||||
|
initial: 10
|
||||||
|
|
||||||
|
daniel_brightness:
|
||||||
|
name: Daniel lysstyrke
|
||||||
|
min: 1
|
||||||
|
max: 100
|
||||||
|
step: 1
|
||||||
|
unit_of_measurement: "%"
|
||||||
|
initial: 100
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
gang_lux_threshold:
|
||||||
|
name: Gang lux grænse
|
||||||
|
min: 0
|
||||||
|
max: 300
|
||||||
|
step: 5
|
||||||
|
unit_of_measurement: lux
|
||||||
|
initial: 70
|
||||||
|
|
||||||
|
gang_timeout_day:
|
||||||
|
name: Gang timeout dag
|
||||||
|
min: 1
|
||||||
|
max: 20
|
||||||
|
step: 1
|
||||||
|
unit_of_measurement: min
|
||||||
|
initial: 3
|
||||||
|
|
||||||
|
gang_timeout_night:
|
||||||
|
name: Gang timeout nat
|
||||||
|
min: 1
|
||||||
|
max: 10
|
||||||
|
step: 1
|
||||||
|
unit_of_measurement: min
|
||||||
|
initial: 1
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
kontor_lux_threshold:
|
||||||
|
name: Kontor lux grænse
|
||||||
|
min: 0
|
||||||
|
max: 500
|
||||||
|
step: 5
|
||||||
|
unit_of_measurement: lux
|
||||||
|
initial: 60
|
||||||
|
|
||||||
|
kontor_timeout_day:
|
||||||
|
name: Kontor timeout dag
|
||||||
|
min: 1
|
||||||
|
max: 60
|
||||||
|
step: 1
|
||||||
|
unit_of_measurement: min
|
||||||
|
initial: 10
|
||||||
|
|
||||||
|
kontor_timeout_night:
|
||||||
|
name: Kontor timeout nat
|
||||||
|
min: 1
|
||||||
|
max: 30
|
||||||
|
step: 1
|
||||||
|
unit_of_measurement: min
|
||||||
|
initial: 5
|
||||||
Reference in New Issue
Block a user