This commit is contained in:
darthsandmann
2022-08-30 18:42:25 +02:00
parent 79919e5857
commit 853c1d1716
73 changed files with 3902 additions and 1210 deletions

View File

@ -0,0 +1,21 @@
input_number:
pos_left:
name: Pos Left
initial: 0
step: 1
min: 0
max: 4
mode: box
pos_right:
name: Pos Right
initial: 0
step: 1
min: 0
max: 9
mode: box
timer:
pos_timer:
duration: "00:00:10"

514
packages/button/button_logic.yaml Executable file
View File

@ -0,0 +1,514 @@
script:
#----------------------------------------------------------------------------------#
# Left
#----------------------------------------------------------------------------------#
pos_left_incr:
alias: pos_left_incr
sequence:
- if:
- condition: numeric_state
entity_id: input_number.pos_right
above: '0'
then:
- service: input_number.set_value
data:
value: 0
target:
entity_id: input_number.pos_right
else:
- if:
- condition: numeric_state
entity_id: input_number.pos_left
above: '3'
then:
- service: input_number.set_value
data:
value: 1
target:
entity_id: input_number.pos_left
else:
- service: input_number.increment
target:
entity_id: input_number.pos_left
# Restart/Start the timer
- service: timer.cancel
target:
entity_id: timer.pos_timer
- service: timer.start
target:
entity_id: timer.pos_timer
mode: single
#----------------------------------------------------------------------------------#
# Right
#----------------------------------------------------------------------------------#
pos_right_incr:
alias: pos_right_incr
sequence:
- if:
- condition: numeric_state
entity_id: input_number.pos_left
above: '0'
then:
- service: input_number.set_value
data:
value: 0
target:
entity_id: input_number.pos_left
else:
- if:
- condition: numeric_state
entity_id: input_number.pos_right
above: '2'
then:
- service: input_number.set_value
data:
value: 1
target:
entity_id: input_number.pos_right
else:
- service: input_number.increment
target:
entity_id: input_number.pos_right
# Restart/Start the timer
- service: timer.cancel
target:
entity_id: timer.pos_timer
- service: timer.start
target:
entity_id: timer.pos_timer
mode: single
#----------------------------------------------------------------------------------#
# Up
#----------------------------------------------------------------------------------#
pos_up:
alias: pos_up
sequence:
# 0,0
- if:
- condition: and
conditions:
- condition: state
entity_id: input_number.pos_left
state: "0.0"
- condition: state
entity_id: input_number.pos_right
state: "0.0"
then:
- if:
- condition:
- condition: state
entity_id: light.all_lights
state: "on"
then:
- service: script.summary_notification
else:
- service: scene.turn_on
target:
entity_id: scene.snapshot_all
#- service: light.turn_on
# target:
# entity_id: light.all_lights
# 1,0 Ceiling
- if:
- condition:
- condition: state
entity_id: input_number.pos_left
state: "1.0"
then:
- service: light.turn_on
target:
entity_id: light.ceiling
- service: automation.trigger
target:
entity_id: automation.light_all_snapshot
# 2,0 Bed
- if:
- condition:
- condition: state
entity_id: input_number.pos_left
state: "2.0"
then:
- service: light.turn_on
target:
entity_id: light.bed_ceiling
- service: automation.trigger
target:
entity_id: automation.light_all_snapshot
# 3,0 Indirect
- if:
- condition:
- condition: state
entity_id: input_number.pos_left
state: "3.0"
then:
- service: light.turn_on
target:
entity_id: light.all_indirect
- service: automation.trigger
target:
entity_id: automation.light_all_snapshot
# 4,0 All Lights
- if:
- condition:
- condition: state
entity_id: input_number.pos_left
state: "4.0"
then:
- service: light.turn_on
target:
entity_id: light.all_lights
- service: automation.trigger
target:
entity_id: automation.light_all_snapshot
# 0,1 Adaptive
- if:
- condition:
- condition: state
entity_id: input_number.pos_right
state: "1.0"
then:
- service: scene.turn_on
target:
entity_id: scene.light_adaptive
- service: automation.trigger
target:
entity_id: automation.light_all_snapshot
# 0,2 Night
- if:
- condition:
- condition: state
entity_id: input_number.pos_right
state: "2.0"
then:
- service: scene.turn_on
target:
entity_id: scene.light_night
- service: automation.trigger
target:
entity_id: automation.light_all_snapshot
# 0,3 Bright
- if:
- condition:
- condition: state
entity_id: input_number.pos_right
state: "3.0"
then:
- service: scene.turn_on
target:
entity_id: scene.light_bright
- service: automation.trigger
target:
entity_id: automation.light_all_snapshot
mode: single
#----------------------------------------------------------------------------------#
# Down
#----------------------------------------------------------------------------------#
pos_down:
alias: pos_down
sequence:
# 0,0
- if:
- condition: and
conditions:
- condition: state
entity_id: input_number.pos_left
state: "0.0"
- condition: state
entity_id: input_number.pos_right
state: "0.0"
then:
- if:
- condition:
- condition: state
entity_id: light.all_lights
state: "off"
then:
- service: script.summary_notification
else:
- service: light.turn_off
target:
entity_id: light.all_lights
# 1,0 Ceiling
- if:
- condition:
- condition: state
entity_id: input_number.pos_left
state: "1.0"
then:
- service: light.turn_off
target:
entity_id: light.ceiling
- service: automation.trigger
target:
entity_id: automation.light_all_snapshot
# 2,0 Bed
- if:
- condition:
- condition: state
entity_id: input_number.pos_left
state: "2.0"
then:
- service: light.turn_off
target:
entity_id: light.bed_ceiling
- service: automation.trigger
target:
entity_id: automation.light_all_snapshot
# 3,0 Indirect
- if:
- condition:
- condition: state
entity_id: input_number.pos_left
state: "3.0"
then:
- service: light.turn_off
target:
entity_id: light.all_indirect
- service: automation.trigger
target:
entity_id: automation.light_all_snapshot
# 4,0 All Lights
- if:
- condition:
- condition: state
entity_id: input_number.pos_left
state: "4.0"
then:
- service: light.turn_off
target:
entity_id: light.all_lights
mode: single
#----------------------------------------------------------------------------------#
# Dimming
#----------------------------------------------------------------------------------#
button_brightness_up:
sequence:
- service: light.turn_on
data_template:
entity_id: light.direct
brightness: >-
{% set current = states.light.direct.attributes.brightness|default(0)|int %}
{% set step = 100 %}
{% set next = current + step %}
{% if next > 255 %}
{% set next = 255 %}
{% endif %}
{{ next }}
- delay:
milliseconds: 1
- service: script.turn_on
data:
entity_id: script.button_brightness_up_loop
button_brightness_up_loop:
sequence:
- service: script.turn_on
data:
entity_id: script.button_brightness_up
button_brightness_down:
sequence:
- service: light.turn_on
data_template:
entity_id: light.direct
brightness: >-
{% set current = states.light.direct.attributes.brightness|default(0)|int %}
{% set step = 100 %}
{% set next = current - step %}
{% if next < 1 %}
{% set next = 1 %}
{% endif %}
{{ next }}
- delay:
milliseconds: 1
- service: script.turn_on
data:
entity_id: script.button_brightness_down_loop
button_brightness_down_loop:
sequence:
- service: script.turn_on
data:
entity_id: script.button_brightness_down
#------------------------------------------------------------------------------------#
# Automations
#------------------------------------------------------------------------------------#
automation:
# Timer
- alias: pos_timer_reset
mode: single
trigger:
- platform: event
event_type: timer.finished
event_data:
entity_id: timer.pos_timer
action:
- service: input_number.set_value
data:
value: 0
target:
entity_id:
- input_number.pos_left
- input_number.pos_right
# Pos 1,0 Ceiling
- alias: pos_1_0_flash
mode: single
trigger:
- platform: state
entity_id:
- input_number.pos_left
to: "1.0"
action:
- service: automation.trigger
target:
entity_id: automation.light_all_snapshot
- service: switch.turn_off
target:
entity_id: switch.adaptive_lighting_default
- service: light.turn_on
data:
effect: Twitter
target:
entity_id: light.ceiling
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 500
- service: scene.turn_on
target:
entity_id: scene.snapshot_all
# Pos 2,0 Ceiling Bed
- alias: pos_2_0_flash
mode: single
trigger:
- platform: state
entity_id:
- input_number.pos_left
to: "2.0"
action:
- service: automation.trigger
target:
entity_id: automation.light_all_snapshot
- service: switch.turn_off
target:
entity_id: switch.adaptive_lighting_default
- service: light.turn_on
data:
effect: Twitter
target:
entity_id: light.bed_ceiling
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 500
- service: scene.turn_on
target:
entity_id: scene.snapshot_all
# Pos 3,0 Indirect
- alias: pos_3_0_flash
mode: single
trigger:
- platform: state
entity_id:
- input_number.pos_left
to: "3.0"
action:
- service: automation.trigger
target:
entity_id: automation.light_all_snapshot
- service: switch.turn_off
target:
entity_id: switch.adaptive_lighting_default
- service: light.turn_on
data:
effect: Twitter
target:
entity_id: light.all_indirect
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 500
- service: scene.turn_on
target:
entity_id: scene.snapshot_all
# Pos 4,0 All Lights
- alias: pos_4_0_flash
mode: single
trigger:
- platform: state
entity_id:
- input_number.pos_left
to: "4.0"
action:
- service: automation.trigger
target:
entity_id: automation.light_all_snapshot
- service: switch.turn_off
target:
entity_id: switch.adaptive_lighting_default
- service: light.turn_on
data:
effect: Twitter
target:
entity_id: light.all_lights
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 500
- service: scene.turn_on
target:
entity_id: scene.snapshot_all
# Pos 0,1 Adaptive
- alias: pos_0_1_flash
mode: single
trigger:
- platform: state
entity_id:
- input_number.pos_right
to: "1.0"
action:
- service: scene.turn_on
target:
entity_id: scene.light_adaptive
- service: automation.trigger
target:
entity_id: automation.light_all_snapshot
# Pos 0,2
- alias: pos_0_2_flash
mode: single
trigger:
- platform: state
entity_id:
- input_number.pos_right
to: "2.0"
action:
- service: scene.turn_on
target:
entity_id: scene.light_night
- service: automation.trigger
target:
entity_id: automation.light_all_snapshot
# Pos 0,3
- alias: pos_0_3_flash
mode: single
trigger:
- platform: state
entity_id:
- input_number.pos_right
to: "3.0"
action:
- service: scene.turn_on
target:
entity_id: scene.light_bright
- service: automation.trigger
target:
entity_id: automation.light_all_snapshot

