Stue lys: moderniser til 1 automation (mode:restart), input_number parametre for lux+timeouts
This commit is contained in:
@@ -3,7 +3,7 @@ path: lys
|
|||||||
icon: mdi:lightbulb-multiple
|
icon: mdi:lightbulb-multiple
|
||||||
type: sections
|
type: sections
|
||||||
|
|
||||||
max_columns: 2
|
max_columns: 3
|
||||||
|
|
||||||
sections:
|
sections:
|
||||||
- type: grid
|
- type: grid
|
||||||
@@ -150,7 +150,7 @@ sections:
|
|||||||
data:
|
data:
|
||||||
entity_id: script.raketloop
|
entity_id: script.raketloop
|
||||||
- type: grid
|
- type: grid
|
||||||
columns: 2
|
columns: 3
|
||||||
square: false
|
square: false
|
||||||
cards:
|
cards:
|
||||||
- type: custom:mushroom-light-card
|
- type: custom:mushroom-light-card
|
||||||
@@ -464,7 +464,7 @@ sections:
|
|||||||
- light.spejl2
|
- light.spejl2
|
||||||
- light.badevaerelse_2
|
- light.badevaerelse_2
|
||||||
- type: grid
|
- type: grid
|
||||||
columns: 2
|
columns: 3
|
||||||
square: false
|
square: false
|
||||||
cards:
|
cards:
|
||||||
- type: custom:mushroom-light-card
|
- type: custom:mushroom-light-card
|
||||||
@@ -569,7 +569,7 @@ sections:
|
|||||||
show_color_temp_control: true
|
show_color_temp_control: true
|
||||||
collapsible_controls: true
|
collapsible_controls: true
|
||||||
- type: grid
|
- type: grid
|
||||||
columns: 2
|
columns: 3
|
||||||
square: false
|
square: false
|
||||||
cards:
|
cards:
|
||||||
- type: custom:mushroom-light-card
|
- type: custom:mushroom-light-card
|
||||||
@@ -647,7 +647,7 @@ sections:
|
|||||||
data:
|
data:
|
||||||
entity_id: script.have_color_scene
|
entity_id: script.have_color_scene
|
||||||
- type: grid
|
- type: grid
|
||||||
columns: 2
|
columns: 3
|
||||||
square: false
|
square: false
|
||||||
cards:
|
cards:
|
||||||
- type: custom:mushroom-light-card
|
- type: custom:mushroom-light-card
|
||||||
@@ -711,7 +711,7 @@ sections:
|
|||||||
show_brightness_control: true
|
show_brightness_control: true
|
||||||
collapsible_controls: true
|
collapsible_controls: true
|
||||||
- type: grid
|
- type: grid
|
||||||
columns: 2
|
columns: 3
|
||||||
square: false
|
square: false
|
||||||
cards:
|
cards:
|
||||||
- type: custom:mushroom-light-card
|
- type: custom:mushroom-light-card
|
||||||
@@ -756,7 +756,7 @@ sections:
|
|||||||
- type: heading
|
- type: heading
|
||||||
heading: Ovrige
|
heading: Ovrige
|
||||||
- type: grid
|
- type: grid
|
||||||
columns: 2
|
columns: 3
|
||||||
square: false
|
square: false
|
||||||
cards:
|
cards:
|
||||||
- type: custom:mushroom-light-card
|
- type: custom:mushroom-light-card
|
||||||
@@ -779,3 +779,64 @@ sections:
|
|||||||
use_light_color: true
|
use_light_color: true
|
||||||
show_brightness_control: true
|
show_brightness_control: true
|
||||||
collapsible_controls: true
|
collapsible_controls: true
|
||||||
|
|
||||||
|
- type: grid
|
||||||
|
cards:
|
||||||
|
- type: heading
|
||||||
|
heading: Motion-indstillinger
|
||||||
|
- type: entities
|
||||||
|
title: Gang
|
||||||
|
entities:
|
||||||
|
- entity: input_number.gang_lux_threshold
|
||||||
|
name: Lux grænse
|
||||||
|
- entity: input_number.gang_timeout_day
|
||||||
|
name: Timeout dag
|
||||||
|
- entity: input_number.gang_timeout_night
|
||||||
|
name: Timeout nat
|
||||||
|
- type: entities
|
||||||
|
title: Badeværelse
|
||||||
|
entities:
|
||||||
|
- entity: input_number.badevaerelse_timeout_day
|
||||||
|
name: Timeout dag
|
||||||
|
- entity: input_number.badevaerelse_timeout_night
|
||||||
|
name: Timeout nat
|
||||||
|
- type: entities
|
||||||
|
title: Andreas
|
||||||
|
entities:
|
||||||
|
- entity: input_number.andreas_lux_threshold
|
||||||
|
name: Lux grænse
|
||||||
|
- entity: input_number.andreas_timeout
|
||||||
|
name: Timeout
|
||||||
|
- entity: input_number.andreas_brightness
|
||||||
|
name: Lysstyrke
|
||||||
|
- type: entities
|
||||||
|
title: Daniel
|
||||||
|
entities:
|
||||||
|
- entity: input_number.daniel_lux_threshold
|
||||||
|
name: Lux grænse
|
||||||
|
- entity: input_number.daniel_timeout
|
||||||
|
name: Timeout
|
||||||
|
- entity: input_number.daniel_brightness
|
||||||
|
name: Lysstyrke
|
||||||
|
- type: entities
|
||||||
|
title: Kontor
|
||||||
|
entities:
|
||||||
|
- entity: input_number.kontor_lux_threshold
|
||||||
|
name: Lux grænse
|
||||||
|
- entity: input_number.kontor_timeout_day
|
||||||
|
name: Timeout dag
|
||||||
|
- entity: input_number.kontor_timeout_night
|
||||||
|
name: Timeout nat
|
||||||
|
- type: entities
|
||||||
|
title: Stue
|
||||||
|
entities:
|
||||||
|
- entity: input_number.stue_lux_threshold
|
||||||
|
name: Lux grænse
|
||||||
|
- entity: input_number.stue_timeout_morgen
|
||||||
|
name: Timeout morgen (06-16)
|
||||||
|
- entity: input_number.stue_timeout_eftermiddag
|
||||||
|
name: Timeout eftermiddag (16-19)
|
||||||
|
- entity: input_number.stue_timeout_aften
|
||||||
|
name: Timeout aften/TV off (19-00)
|
||||||
|
- entity: input_number.stue_timeout_nat
|
||||||
|
name: Timeout nat (00-06)
|
||||||
|
|||||||
@@ -1,31 +1,65 @@
|
|||||||
- id: stue_motion_lys
|
- id: stue_motion_lys
|
||||||
alias: Stue lys via bevægelse
|
alias: Stue lys via bevaegelse
|
||||||
mode: restart
|
mode: restart
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
- platform: state
|
- platform: state
|
||||||
entity_id: binary_sensor.stue_bevaegelse
|
entity_id: binary_sensor.stue_bevaegelse
|
||||||
to: "on"
|
to: "on"
|
||||||
|
id: motion_on
|
||||||
|
|
||||||
condition:
|
- platform: state
|
||||||
- condition: numeric_state
|
entity_id: binary_sensor.stue_bevaegelse
|
||||||
entity_id: sensor.stue_belysningsstyrke
|
to: "off"
|
||||||
below: 60
|
id: motion_off
|
||||||
|
|
||||||
|
- platform: state
|
||||||
|
entity_id: media_player.samsung_s95ca_55_3
|
||||||
|
to: "off"
|
||||||
|
id: tv_off
|
||||||
|
|
||||||
|
variables:
|
||||||
|
lux_limit: "{{ states('input_number.stue_lux_threshold') | int }}"
|
||||||
|
dagperiode: >
|
||||||
|
{% set t = now().strftime('%H%M') | int %}
|
||||||
|
{% if 600 <= t < 1600 %}morgen
|
||||||
|
{% elif 1600 <= t < 1900 %}eftermiddag
|
||||||
|
{% elif 1900 <= t %}aften
|
||||||
|
{% else %}nat{% endif %}
|
||||||
|
timeout_min: >
|
||||||
|
{% set t = now().strftime('%H%M') | int %}
|
||||||
|
{% if 600 <= t < 1600 %}
|
||||||
|
{{ states('input_number.stue_timeout_morgen') | int }}
|
||||||
|
{% elif 1600 <= t < 1900 %}
|
||||||
|
{{ states('input_number.stue_timeout_eftermiddag') | int }}
|
||||||
|
{% elif 1900 <= t %}
|
||||||
|
{{ states('input_number.stue_timeout_aften') | int }}
|
||||||
|
{% else %}
|
||||||
|
{{ states('input_number.stue_timeout_nat') | int }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
action:
|
action:
|
||||||
- choose:
|
- choose:
|
||||||
|
|
||||||
|
# Motion on: taend lys hvis lux lavt
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: time
|
- condition: trigger
|
||||||
after: "06:00:00"
|
id: motion_on
|
||||||
before: "16:00:00"
|
- condition: template
|
||||||
|
value_template: >
|
||||||
|
{{ states('sensor.stue_belysningsstyrke') | int < lux_limit }}
|
||||||
|
sequence:
|
||||||
|
- choose:
|
||||||
|
- conditions:
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ dagperiode == 'morgen' }}"
|
||||||
sequence:
|
sequence:
|
||||||
- service: scene.turn_on
|
- service: scene.turn_on
|
||||||
target:
|
target:
|
||||||
entity_id: scene.stue_bright
|
entity_id: scene.stue_bright
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: time
|
- condition: template
|
||||||
after: "16:00:00"
|
value_template: "{{ dagperiode == 'eftermiddag' }}"
|
||||||
before: "22:00:00"
|
|
||||||
sequence:
|
sequence:
|
||||||
- service: scene.turn_on
|
- service: scene.turn_on
|
||||||
target:
|
target:
|
||||||
@@ -35,89 +69,38 @@
|
|||||||
target:
|
target:
|
||||||
entity_id: scene.stue_relax_minus_syd
|
entity_id: scene.stue_relax_minus_syd
|
||||||
|
|
||||||
- id: stue_motion_sluk_morgen
|
# Motion off: vent timeout, sluk hvis stadig ingen bevaegelse
|
||||||
alias: Sluk stue lys efter 60 min uden bevægelse om morgenen
|
# Aften: springer over hvis TV er taendt (TV-off trigger haandterer det)
|
||||||
mode: restart
|
- conditions:
|
||||||
|
- condition: trigger
|
||||||
trigger:
|
id: motion_off
|
||||||
- platform: state
|
- condition: template
|
||||||
entity_id: binary_sensor.stue_bevaegelse
|
value_template: >
|
||||||
to: "off"
|
{{ dagperiode != 'aften' or
|
||||||
|
is_state('media_player.samsung_s95ca_55_3', 'off') }}
|
||||||
condition:
|
sequence:
|
||||||
- condition: time
|
- delay:
|
||||||
after: "06:00:00"
|
minutes: "{{ timeout_min }}"
|
||||||
before: "16:00:00"
|
|
||||||
|
|
||||||
action:
|
|
||||||
- wait_for_trigger:
|
|
||||||
- platform: state
|
|
||||||
entity_id: binary_sensor.stue_bevaegelse
|
|
||||||
to: "on"
|
|
||||||
timeout: "01:00:00"
|
|
||||||
continue_on_timeout: true
|
|
||||||
- condition: state
|
- condition: state
|
||||||
entity_id: binary_sensor.stue_bevaegelse
|
entity_id: binary_sensor.stue_bevaegelse
|
||||||
state: "off"
|
state: "off"
|
||||||
|
- condition: template
|
||||||
|
value_template: >
|
||||||
|
{{ dagperiode != 'aften' or
|
||||||
|
is_state('media_player.samsung_s95ca_55_3', 'off') }}
|
||||||
- service: light.turn_off
|
- service: light.turn_off
|
||||||
target:
|
target:
|
||||||
entity_id: light.livingroom
|
entity_id: light.livingroom
|
||||||
|
|
||||||
- id: stue_motion_sluk_eftermiddag_aften
|
# TV slukket om aftenen: vent 10 min, sluk hvis ingen bevaegelse
|
||||||
alias: Sluk stue lys efter 120 min uden bevægelse mellem 16 og 19
|
- conditions:
|
||||||
mode: restart
|
- condition: trigger
|
||||||
|
id: tv_off
|
||||||
trigger:
|
- condition: template
|
||||||
- platform: state
|
value_template: "{{ dagperiode == 'aften' }}"
|
||||||
entity_id: binary_sensor.stue_bevaegelse
|
sequence:
|
||||||
to: "off"
|
- delay:
|
||||||
|
minutes: "{{ timeout_min }}"
|
||||||
condition:
|
|
||||||
- condition: time
|
|
||||||
after: "16:00:00"
|
|
||||||
before: "19:00:00"
|
|
||||||
|
|
||||||
action:
|
|
||||||
- wait_for_trigger:
|
|
||||||
- platform: state
|
|
||||||
entity_id: binary_sensor.stue_bevaegelse
|
|
||||||
to: "on"
|
|
||||||
timeout: "02:00:00"
|
|
||||||
continue_on_timeout: true
|
|
||||||
- condition: state
|
|
||||||
entity_id: binary_sensor.stue_bevaegelse
|
|
||||||
state: "off"
|
|
||||||
- service: light.turn_off
|
|
||||||
target:
|
|
||||||
entity_id: light.livingroom
|
|
||||||
|
|
||||||
- id: stue_motion_sluk_aften_tv
|
|
||||||
alias: Sluk stue lys efter 10 min uden bevægelse når TV er slukket mellem 19 og 00
|
|
||||||
mode: restart
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
- platform: state
|
|
||||||
entity_id: binary_sensor.stue_bevaegelse
|
|
||||||
to: "off"
|
|
||||||
- platform: state
|
|
||||||
entity_id: media_player.samsung_s95ca_55_3
|
|
||||||
to: "off"
|
|
||||||
|
|
||||||
condition:
|
|
||||||
- condition: time
|
|
||||||
after: "19:00:00"
|
|
||||||
before: "00:00:00"
|
|
||||||
|
|
||||||
action:
|
|
||||||
- condition: state
|
|
||||||
entity_id: media_player.samsung_s95ca_55_3
|
|
||||||
state: "off"
|
|
||||||
- wait_for_trigger:
|
|
||||||
- platform: state
|
|
||||||
entity_id: binary_sensor.stue_bevaegelse
|
|
||||||
to: "on"
|
|
||||||
timeout: "00:10:00"
|
|
||||||
continue_on_timeout: true
|
|
||||||
- condition: state
|
- condition: state
|
||||||
entity_id: binary_sensor.stue_bevaegelse
|
entity_id: binary_sensor.stue_bevaegelse
|
||||||
state: "off"
|
state: "off"
|
||||||
@@ -127,31 +110,3 @@
|
|||||||
- service: light.turn_off
|
- service: light.turn_off
|
||||||
target:
|
target:
|
||||||
entity_id: light.livingroom
|
entity_id: light.livingroom
|
||||||
|
|
||||||
- id: stue_motion_sluk_nat
|
|
||||||
alias: Sluk stue lys efter 30 min uden bevægelse om natten
|
|
||||||
mode: restart
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
- platform: state
|
|
||||||
entity_id: binary_sensor.stue_bevaegelse
|
|
||||||
to: "off"
|
|
||||||
|
|
||||||
condition:
|
|
||||||
- condition: time
|
|
||||||
after: "00:00:00"
|
|
||||||
before: "06:00:00"
|
|
||||||
|
|
||||||
action:
|
|
||||||
- wait_for_trigger:
|
|
||||||
- platform: state
|
|
||||||
entity_id: binary_sensor.stue_bevaegelse
|
|
||||||
to: "on"
|
|
||||||
timeout: "00:30:00"
|
|
||||||
continue_on_timeout: true
|
|
||||||
- condition: state
|
|
||||||
entity_id: binary_sensor.stue_bevaegelse
|
|
||||||
state: "off"
|
|
||||||
- service: light.turn_off
|
|
||||||
target:
|
|
||||||
entity_id: light.livingroom
|
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
stue_lux_threshold:
|
||||||
|
name: Stue lux grænse
|
||||||
|
min: 0
|
||||||
|
max: 500
|
||||||
|
step: 5
|
||||||
|
unit_of_measurement: lux
|
||||||
|
initial: 60
|
||||||
|
|
||||||
|
stue_timeout_morgen:
|
||||||
|
name: Stue timeout morgen (06-16)
|
||||||
|
min: 10
|
||||||
|
max: 180
|
||||||
|
step: 5
|
||||||
|
unit_of_measurement: min
|
||||||
|
initial: 60
|
||||||
|
|
||||||
|
stue_timeout_eftermiddag:
|
||||||
|
name: Stue timeout eftermiddag (16-19)
|
||||||
|
min: 10
|
||||||
|
max: 240
|
||||||
|
step: 5
|
||||||
|
unit_of_measurement: min
|
||||||
|
initial: 120
|
||||||
|
|
||||||
|
stue_timeout_aften:
|
||||||
|
name: Stue timeout aften (19-00, TV slukket)
|
||||||
|
min: 1
|
||||||
|
max: 60
|
||||||
|
step: 1
|
||||||
|
unit_of_measurement: min
|
||||||
|
initial: 10
|
||||||
|
|
||||||
|
stue_timeout_nat:
|
||||||
|
name: Stue timeout nat (00-06)
|
||||||
|
min: 5
|
||||||
|
max: 120
|
||||||
|
step: 5
|
||||||
|
unit_of_measurement: min
|
||||||
|
initial: 30
|
||||||
Reference in New Issue
Block a user