Add preferences support

This commit is contained in:
2021-11-21 11:05:04 +02:00
parent b606168f08
commit 823cf4a680
11 changed files with 112 additions and 9 deletions
@@ -15,6 +15,8 @@ trigger:
entity_id: !input light entity_id: !input light
to: "on" to: "on"
mode: queued
condition: condition:
condition: state condition: state
entity_id: sensor.house_mode entity_id: sensor.house_mode
@@ -260,3 +260,12 @@ cards:
entities: entities:
- automation.cover_living_room_open_at_morning - automation.cover_living_room_open_at_morning
- automation.cover_living_room_close_after_sunset - automation.cover_living_room_close_after_sunset
- type: entities
title: Milena Preferences
icon: mdi:star-settings-outline
show_header_toggle: false
entities:
- automation.preferences_milena_enable
- automation.preferences_milena_disable
- automation.preferences_milena_kitchen_temperature_main_adjust_on_start
@@ -149,3 +149,13 @@
- type: custom:button-card - type: custom:button-card
template: v3_button template: v3_button
entity: binary_sensor.someone_home entity: binary_sensor.someone_home
- type: custom:decluttering-card
template: v3_section_title
variables:
- title: Preferences Milena
- type: horizontal-stack
cards:
- type: custom:button-card
template: v3_button
entity: input_number.guest_bedroom_light_temp
@@ -30,15 +30,15 @@ automation:
sequence: sequence:
- service: light.toggle - service: light.toggle
entity_id: light.light_lohas_6 entity_id: light.light_lohas_6
data: data_template:
brightness_pct: 10 brightness_pct: 10
color_temp: 154 color_temp: "{{ states('input_number.guest_bedroom_light_temp') }}"
default: default:
- service: light.toggle - service: light.toggle
entity_id: light.light_lohas_6 entity_id: light.light_lohas_6
data: data_template:
brightness_pct: 100 brightness_pct: 100
color_temp: 154 color_temp: "{{ states('input_number.guest_bedroom_light_temp') }}"
double_click: double_click:
- service: light.toggle - service: light.toggle
+2 -1
View File
@@ -52,7 +52,8 @@ sensor:
day day
{% endif %} {% endif %}
{% else %} {% else %}
{% if is_state('input_select.bedroom_mode', 'night') and is_state('input_select.guest_bedroom_mode', 'night') %} {% if (is_state('input_select.bedroom_mode', 'night') or is_state('input_select.bedroom_mode', 'bed'))
and is_state('input_select.guest_bedroom_mode', 'night') %}
night night
{% else %} {% else %}
day day
@@ -13,8 +13,8 @@ script:
- delay: 00:00:02 - delay: 00:00:02
- service: light.turn_on - service: light.turn_on
entity_id: light.light_lohas_6 entity_id: light.light_lohas_6
data: data_template:
color_temp: 154 color_temp: "{{ states('input_number.guest_bedroom_light_temp') }}"
- service: scene.turn_on - service: scene.turn_on
entity_id: scene.guest_bedroom_before_confirm entity_id: scene.guest_bedroom_before_confirm
- delay: 00:00:01 - delay: 00:00:01
@@ -57,6 +57,7 @@ automation:
entity_id: entity_id:
- light.hue_white_1 - light.hue_white_1
- light.hue_1 - light.hue_1
- light.hallway
- service: light.turn_on - service: light.turn_on
entity_id: light.browser_hallway entity_id: light.browser_hallway
data: data:
@@ -33,7 +33,9 @@ automation:
entity_id: sensor.dark_sky_cloud_coverage entity_id: sensor.dark_sky_cloud_coverage
above: 80 above: 80
- service: light.turn_on - service: light.turn_on
entity_id: light.kitchen entity_id:
- light.kitchen_main
- light.kitchen_secondary
data: data:
brightness_pct: 100 brightness_pct: 100
# Turn on in Night Mode # Turn on in Night Mode
@@ -71,6 +73,8 @@ automation:
entity_id: entity_id:
- light.ledvance_1 - light.ledvance_1
- light.hue_ambiance_1 - light.hue_ambiance_1
- light.kitchen_main
- light.kitchen_secondary
- service: light.turn_on - service: light.turn_on
entity_id: light.browser_kitchen entity_id: light.browser_kitchen
data: data:
@@ -0,0 +1,7 @@
input_number:
guest_bedroom_light_temp:
name: Guest bedroom light temp
min: 154
max: 500
step: 1
icon: bha:table-lamp-variant
@@ -0,0 +1,69 @@
binary_sensor:
- platform: template
sensors:
milena_preferences_enabled:
friendly_name: Milena Preferences
value_template: "{{ is_state('device_tracker.iphone_de_yovcheva', 'home') }}"
icon_template: >
{% if is_state('device_tracker.iphone_de_yovcheva', 'home') %} mdi:star-settings
{% else %} mdi:star-settings-outline
{% endif %}
automation:
- alias: Preferences · Milena · Enable
trigger:
- platform: state
entity_id: device_tracker.iphone_de_yovcheva
from: "not_home"
to: "home"
action:
- service: automation.turn_off
entity_id:
- automation.lighting_kitchen_temperature_main_adjust_on_start
- automation.lighting_kitchen_temperature_secondary_adjust_on_start
- automation.lighting_kitchen_temperature_main_sunset
- automation.lighting_kitchen_temperature_secondary_sunset
- automation.lighting_kitchen_temperature_main_night
- automation.lighting_kitchen_temperature_secondary_night
- service: automation.turn_on
entity_id:
- automation.preferences_milena_kitchen_temperature_main_adjust_on_start
- service: input_number.set_value
entity_id: input_number.guest_bedroom_light_temp
data:
value: 154
- alias: Preferences · Milena · Disable
trigger:
- platform: state
entity_id: device_tracker.iphone_de_yovcheva
from: "home "
to: "not_home"
action:
- service: automation.turn_on
entity_id:
- automation.lighting_kitchen_temperature_main_adjust_on_start
- automation.lighting_kitchen_temperature_secondary_adjust_on_start
- automation.lighting_kitchen_temperature_main_sunset
- automation.lighting_kitchen_temperature_secondary_sunset
- automation.lighting_kitchen_temperature_main_night
- automation.lighting_kitchen_temperature_secondary_night
- service: automation.turn_off
entity_id:
- automation.preferences_milena_kitchen_temperature_main_adjust_on_start
- service: input_number.set_value
entity_id: input_number.guest_bedroom_light_temp
data:
value: 500
- alias: Preferences · Milena · Kitchen · Temperature · Main · Adjust on start
use_blueprint:
path: light_on_set_temperature.yaml
input:
light:
- light.kitchen_main
- light.kitchen_secondary
day_temp: 153
evening_temp: 153
night_temp: 153
+1 -1
View File
@@ -62,7 +62,7 @@ binary_sensor:
device_class: presence device_class: presence
value_template: "{{ is_state('input_boolean.player_2_home', 'on') }}" value_template: "{{ is_state('input_boolean.player_2_home', 'on') }}"
icon_template: > icon_template: >
{% if is_state('input_boolean.georgi_home', 'on') %} mdi:account {% if is_state('input_boolean.player_2_home', 'on') %} mdi:account
{% else %} mdi:account-off-outline {% else %} mdi:account-off-outline
{% endif %} {% endif %}