104
packages/button/button_press.yaml Executable file
View File

@ -0,0 +1,104 @@
automation:
#----------------------------------------------------------------------------------#
# L/R
#----------------------------------------------------------------------------------#
# Button Left: Pos Left
- alias: button_pos_left
trigger:
# Bed
- platform: device
domain: mqtt
device_id: 4f9d195bf907da59e1461a5d2404f606
type: action
subtype: arrow_left_click
discovery_id: 0x0c4314fffee0bb44 action_arrow_left_click
# Door
- platform: device
domain: mqtt
device_id: 5e67efdee83ccceaac84046dfc6c735e
type: action
subtype: arrow_left_click
discovery_id: 0x0c4314fffef68790 action_arrow_left_click
action:
- service: script.pos_left_incr
mode: single
# Button Left: Pos Right
- alias: button_pos_right
trigger:
# Bed
- platform: device
domain: mqtt
device_id: 4f9d195bf907da59e1461a5d2404f606
type: action
subtype: arrow_right_click
discovery_id: 0x0c4314fffee0bb44 action_arrow_right_click
# Door
- platform: device
domain: mqtt
device_id: 5e67efdee83ccceaac84046dfc6c735e
type: action
subtype: arrow_left_click
discovery_id: 0x0c4314fffef68790 action_arrow_right_click
action:
- service: script.pos_right_incr
mode: single
#----------------------------------------------------------------------------------#
# Up/Down
#----------------------------------------------------------------------------------#
# Up
- alias: button_up
trigger:
# Desk
- platform: device
domain: mqtt
device_id: 121e4230e41feb19254fa92ed5335760
type: action
subtype: "on"
discovery_id: 0x2c1165fffebebf6d action_on
# Bed
- platform: device
domain: mqtt
device_id: 4f9d195bf907da59e1461a5d2404f606
type: action
subtype: "on"
discovery_id: 0x0c4314fffee0bb44 action_on
# Door
- platform: device
domain: mqtt
device_id: 5e67efdee83ccceaac84046dfc6c735e
type: action
subtype: "on"
discovery_id: 0x0c4314fffef68790 action_on
action:
- service: script.pos_up
mode: single
# Down
- alias: button_down
trigger:
# Desk
- platform: device
domain: mqtt
device_id: 121e4230e41feb19254fa92ed5335760
type: action
subtype: "off"
discovery_id: 0x2c1165fffebebf6d action_off
# Bed
- platform: device
domain: mqtt
device_id: 4f9d195bf907da59e1461a5d2404f606
type: action
subtype: "off"
discovery_id: 0x0c4314fffee0bb44 action_off
# Door
- platform: device
domain: mqtt
device_id: 5e67efdee83ccceaac84046dfc6c735e
type: action
subtype: "off"
discovery_id: 0x0c4314fffef68790 action_off
action:
- service: script.pos_down
mode: single

View File

@ -0,0 +1,123 @@
automation:
## -----------------------------------------------------------------------------------------------##
## Notification on state change
## -----------------------------------------------------------------------------------------------##
- alias: "climate_recommendation_close"
trigger:
- platform: state
entity_id: sensor.climate_temp_recommendation
from: 'open the window'
to: 'close the window'
action:
- service: notify.notify
data:
message: "Close the window."
- alias: "climate_recommendation_open"
trigger:
- platform: state
entity_id: sensor.climate_temp_recommendation
from: 'close the window'
to: 'open the window'
action:
- service: notify.notify
data:
message: "Open the window."
## -----------------------------------------------------------------------------------------------##
## Trigger alle 15min um Abfrage und Temperaturanpassung durchzuführen
## -----------------------------------------------------------------------------------------------##
# - alias: climate_set_auto
# initial_state: on
# trigger:
# - platform: time_pattern
# minutes: '/5'
# - platform: state
# entity_id: sensor.climate_temp
# condition:
# - condition: template
# value_template: '{{ states.climate.kai.state != "unavailable" }}'
# action:
# - service: script.turn_on
# entity_id: script.climate_set
# - delay: '00:20'
# - service: script.turn_on
# entity_id: script.climate_set
# - service: input_number.set_value
# data_template:
# entity_id: input_number.climate_temp_last
# value: '{{ states("sensor.aqara_temperature_kai_temperature")|float }}'
# - alias: climate_set_manual
# initial_state: on
# trigger:
# - platform: state
# entity_id: input_number.climate_temp
# condition:
# - condition: template
# value_template: '{{ states.climate.kai.state != "unavailable" }}'
# action:
# - service: input_boolean.turn_off
# entity_id: input_boolean.climate_auto
# - service: script.turn_on
# entity_id: script.climate_set
# - delay: '00:20'
# - service: script.turn_on
# entity_id: script.climate_set
# - alias: climate_set_power_off
# initial_state: on
# trigger:
# - platform: state
# entity_id: input_boolean.climate_power
# to: "off"
# action:
# - service: climate.turn_off
# entity_id: climate.kai
# - delay: '00:20'
# - service: climate.turn_off
# entity_id: climate.kai
# - alias: climate_set_power_on
# initial_state: on
# trigger:
# - platform: state
# entity_id: input_boolean.climate_power
# to: "on"
# action:
# - service: climate.turn_on
# entity_id: climate.kai
# - delay: '00:20'
# - service: climate.turn_on
# entity_id: climate.kai
## -----------------------------------------------------------------------------------------------##
## Trigger alle 5min, wenn Wochentag -> aktiviere Weekday-Boolean
## -----------------------------------------------------------------------------------------------##
- alias: climate_weekday
initial_state: on
trigger:
platform: time_pattern
minutes: '/5'
condition:
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
action:
service: input_boolean.turn_on
entity_id: input_boolean.climate_weekday
## -----------------------------------------------------------------------------------------------##
## Trigger alle 5min, wenn Wochenende -> deaktiviere Weekday-Boolean
## -----------------------------------------------------------------------------------------------##
- alias: climate_weekend
initial_state: on
trigger:
platform: time_pattern
minutes: '/5'
condition:
- condition: time
weekday:
- sat
- sun
action:
service: input_boolean.turn_off
entity_id: input_boolean.climate_weekday

View File

@ -0,0 +1,24 @@
sensor:
- platform: temperature_feels_like
name: temperature_outside_feelslike
source:
- weather.openweathermap
- platform: template
sensors:
temperature_inside:
value_template: >
{{ states('sensor.temperature_kai_temperature') }}
friendly_name: 'Temperature'
unit_of_measurement: "°C"
device_class: temperature
humidity_inside:
value_template: >
{{ states('sensor.temperature_kai_humidity') }}
friendly_name: 'Humidity'
- platform: temperature_feels_like
name: temperature_inside_feelslike
source:
- sensor.temperature_inside
- sensor.humidity_inside

View File

@ -0,0 +1,73 @@
## -------------------------------------------------------------------------------------------------##
## Inputs
## -------------------------------------------------------------------------------------------------##
input_number:
climate_temp:
name: Target Manual
#initial: 21.5
min: 15
max: 29
step: 0.5
climate_temp_day:
name: Target Day
#initial: 20.5
min: 15
max: 29
step: 0.5
climate_temp_night:
name: Target Night
#initial: 17.0
min: 15
max: 29
step: 0.5
climate_temp_accuracy:
name: Accuracy
#initial: 1
min: 0
max: 5
step: 0.5
climate_temp_offset:
name: Offset Climate<->Temp
#initial: 1
min: -2
max: 2
step: 0.5
climate_temp_last:
name: Last Temp
min: 0
max: 29
step: 0.01
mode: box
input_datetime:
climate_morning:
name: "Day begins"
has_time: true
has_date: false
#initial: "10:00"
# climate_morning_weekend:
# name: "Day begins Sat."
# has_time: true
# has_date: false
# #initial: "15:30"
climate_night:
name: "Day ends"
has_time: true
has_date: false
#initial: "23:59"
input_boolean:
climate_auto:
name: 'Automatic'
icon: mdi:power
#initial: off
# climate_power:
# name: 'Power'
# icon: mdi:power
# #initial: off
# climate_weekday:
# name: 'Weekday'
# #initial: on
climate_away:
name: 'Away'
#initial: off

View File

@ -0,0 +1,256 @@
## -------------------------------------------------------------------------------------------------##
## Scripts: um einzelne Temperaturen zu setzen da Variable Fehler ausgibt (BUG)
## Ugly but working....
## -------------------------------------------------------------------------------------------------##
script:
climate_set_15_0:
sequence:
- service: climate.turn_off
entity_id: climate.kai
climate_set_15_5:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "15.50"
hvac_mode: "heat"
climate_set_16_0:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "16.00"
hvac_mode: "heat"
climate_set_16_5:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "16.50"
hvac_mode: "heat"
climate_set_17_0:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "17.00"
hvac_mode: "heat"
climate_set_17_5:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "17.50"
hvac_mode: "heat"
climate_set_18_0:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "18.00"
hvac_mode: "heat"
climate_set_18_5:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "18.50"
hvac_mode: "heat"
climate_set_19_0:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "19.00"
hvac_mode: "heat"
climate_set_19_5:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "19.50"
hvac_mode: "heat"
climate_set_20_0:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "20.00"
hvac_mode: "heat"
climate_set_20_5:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "20.00"
hvac_mode: "heat"
climate_set_21_0:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "21.00"
hvac_mode: "heat"
climate_set_21_5:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "21.50"
hvac_mode: "heat"
climate_set_22_0:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "22.00"
hvac_mode: "heat"
climate_set_22_5:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "22.50"
hvac_mode: "heat"
climate_set_23_0:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "23.00"
hvac_mode: "heat"
climate_set_23_5:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "23.50"
hvac_mode: "heat"
climate_set_24_0:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "24.00"
hvac_mode: "heat"
climate_set_24_5:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "24.50"
hvac_mode: "heat"
climate_set_25_0:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "25.00"
hvac_mode: "heat"
climate_set_25_5:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "25.50"
hvac_mode: "heat"
climate_set_26_0:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "26.00"
hvac_mode: "heat"
climate_set_26_5:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "26.50"
hvac_mode: "heat"
climate_set_27_0:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "27.00"
hvac_mode: "heat"
climate_set_27_5:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "27.50"
hvac_mode: "heat"
climate_set_28_0:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "28.00"
hvac_mode: "heat"
climate_set_28_5:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "28.50"
hvac_mode: "heat"
climate_set_29_0:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "29.00"
hvac_mode: "heat"
climate_set_29_5:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "29.50"
hvac_mode: "heat"
climate_set_off:
sequence:
- service: climate.turn_off
entity_id: climate.kai
climate_set:
alias: Setze Temperatur
sequence:
- service: script.turn_on
data_template:
entity_id: >
{% set temp_set = ( states("sensor.climate_temp_set") | float ) %}
{% if states("input_boolean.climate_power") == "off" %} script.climate_set_off
{% elif temp_set == ( "00.00" | float ) %} script.climate_set_20_5
{% elif temp_set <= ( "15.00" | float ) %} script.climate_set_15_0
{% elif temp_set == ( "15.50" | float ) %} script.climate_set_15_5
{% elif temp_set == ( "16.00" | float ) %} script.climate_set_16_0
{% elif temp_set == ( "16.50" | float ) %} script.climate_set_16_5
{% elif temp_set == ( "17.00" | float ) %} script.climate_set_17_0
{% elif temp_set == ( "17.50" | float ) %} script.climate_set_17_5
{% elif temp_set == ( "18.00" | float ) %} script.climate_set_18_0
{% elif temp_set == ( "18.50" | float ) %} script.climate_set_18_5
{% elif temp_set == ( "19.00" | float ) %} script.climate_set_19_0
{% elif temp_set == ( "19.50" | float ) %} script.climate_set_19_5
{% elif temp_set == ( "20.00" | float ) %} script.climate_set_20_0
{% elif temp_set == ( "20.50" | float ) %} script.climate_set_20_5
{% elif temp_set == ( "21.00" | float ) %} script.climate_set_21_0
{% elif temp_set == ( "21.50" | float ) %} script.climate_set_21_5
{% elif temp_set == ( "22.00" | float ) %} script.climate_set_22_0
{% elif temp_set == ( "22.50" | float ) %} script.climate_set_22_5
{% elif temp_set == ( "23.00" | float ) %} script.climate_set_23_0
{% elif temp_set == ( "23.50" | float ) %} script.climate_set_23_5
{% elif temp_set == ( "24.00" | float ) %} script.climate_set_24_0
{% elif temp_set == ( "24.50" | float ) %} script.climate_set_24_5
{% elif temp_set == ( "25.00" | float ) %} script.climate_set_25_0
{% elif temp_set == ( "25.50" | float ) %} script.climate_set_25_5
{% elif temp_set == ( "26.00" | float ) %} script.climate_set_26_0
{% elif temp_set == ( "26.50" | float ) %} script.climate_set_26_5
{% elif temp_set == ( "27.00" | float ) %} script.climate_set_27_0
{% elif temp_set == ( "27.50" | float ) %} script.climate_set_27_5
{% elif temp_set == ( "28.00" | float ) %} script.climate_set_28_0
{% elif temp_set == ( "28.50" | float ) %} script.climate_set_28_5
{% elif temp_set == ( "29.00" | float ) %} script.climate_set_29_0
{% elif temp_set >= ( "29.50" | float ) %} script.climate_set_29_5
{% else %} script.climate_set_20_5 {% endif %}

View File

@ -0,0 +1,215 @@
sensor:
## -----------------------------------------------------------------------------------------------##
## Calculation of temperature change
## -----------------------------------------------------------------------------------------------##
- platform: template
sensors:
climate_temp_change:
friendly_name: change in temperature
value_template: >
{% set now = states("sensor.aqara_temperature_kai_temperature")|float %}
{% set last = states("input_number.climate_temp_last")|float %}
{% set change = (now | float - last) | float %}
{% if now == ("0.0"|float) %} {% set change = ("0.0"|float) %} {% endif %}
{{ change | round(2) }}
## -----------------------------------------------------------------------------------------------##
## Calculation of the target temperature
## -----------------------------------------------------------------------------------------------##
- platform: template
sensors:
climate_temp:
friendly_name: target temperature
unit_of_measurement: '°C'
value_template: >
{% set auto = states("input_boolean.climate_auto") %}
{% set manual_temp = states("input_number.climate_temp") %}
{% if auto == "off" %} {{ manual_temp }}
{% else %}
{% set time = states("sensor.time") %}
{% set morning = states("input_datetime.climate_morning") %}
{% set night = states("input_datetime.climate_night") %}
{% set morning_temp = states("input_number.climate_temp_day")|float %}
{% set night_temp = states("input_number.climate_temp_night")|float %}
{% if night > morning %}
{% if time > morning and time <= night %} {{ morning_temp|float }}
{% else %} {{ night_temp|float }} {% endif %}
{% else %}
{% if time <= morning and time > night %} {{ morning_temp|float }}
{% else %} {{ night_temp|float }} {% endif %}
{% endif %}
{% endif %}
# Mit Weekday
# - platform: template
# sensors:
# climate_temp:
# friendly_name: target temperature
# unit_of_measurement: '°C'
# value_template: >
# {% set auto = states("input_boolean.climate_auto") %}
# {% set manual_temp = states("input_number.climate_temp") %}
# {% if auto == "off" %} {{ manual_temp }}
# {% else %}
# {% set time = states("sensor.time") %}
# {% set morning = states("sensor.climate_morning") %}
# {% set weekday = states("input_boolean.climate_weekday") %}
# {% if weekday == "on" %} {% set morning = states("input_datetime.climate_morning") %}
# {% else %} {% set morning = states("input_datetime.climate_morning_weekend") %} {% endif %}
# {% set night = states("input_datetime.climate_night") %}
# {% set morning_temp = states("input_number.climate_temp_morning")|float %}
# {% set night_temp = states("input_number.climate_temp_night")|float %}
# {% if night > morning %}
# {% if time > morning and time <= night %} {{ morning_temp|float }}
# {% else %} {{ night_temp|float }} {% endif %}
# {% else %}
# {% if time <= morning and time > night %} {{ morning_temp|float }}
# {% else %} {{ night_temp|float }} {% endif %}
# {% endif %}
# {% endif %}
## -----------------------------------------------------------------------------------------------##
## target min and max temperature
## -----------------------------------------------------------------------------------------------##
- platform: template
sensors:
climate_temp_min:
friendly_name: target min
unit_of_measurement: '°C'
value_template: >
{% set target = states("sensor.climate_temp")|float %}
{% set accuracy = states("input_number.climate_temp_accuracy")|float %}
{{ target-accuracy|float }}
- platform: template
sensors:
climate_temp_max:
friendly_name: target max
unit_of_measurement: '°C'
value_template: >
{% set target = states("sensor.climate_temp")|float %}
{% set accuracy = states("input_number.climate_temp_accuracy")|float %}
{{ target+accuracy|float }}
## -----------------------------------------------------------------------------------------------##
## Recommendation
## -----------------------------------------------------------------------------------------------##
- platform: template
sensors:
climate_temp_recommendation:
friendly_name: temperature recommendation
value_template: >
{% set min = states("sensor.climate_temp_min")|float %}
{% set max = states("sensor.climate_temp_max")|float %}
{% set target = states("sensor.climate_temp")|float %}
{% set temp_inside = states("sensor.temperature_kai_temperature")|float %}
{% set temp_outside = states("sensor.temperature_outside")|float %}
{% set inside_max = temp_inside + states("input_number.climate_temp_accuracy")|float %}
{% set accuracy = states("input_number.climate_temp_accuracy") |float %}
{% if temp_inside >= target and temp_inside >= (temp_outside - accuracy) %}
{{ "open the window" }}
{% else %}
{{ "close the window" }}
{% endif %}
## -----------------------------------------------------------------------------------------------##
## difference to target
## -----------------------------------------------------------------------------------------------##
- platform: template
sensors:
climate_temp_difference:
friendly_name: difference to target
value_template: >
{% if states("sensor.temperature_kai_temperature") == "unknown" %}
{{ 0 | float }}
{% else %}
{{ (states("sensor.temperature_kai_temperature") | float - (states.sensor.climate_temp.state | float) ) | round(2) }}
{% endif %}
unit_of_measurement: '°C'
- platform: template
sensors:
climate_temp_difference_inside_outside:
friendly_name: difference inside to outside
value_template: >
{% if states("sensor.temperature_kai_temperature") == "unknown" %}
{{ 0 | float }}
{% else %}
{{ (states("sensor.temperature_outside")|float - states("sensor.temperature_kai_temperature")|float) | round(2) }}
{% endif %}
unit_of_measurement: '°C'
## -----------------------------------------------------------------------------------------------##
## Schrittgröße, mit der die Heizung verstellt werden soll, abhängig vom Unterschied zur realen
## Temperatur
## Variable Schrittgröße, bei positiv (zu warm) größer, bei negativ (zu kalt) geringer
## -----------------------------------------------------------------------------------------------##
# - platform: template
# sensors:
# climate_temp_steps:
# friendly_name: increment
# value_template: >
# {% set difference = (states("sensor.climate_temp_difference" ) | float) %}
# {% set zero = ("0.0" | float ) %}
# {% if difference > zero %}
# {% if difference >= ("2.00"|float) %} {% set steps = ( "3.00" | float ) %}
# {% elif difference >= ("1.50"|float) %} {% set steps = ( "1.50" | float ) %}
# {% elif difference >= ("1.00"|float) %} {% set steps = ( "1.00" | float ) %}
# {% elif difference >= ("0.50"|float) %} {% set steps = ( "0.50" | float ) %}
# {% elif difference >= ("0.00"|float) %} {% set steps = ( "0.00" | float ) %}
# {% endif %}
# {% else %}
# {% if difference <= ("-2.00"|float) %} {% set steps = ( "3.00" | float ) %}
# {% elif difference <= ("-1.50"|float) %} {% set steps = ( "1.50" | float ) %}
# {% elif difference <= ("-1.00"|float) %} {% set steps = ( "0.50" | float ) %}
# {% elif difference <= ("-0.50"|float) %} {% set steps = ( "0.50" | float ) %}
# {% elif difference <= ("-0.00"|float) %} {% set steps = ( "0.00" | float ) %}
# {% endif %}
# {% endif %}
# {{ steps }}
## -----------------------------------------------------------------------------------------------##
## Berechnung der Temperatur, auf die die Heizung gestellt werden soll, um Zieltemperatur zu
## erreichen. Berücksichtigung für Genauigkeit, variable Temperaturanpassung und Temperatur-
## anpassung aufgrund von Offset. Berechnung ob Anpassung Positiv oder Negativ
## -----------------------------------------------------------------------------------------------##
# - platform: template
# sensors:
# climate_temp_set:
# friendly_name: '-> climate'
# value_template: >
# {% set difference = (states("sensor.climate_temp_difference" ) | float) %}
# {% set change = (states("sensor.climate_temp_change" ) | float) %}
# {% set goal = (states("sensor.climate_temp" ) | float) %}
# {% set temp = (states("sensor.aqara_temperature_kai_temperature") | float ) %}
# {% set climate = (state_attr("climate.kai", "temperature") | float ) %}
# {% if climate < ("15.0" | float ) %} {% set climate = ("15.0" | float) %} {% endif %}
# {% set max = states("sensor.climate_temp") | float %}
# {% set min = states("sensor.climate_temp") | float - (states.input_number.climate_temp_accuracy.state | float) %}
# {% set zero = ("0.0" | float ) %}
# {% set difference_max = ("1.5" | float ) %}
# {% set difference_min = ("-2.0" | float ) %}
# {% set change_max = ("1.0" | float ) %}
# {% set offset = (states("input_number.climate_temp_offset") | float ) %}
# {% set climate_goal = (goal | float + ("2.0" | float) | float - offset) | float %}
# {% set steps = (states("sensor.climate_temp_steps") | float) %}
# {% if difference == zero %} {% set result = climate %}
# {% elif (difference > difference_max) %} {% set result = ("15.0"|float) %}
# {% elif (difference < difference_min) %} {% set result = goal - offset %}
# {% elif difference > zero %}
# {% if (climate_goal <= climate) or (change >= change_max) %} {% set result = goal - offset %}
# {% elif temp > max %} {% set result = (climate | float - steps) | float %}
# {% else %} {% set result = climate %} {% endif %}
# {% elif difference < zero %}
# {% if temp < min %}
# {% set result = (climate | float + steps) | float %}
# {% else %}
# {% if change >= change_max %}
# {% set result = goal - offset %}
# {% else %}
# {% set result = climate %}
# {% endif %}
# {% endif %}
# {% endif %}
# {% if result < ("15.0"|float) %} {{ ("15.0"|float) }}
# {% elif result > ("29.5"|float) %} {{ ("29.5"|float) }}
# {% else %} {{ result }}
# {% endif %}
# unit_of_measurement: '°C'

581
packages/climate/eq3.yaml.disabled Normal file → Executable file
View File

@ -5,583 +5,4 @@ climate:
- platform: eq3btsmart
devices:
kai:
mac: '00:1A:22:0E:FB:32'
## -------------------------------------------------------------------------------------------------##
## Scripts: um einzelne Temperaturen zu setzen da Variable Fehler ausgibt (BUG)
## Ugly but working....
## -------------------------------------------------------------------------------------------------##
script:
climate_set_15_0:
sequence:
- service: climate.turn_off
entity_id: climate.kai
climate_set_15_5:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "15.50"
hvac_mode: "heat"
climate_set_16_0:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "16.00"
hvac_mode: "heat"
climate_set_16_5:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "16.50"
hvac_mode: "heat"
climate_set_17_0:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "17.00"
hvac_mode: "heat"
climate_set_17_5:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "17.50"
hvac_mode: "heat"
climate_set_18_0:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "18.00"
hvac_mode: "heat"
climate_set_18_5:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "18.50"
hvac_mode: "heat"
climate_set_19_0:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "19.00"
hvac_mode: "heat"
climate_set_19_5:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "19.50"
hvac_mode: "heat"
climate_set_20_0:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "20.00"
hvac_mode: "heat"
climate_set_20_5:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "20.00"
hvac_mode: "heat"
climate_set_21_0:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "21.00"
hvac_mode: "heat"
climate_set_21_5:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "21.50"
hvac_mode: "heat"
climate_set_22_0:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "22.00"
hvac_mode: "heat"
climate_set_22_5:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "22.50"
hvac_mode: "heat"
climate_set_23_0:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "23.00"
hvac_mode: "heat"
climate_set_23_5:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "23.50"
hvac_mode: "heat"
climate_set_24_0:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "24.00"
hvac_mode: "heat"
climate_set_24_5:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "24.50"
hvac_mode: "heat"
climate_set_25_0:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "25.00"
hvac_mode: "heat"
climate_set_25_5:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "25.50"
hvac_mode: "heat"
climate_set_26_0:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "26.00"
hvac_mode: "heat"
climate_set_26_5:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "26.50"
hvac_mode: "heat"
climate_set_27_0:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "27.00"
hvac_mode: "heat"
climate_set_27_5:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "27.50"
hvac_mode: "heat"
climate_set_28_0:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "28.00"
hvac_mode: "heat"
climate_set_28_5:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "28.50"
hvac_mode: "heat"
climate_set_29_0:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "29.00"
hvac_mode: "heat"
climate_set_29_5:
sequence:
- service: climate.set_temperature
entity_id: climate.kai
data:
temperature: "29.50"
hvac_mode: "heat"
climate_set_off:
sequence:
- service: climate.turn_off
entity_id: climate.kai
climate_set:
alias: Setze Temperatur
sequence:
- service: script.turn_on
data_template:
entity_id: >
{% set temp_set = ( states("sensor.climate_temp_set") | float ) %}
{% if states("input_boolean.climate_power") == "off" %} script.climate_set_off
{% elif temp_set == ( "00.00" | float ) %} script.climate_set_20_5
{% elif temp_set <= ( "15.00" | float ) %} script.climate_set_15_0
{% elif temp_set == ( "15.50" | float ) %} script.climate_set_15_5
{% elif temp_set == ( "16.00" | float ) %} script.climate_set_16_0
{% elif temp_set == ( "16.50" | float ) %} script.climate_set_16_5
{% elif temp_set == ( "17.00" | float ) %} script.climate_set_17_0
{% elif temp_set == ( "17.50" | float ) %} script.climate_set_17_5
{% elif temp_set == ( "18.00" | float ) %} script.climate_set_18_0
{% elif temp_set == ( "18.50" | float ) %} script.climate_set_18_5
{% elif temp_set == ( "19.00" | float ) %} script.climate_set_19_0
{% elif temp_set == ( "19.50" | float ) %} script.climate_set_19_5
{% elif temp_set == ( "20.00" | float ) %} script.climate_set_20_0
{% elif temp_set == ( "20.50" | float ) %} script.climate_set_20_5
{% elif temp_set == ( "21.00" | float ) %} script.climate_set_21_0
{% elif temp_set == ( "21.50" | float ) %} script.climate_set_21_5
{% elif temp_set == ( "22.00" | float ) %} script.climate_set_22_0
{% elif temp_set == ( "22.50" | float ) %} script.climate_set_22_5
{% elif temp_set == ( "23.00" | float ) %} script.climate_set_23_0
{% elif temp_set == ( "23.50" | float ) %} script.climate_set_23_5
{% elif temp_set == ( "24.00" | float ) %} script.climate_set_24_0
{% elif temp_set == ( "24.50" | float ) %} script.climate_set_24_5
{% elif temp_set == ( "25.00" | float ) %} script.climate_set_25_0
{% elif temp_set == ( "25.50" | float ) %} script.climate_set_25_5
{% elif temp_set == ( "26.00" | float ) %} script.climate_set_26_0
{% elif temp_set == ( "26.50" | float ) %} script.climate_set_26_5
{% elif temp_set == ( "27.00" | float ) %} script.climate_set_27_0
{% elif temp_set == ( "27.50" | float ) %} script.climate_set_27_5
{% elif temp_set == ( "28.00" | float ) %} script.climate_set_28_0
{% elif temp_set == ( "28.50" | float ) %} script.climate_set_28_5
{% elif temp_set == ( "29.00" | float ) %} script.climate_set_29_0
{% elif temp_set >= ( "29.50" | float ) %} script.climate_set_29_5
{% else %} script.climate_set_20_5 {% endif %}
## -------------------------------------------------------------------------------------------------##
## Inputs
## -------------------------------------------------------------------------------------------------##
input_number:
climate_temp:
name: Ziel Manuell
#initial: 21.5
min: 15
max: 29
step: 0.5
climate_temp_morning:
name: Ziel Morgen
#initial: 20.5
min: 15
max: 29
step: 0.5
climate_temp_night:
name: Ziel Nacht
#initial: 17.0
min: 15
max: 29
step: 0.5
climate_temp_accuracy:
name: Genauigkeit
#initial: 1
min: 0
max: 5
step: 0.5
climate_temp_offset:
name: Offset Heizung->Temp
#initial: 1
min: -2
max: 2
step: 0.5
climate_temp_last:
name: Letzte Temp
min: 0
max: 29
step: 0.01
mode: box
input_datetime:
climate_morning:
name: "Morgen"
has_time: true
has_date: false
#initial: "10:00"
climate_morning_weekend:
name: "Morgen Sa"
has_time: true
has_date: false
#initial: "15:30"
climate_night:
name: "Nacht"
has_time: true
has_date: false
#initial: "23:59"
input_boolean:
climate_auto:
name: 'Automatisch'
icon: mdi:power
#initial: off
climate_power:
name: 'Power'
icon: mdi:power
#initial: off
climate_weekday:
name: 'Wochentag'
#initial: on
climate_away:
name: 'Away'
#initial: off
## -------------------------------------------------------------------------------------------------##
## Sensoren
## -------------------------------------------------------------------------------------------------##
sensor:
## -----------------------------------------------------------------------------------------------##
## Berechnung der Temperaturveränderung
## -----------------------------------------------------------------------------------------------##
- platform: template
sensors:
climate_temp_change:
friendly_name: Veränderung
value_template: >
{% set now = states("sensor.aqara_temperature_kai_temperature")|float %}
{% set last = states("input_number.climate_temp_last")|float %}
{% set change = (now | float - last) | float %}
{% if now == ("0.0"|float) %} {% set change = ("0.0"|float) %} {% endif %}
{{ change | round(2) }}
## -----------------------------------------------------------------------------------------------##
## Berechnung der aktuellen Zieltemperatur bzgl Morgen/Nacht, Automatik/Manuell
## -----------------------------------------------------------------------------------------------##
- platform: template
sensors:
climate_temp:
friendly_name: akt. Ziel
unit_of_measurement: '°C'
value_template: >
{% set auto = states("input_boolean.climate_auto") %}
{% set manual_temp = states("input_number.climate_temp") %}
{% if auto == "off" %} {{ manual_temp }}
{% else %}
{% set time = states("sensor.time") %}
{% set morning = states("sensor.climate_morning") %}
{% set weekday = states("input_boolean.climate_weekday") %}
{% if weekday == "on" %} {% set morning = states("input_datetime.climate_morning") %}
{% else %} {% set morning = states("input_datetime.climate_morning_weekend") %} {% endif %}
{% set night = states("input_datetime.climate_night") %}
{% set morning_temp = states("input_number.climate_temp_morning")|float %}
{% set night_temp = states("input_number.climate_temp_night")|float %}
{% if night > morning %}
{% if time > morning and time <= night %} {{ morning_temp|float }}
{% else %} {{ night_temp|float }} {% endif %}
{% else %}
{% if time <= morning and time > night %} {{ morning_temp|float }}
{% else %} {{ night_temp|float }} {% endif %}
{% endif %}
{% endif %}
## -----------------------------------------------------------------------------------------------##
## Berechnung von Unterschied zwischen Heizungstemperatur und realer Temperatur
## -----------------------------------------------------------------------------------------------##
- platform: template
sensors:
climate_temp_difference:
friendly_name: 'akt. Unterschied'
value_template: >
{% if states("sensor.aqara_temperature_kai_temperature") == "unknown" %}
{{ 0 | float }}
{% else %}
{{ ( states("sensor.aqara_temperature_kai_temperature") | float - (states.sensor.climate_temp.state | float) ) | round(2) }}
{% endif %}
unit_of_measurement: '°C'
## -----------------------------------------------------------------------------------------------##
## Schrittgröße, mit der die Heizung verstellt werden soll, abhängig vom Unterschied zur realen
## Temperatur
## Variable Schrittgröße, bei positiv (zu warm) größer, bei negativ (zu kalt) geringer
## -----------------------------------------------------------------------------------------------##
- platform: template
sensors:
climate_temp_steps:
friendly_name: 'Schrittgröße'
value_template: >
{% set difference = (states("sensor.climate_temp_difference" ) | float) %}
{% set zero = ("0.0" | float ) %}
{% if difference > zero %}
{% if difference >= ("2.00"|float) %} {% set steps = ( "3.00" | float ) %}
{% elif difference >= ("1.50"|float) %} {% set steps = ( "1.50" | float ) %}
{% elif difference >= ("1.00"|float) %} {% set steps = ( "1.00" | float ) %}
{% elif difference >= ("0.50"|float) %} {% set steps = ( "0.50" | float ) %}
{% elif difference >= ("0.00"|float) %} {% set steps = ( "0.00" | float ) %}
{% endif %}
{% else %}
{% if difference <= ("-2.00"|float) %} {% set steps = ( "3.00" | float ) %}
{% elif difference <= ("-1.50"|float) %} {% set steps = ( "1.50" | float ) %}
{% elif difference <= ("-1.00"|float) %} {% set steps = ( "0.50" | float ) %}
{% elif difference <= ("-0.50"|float) %} {% set steps = ( "0.50" | float ) %}
{% elif difference <= ("-0.00"|float) %} {% set steps = ( "0.00" | float ) %}
{% endif %}
{% endif %}
{{ steps }}
## -----------------------------------------------------------------------------------------------##
## Berechnung der Temperatur, auf die die Heizung gestellt werden soll, um Zieltemperatur zu
## erreichen. Berücksichtigung für Genauigkeit, variable Temperaturanpassung und Temperatur-
## anpassung aufgrund von Offset. Berechnung ob Anpassung Positiv oder Negativ
## -----------------------------------------------------------------------------------------------##
- platform: template
sensors:
climate_temp_set:
friendly_name: '-> Heizung'
value_template: >
{% set difference = (states("sensor.climate_temp_difference" ) | float) %}
{% set change = (states("sensor.climate_temp_change" ) | float) %}
{% set goal = (states("sensor.climate_temp" ) | float) %}
{% set temp = (states("sensor.aqara_temperature_kai_temperature") | float ) %}
{% set climate = (state_attr("climate.kai", "temperature") | float ) %}
{% if climate < ("15.0" | float ) %} {% set climate = ("15.0" | float) %} {% endif %}
{% set max = states("sensor.climate_temp") | float %}
{% set min = states("sensor.climate_temp") | float - (states.input_number.climate_temp_accuracy.state | float) %}
{% set zero = ("0.0" | float ) %}
{% set difference_max = ("1.5" | float ) %}
{% set difference_min = ("-2.0" | float ) %}
{% set change_max = ("1.0" | float ) %}
{% set offset = (states("input_number.climate_temp_offset") | float ) %}
{% set climate_goal = (goal | float + ("2.0" | float) | float - offset) | float %}
{% set steps = (states("sensor.climate_temp_steps") | float) %}
{% if difference == zero %} {% set result = climate %}
{% elif (difference > difference_max) %} {% set result = ("15.0"|float) %}
{% elif (difference < difference_min) %} {% set result = goal - offset %}
{% elif difference > zero %}
{% if (climate_goal <= climate) or (change >= change_max) %} {% set result = goal - offset %}
{% elif temp > max %} {% set result = (climate | float - steps) | float %}
{% else %} {% set result = climate %} {% endif %}
{% elif difference < zero %}
{% if temp < min %}
{% set result = (climate | float + steps) | float %}
{% else %}
{% if change >= change_max %}
{% set result = goal - offset %}
{% else %}
{% set result = climate %}
{% endif %}
{% endif %}
{% endif %}
{% if result < ("15.0"|float) %} {{ ("15.0"|float) }}
{% elif result > ("29.5"|float) %} {{ ("29.5"|float) }}
{% else %} {{ result }}
{% endif %}
unit_of_measurement: '°C'
## -----------------------------------------------------------------------------------------------##
## Time / Date
## -----------------------------------------------------------------------------------------------##
- platform: time_date
display_options:
- 'time'
- 'date'
automation:
## -----------------------------------------------------------------------------------------------##
## Trigger alle 15min um Abfrage und Temperaturanpassung durchzuführen
## -----------------------------------------------------------------------------------------------##
- alias: climate_set_auto
initial_state: on
trigger:
- platform: time_pattern
minutes: '/5'
- platform: state
entity_id: sensor.climate_temp
condition:
- condition: template
value_template: '{{ states.climate.kai.state != "unavailable" }}'
action:
- service: script.turn_on
entity_id: script.climate_set
- delay: '00:20'
- service: script.turn_on
entity_id: script.climate_set
- service: input_number.set_value
data_template:
entity_id: input_number.climate_temp_last
value: '{{ states("sensor.aqara_temperature_kai_temperature")|float }}'
- alias: climate_set_manual
initial_state: on
trigger:
- platform: state
entity_id: input_number.climate_temp
condition:
- condition: template
value_template: '{{ states.climate.kai.state != "unavailable" }}'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.climate_auto
- service: script.turn_on
entity_id: script.climate_set
- delay: '00:20'
- service: script.turn_on
entity_id: script.climate_set
- alias: climate_set_power_off
initial_state: on
trigger:
- platform: state
entity_id: input_boolean.climate_power
to: "off"
action:
- service: climate.turn_off
entity_id: climate.kai
- delay: '00:20'
- service: climate.turn_off
entity_id: climate.kai
- alias: climate_set_power_on
initial_state: on
trigger:
- platform: state
entity_id: input_boolean.climate_power
to: "on"
action:
- service: climate.turn_on
entity_id: climate.kai
- delay: '00:20'
- service: climate.turn_on
entity_id: climate.kai
## -----------------------------------------------------------------------------------------------##
## Trigger alle 5min, wenn Wochentag -> aktiviere Weekday-Boolean
## -----------------------------------------------------------------------------------------------##
- alias: climate_weekday
initial_state: on
trigger:
platform: time_pattern
minutes: '/5'
condition:
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
- sun
action:
service: input_boolean.turn_on
entity_id: input_boolean.climate_weekday
## -----------------------------------------------------------------------------------------------##
## Trigger alle 5min, wenn Wochenende -> deaktiviere Weekday-Boolean
## -----------------------------------------------------------------------------------------------##
- alias: climate_weekend
initial_state: on
trigger:
platform: time_pattern
minutes: '/5'
condition:
- condition: time
weekday:
- sat
action:
service: input_boolean.turn_off
entity_id: input_boolean.climate_weekday
mac: '00:1A:22:0E:FB:32'

26
packages/climate/weather.yaml Executable file
View File

@ -0,0 +1,26 @@
## -------------------------------------------------------------------------------------------------##
## pirateweather
## -------------------------------------------------------------------------------------------------##
## -------------------------------------------------------------------------------------------------##
## Wetter-Plattform
## -------------------------------------------------------------------------------------------------##
sensor:
- platform: template
sensors:
temperature_outside:
value_template: '{{ states.weather.openweathermap.attributes.temperature }}'
friendly_name: 'Outside Temperature'
unit_of_measurement: '°C'
temperature_today:
value_template: >
{{ state_attr('weather.home', 'forecast')[0].temperature }}
friendly_name: 'Max Temperature'
unit_of_measurement: '°C'
temperature_today_condition:
value_template: >
{{ state_attr('weather.home', 'forecast')[0].condition }}
friendly_name: 'Condition'
sun:

View File

@ -1,22 +0,0 @@
## -------------------------------------------------------------------------------------------------##
## DarkSky
## -------------------------------------------------------------------------------------------------##
## -------------------------------------------------------------------------------------------------##
## Wetter-Plattform
## -------------------------------------------------------------------------------------------------##
weather:
- platform: darksky
api_key: !secret darksky
mode: daily
sun:
sensor:
- platform: template
sensors:
temperature_outside_darksky:
value_template: '{{ states.weather.dark_sky.attributes.temperature }}'
friendly_name: 'Outside Temperature'

1
packages/homeassistant/default_theme.yaml Normal file → Executable file
View File

@ -5,7 +5,6 @@ automation:
trigger:
- event: start
platform: homeassistant
condition: []
action:
- data:
name: minimalist-desktop

37
packages/homeassistant/homeassistant.yaml Normal file → Executable file
View File

@ -8,6 +8,41 @@ homeassistant:
time_zone: Europe/Berlin
allowlist_external_dirs:
- '/tmp'
auth_providers:
- type: trusted_networks
trusted_networks:
- 10.10.10.0/24
default_config:
lovelace:
mode: yaml
resources: !include ../../resources.yaml
http:
use_x_forwarded_for: true
trusted_proxies:
- 127.0.0.1
- ::1
- 10.10.10.0/24
- 172.30.32.0/24
- 172.30.33.0/24
#default_config:
automation:
counter:
dhcp:
energy:
frontend:
history:
map:
mobile_app:
person:
ssdp:
system_health:
timer:
usb:
webhook:
zeroconf:
zone:

View File

@ -0,0 +1,46 @@
homekit:
ip_address: 10.10.10.1
advertise_ip: 10.10.10.1
filter:
include_entities:
- sensor.temperature_kai_humidity
- sensor.temperature_kai_temperature
- light.all_indirect
- light.all_direct
- script.light_store_off
- script.light_store_restore
- scene.light_flux
- scene.light_night
- switch.adaptive_lighting_sleep_mode_default
- switch.adaptive_lighting_default
- switch.server
- switch.server_template
- scene.light_adaptive
entity_config:
sensor.temperature_kai_humidity:
name: Feuchtigkeit
sensor.temperature_kai_temperature:
name: Temperatur
light.all_indirect:
name: Indirekt
light.all_direct:
name: Direkt
script.light_store_off:
name: Licht aus
script.light_store_restore:
name: Licht an
scene.light_adaptive:
name: Licht Adaptiv
scene.light_night:
name: Licht Nacht
switch.adaptive_lighting_default:
name: Adaptiv
switch.adaptive_lighting_sleep_mode_default:
name: Schlaf
switch.server:
name: Server
switch.server_template:
name: Server Status

View File

@ -0,0 +1,12 @@
logbook:
exclude:
entities:
- automation.light_all_snapshot
- automation.climate_weekend
- automation.climate_weekday
entity_globs:
- sensor.pfsense_*
- binary_sensor.pfsense_*
- script.climate_set_*
- sensor.home_*
- sensor.openweathermap_*

View File

@ -1,27 +0,0 @@
lovelace:
mode: yaml
resources:
- url: /hacsfiles/button-card/button-card.js
type: module
- url: /hacsfiles/light-entity-card/light-entity-card.js
type: module
- url: /hacsfiles/lovelace-auto-entities/auto-entities.js
type: module
- url: /hacsfiles/lovelace-card-mod/card-mod.js
type: module
- url: /hacsfiles/mini-graph-card/mini-graph-card-bundle.js
type: module
- url: /hacsfiles/mini-media-player/mini-media-player-bundle.js
type: module
- url: /hacsfiles/my-cards/my-slider.js
type: module
- url: /hacsfiles/simple-weather-card/simple-weather-card-bundle.js
type: module
- url: /hacsfiles/home-assistant-sun-card/home-assistant-sun-card.js
type: module
- url: /hacsfiles/lovelace-layout-card/layout-card.js
type: module
- url: /hacsfiles/lovelace-state-switch/state-switch.js
type: module

View File

@ -0,0 +1,15 @@
script:
summary_notification:
sequence:
- service: notify.notify
data:
message: >
{% set maxTemp = states("sensor.temperature_today") %}
{% set condition = states("sensor.temperature_today_condition") %}
{% set currentTemp = states("sensor.temperature_outside") %}
{% set recommendation = states("sensor.climate_temp_recommendation") %}
{% set insideTemp = states("sensor.temperature_kai_temperature") %}
At the moment it is {{ condition }} outside with a temperature of {{ currentTemp }}°C.
Todays max temperature will be {{ maxTemp }}°C.
It is {{ insideTemp }}°C inside and recommended to {{ recommendation }}.
mode: single

0
packages/homeassistant/recorder.yaml Normal file → Executable file
View File

View File

@ -0,0 +1,8 @@
## -----------------------------------------------------------------------------------------------##
## Time / Date
## -----------------------------------------------------------------------------------------------##
sensor:
- platform: time_date
display_options:
- 'time'
- 'date'

View File

@ -1,62 +0,0 @@
homekit:
ip_address: 10.10.10.50
filter:
include_entities:
- sensor.temperature_kai_humidity
- sensor.temperature_kai_pressure
- sensor.temperature_kai_temperature
- sensor.temperature_outside_darksky
- sensor.schreibtisch_current_consumption
- sensor.schreibtisch_today_s_consumption
- sensor.schreibtisch_total_consumption
- light.all_indirect
- light.all_direct
- light.all_lights
- scene.light_alloff
- scene.light_blue
- scene.light_flux
- scene.light_night
- switch.circadian_lighting_circadian_lighting
- binary_sensor.mullvad_exit_ip
- switch.server
- switch.server_template
entity_config:
sensor.temperature_kai_humidity:
name: Humidity
sensor.temperature_kai_pressure:
name: Pressure
sensor.temperature_kai_temperature:
name: Temperature
sensor.temperature_outside_darksky:
name: Outside
sensor.schreibtisch_current_consumption:
name: Consumption
sensor.schreibtisch_today_s_consumption:
name: Consumption Today
sensor.schreibtisch_total_consumption:
name: Consumption Total
light.all_indirect:
name: Indirect
light.all_direct:
name: Direct
light.all_lights:
name: All Lights
scene.light_alloff:
name: Lights Off
scene.light_blue:
name: Lights Blue
scene.light_flux:
name: Lights Flux
scene.light_night:
name: Lights Night
switch.circadian_lighting_circadian_lighting:
name: Circadian
binary_sensor.mullvad_exit_ip:
name: Mullvad
switch.server:
name: Server
switch.server_template:
name: Server Status

View File

@ -1,16 +0,0 @@
## -------------------------------------------------------------------------------------------------##
## Circadian Lighting / Flux
## -------------------------------------------------------------------------------------------------##
circadian_lighting:
min_colortemp: 2700
max_colortemp: 6500
interval: 450
transition: 8
switch:
- platform: circadian_lighting
lights_ct:
- light.stripe
- light.direct
max_brightness: 80

View File

@ -0,0 +1,18 @@
adaptive_lighting:
- name: "default"
lights:
- light.stripe
- light.direct
prefer_rgb_color: false
transition: 45
initial_transition: 1
interval: 90
min_brightness: 1
max_brightness: 80
min_color_temp: 2500
max_color_temp: 6500
sleep_brightness: 1
sleep_color_temp: 1000
take_over_control: true
detect_non_ha_changes: false
only_once: false

View File

@ -0,0 +1,31 @@
input_boolean:
lights_needed:
name: Lights needed
initial: false
automation:
- alias: lights_needed
mode: single
trigger:
- platform: time_pattern
minutes: "10"
action:
- if:
# Resets at midnight -> OR instead of AND
- condition: or
conditions:
- condition: sun
after: sunset
after_offset: "-01:00"
- condition: sun
before: sunrise
before_offset: "+01:00"
then:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.lights_needed
else:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.lights_needed

View File

@ -0,0 +1,66 @@
automation:
- alias: light_still_on_still_needed_notify
mode: single
trigger:
- platform: state
entity_id:
- light.all_lights
to: "on"
for:
hours: 0
minutes: 15
seconds: 0
condition:
- condition: state
entity_id: input_boolean.lights_needed
state: "off"
for:
hours: 0
minutes: 15
seconds: 0
action:
- service: notify.mobile_app_iphone
data:
message: "Lights are still on."
data:
actions:
- action: "LIGHTTURNOFF"
title: Turn them off
icon: "sfsymbols:lightbulb"
- alias: light_still_on_iphone_offline_notify
mode: single
trigger:
- platform: state
entity_id:
- device_tracker.pfsense_kais_iphone_wnsrt_de
to: not_home
for:
hours: 0
minutes: 2
seconds: 0
condition:
- condition: state
entity_id: light.all_lights
state: "on"
action:
- service: notify.mobile_app_iphone
data:
message: "Lights are still on."
data:
actions:
- action: "LIGHTTURNOFF"
title: Turn them off
icon: "sfsymbols:lightbulb"
- alias: light_still_on_notification_event
trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: "LIGHTTURNOFF"
action:
- service: light.turn_off
target:
entity_id: light.all_lights

View File

@ -0,0 +1,34 @@
scene:
- name: light_adaptive
entities:
light.all_direct: false
light.all_indirect: true
switch.adaptive_lighting_default: on
switch.adaptive_lighting_sleep_mode_default: off
- name: light_blue
entities:
switch.adaptive_lighting_default: off
switch.adaptive_lighting_sleep_mode_default: off
light.all_direct: false
light.all_indirect:
rgb_color: [0, 0, 255]
state: true
brightness: 20
- name: light_night
entities:
switch.adaptive_lighting_default: on
light.all_direct: false
light.all_indirect:
rgb_color: [255, 139, 21]
state: true
brightness: 1
switch.adaptive_lighting_sleep_mode_default: on
- name: light_bright
entities:
switch.adaptive_lighting_default: off
light.all_direct: false
light.all_lights:
color_temp: 238
state: true
brightness: 255
switch.adaptive_lighting_sleep_mode_default: off

View File

@ -0,0 +1,20 @@
automation:
- alias: light_all_snapshot
mode: single
trigger:
- platform: time_pattern
seconds: "30"
condition:
- condition: state
entity_id: light.all_lights
state: "on"
action:
- service: scene.create
data:
scene_id: snapshot_all
snapshot_entities:
- light.all_indirect
- light.bed_ceiling
- light.ceiling
- switch.adaptive_lighting_sleep_mode_default
- switch.adaptive_lighting_default

View File

@ -1,25 +0,0 @@
scene:
- name: light_alloff
entities:
light.all_lights: false
- name: light_flux
entities:
light.all_direct: false
light.all_indirect: true
switch.circadian_lighting_circadian_lighting: on
- name: light_blue
entities:
switch.circadian_lighting_circadian_lighting: off
light.all_direct: false
light.all_indirect:
rgb_color: [0, 0, 255]
state: true
brightness: 20
- name: light_night
entities:
switch.circadian_lighting_circadian_lighting: off
light.all_direct: false
light.all_indirect:
rgb_color: [255, 139, 21]
state: true
brightness: 1

View File

@ -1,28 +0,0 @@
## -------------------------------------------------------------------------------------------------##
## Light_Store
## https://github.com/pnbruckner/homeassistant-config/blob/master/python_scripts/light_store.py
## -------------------------------------------------------------------------------------------------##
script:
light_store_save:
sequence:
- service: python_script.light_store
data:
store_name: flash_store
entity_id:
- light.bed
- light.closet
- light.desk
- light.direct
- light.tv
light_store_off:
sequence:
- service: script.light_store_save
- service: light.turn_off
entity_id: light.all_lights
light_store_restore:
sequence:
- service: python_script.light_store
data:
store_name: flash_store
operation: restore

25
packages/light/yeelight.yaml Normal file → Executable file
View File

@ -1,8 +1,3 @@
## -------------------------------------------------------------------------------------------------##
## Yeelight
## -------------------------------------------------------------------------------------------------##
## -------------------------------------------------------------------------------------------------##
## Discovery disable
## -------------------------------------------------------------------------------------------------##
@ -12,40 +7,40 @@ discovery:
## -------------------------------------------------------------------------------------------------##
## Lampen-Konfig
## Lights
## -------------------------------------------------------------------------------------------------##
yeelight:
devices:
10.10.10.82:
name: ceiling1
save_on_change: False
transition: 2500
transition: 500
10.10.10.83:
name: ceiling2
save_on_change: False
transition: 2500
transition: 500
10.10.10.80:
name: ceiling3
save_on_change: False
transition: 2500
transition: 500
10.10.10.81:
name: bed_ceiling
save_on_change: False
transition: 2500
transition: 500
10.10.10.84:
name: bed
save_on_change: False
transition: 2500
transition: 500
model: strip1
10.10.10.85:
name: desk
save_on_change: False
transition: 2500
transition: 500
model: strip1
## -------------------------------------------------------------------------------------------------##
## Lampengruppen
## Light Groups
## -------------------------------------------------------------------------------------------------##
light:
- platform: group
@ -78,6 +73,4 @@ light:
name: all_lights
entities:
- light.all_direct
- light.all_indirect
- light.all_indirect

10
packages/minimalist/custom_entities.yaml Normal file → Executable file
View File

@ -1,11 +1,3 @@
input_boolean:
welcome_collapse:
name: welcome_collapse
input_select:
minimalist_ui_switch:
name: Select popup/view
options:
- light.all_indirect
- light.all_direct
name: welcome_collapse

2
packages/nas/wol.yaml Normal file → Executable file
View File

@ -3,13 +3,11 @@
## -------------------------------------------------------------------------------------------------##
wake_on_lan:
switch:
- platform: wake_on_lan
mac: 54:04:A6:BF:1E:43
name: Server
host: ip.wnsrt.de
#switch:
- platform: template
switches:
server_template:

View File

@ -0,0 +1,29 @@
automation:
- alias: "pfSense WAN Down"
trigger:
- platform: state
entity_id: sensor.pfsense_gateway_wan_gw_status
to: 'False'
action:
- service: notify.notify
data:
message: "WAN Gateway went offline"
- alias: "pfSense Mullvad Down"
trigger:
- platform: state
entity_id: sensor.pfsense_gateway_mullvad1gw_status
to: 'False'
- platform: state
entity_id: sensor.pfsense_gateway_mullvad1gwv6_status
to: 'False'
- platform: state
entity_id: sensor.pfsense_gateway_mullvad2gw_status
to: 'False'
- platform: state
entity_id: sensor.pfsense_gateway_mullvad2gwv6_status
to: 'False'
action:
- service: notify.notify
data:
message: "A Mullvad connection went offline"