Files
sarah/config/packages/devices/living_room/toshiba_ac.yaml
T
2022-11-19 17:40:31 +02:00

212 lines
6.8 KiB
YAML

input_boolean:
ac_heating:
name: AC Heating enabled
icon: mdi:air-conditioner
# https://github.com/hristo-atanasov/Tasmota-IRHVAC/
climate:
- platform: tasmota_irhvac
name: "TOSHIBA AC"
command_topic: "cmnd/ir_blaster_1/irhvac"
state_topic: "tele/ir_blaster_1/RESULT"
temperature_sensor: sensor.multisensor_6_temperature
protocol: "TOSHIBA_AC"
max_temp: 30 # optional - default 32 int value
min_temp: 17
target_temp: 22 # optional - default 26 int value
away_temp: 18 # optional - default 24 int value
supported_modes:
- "heat"
- "cool"
- "dry"
- "auto"
- "off"
supported_fan_speeds:
- "min"
- "low"
- "medium"
- "high"
- "max"
- "auto"
supported_swing_list:
- "off"
input_number:
toshiba_heat_temp:
name: AC heat temp
unit_of_measurement: "ºC"
min: 24
max: 30
step: 1
icon: mdi:air-conditioner
toshiba_cool_temp:
name: AC cool temp
unit_of_measurement: "ºC"
min: 17
max: 25
step: 1
icon: mdi:air-conditioner
toshiba_trigger_temp:
name: AC cooling trigger temp
unit_of_measurement: "ºC"
min: 18
max: 28
step: 1
icon: mdi:air-conditioner
template:
- binary_sensor:
- name: Toshiba AC Climate conditions met
state: >
{% set temp_matching = states('sensor.multisensor_6_temperature')|float >= states('input_number.toshiba_trigger_temp')|float %}
{% set outside_temp_high = states('sensor.dark_sky_apparent_temperature')|float + 2 >= states('input_number.toshiba_trigger_temp')|float %}
{% set someone_home = is_state('binary_sensor.someone_home', 'on') %}
{% set ac_off = is_state('climate.toshiba_ac', 'off') %}
{{ temp_matching and outside_temp_high and someone_home and ac_off }}
- name: Toshiba AC conditions met
icon: >
{{ is_state('binary_sensor.toshiba_ac_conditions_met', 'on') | iif('mdi:home-thermometer', 'mdi:home-thermometer-outline') }}
state: >
{% set temp_matching = states('sensor.multisensor_6_temperature')|float >= states('input_number.toshiba_trigger_temp')|float %}
{% set outside_temp_high = states('sensor.dark_sky_apparent_temperature')|float + 2 >= states('input_number.toshiba_trigger_temp')|float %}
{% set someone_home = is_state('binary_sensor.someone_home', 'on') %}
{% set bedroom_ready = is_state('group.bedroom_windows', 'off') or is_state('binary_sensor.bedroom_door', 'off') %}
{% set kitchen_ready = is_state('binary_sensor.kitchen_window', 'off') or is_state('binary_sensor.kitchen_door', 'off') %}
{% set ac_off = is_state('climate.toshiba_ac', 'off') %}
{{ temp_matching and outside_temp_high and someone_home and bedroom_ready and kitchen_ready and ac_off }}
script:
toshiba_ac_toggle:
sequence:
- service: >-
{% if is_state('climate.toshiba_ac', 'off') and is_state('input_boolean.ac_heating', 'off') %}
script.toshiba_ac_on_cool
{% elif is_state('climate.toshiba_ac', 'off') and is_state('input_boolean.ac_heating', 'on') %}
script.toshiba_ac_on_heat
{% else %}
climate.turn_off
{% endif %}
data_template:
entity_id: "{% if not is_state('climate.toshiba_ac', 'off') %}climate.toshiba_ac{%endif%}"
toshiba_ac_on_cool:
sequence:
- service: climate.turn_on
entity_id: climate.toshiba_ac
- delay: "00:00:01"
- service: climate.set_hvac_mode
entity_id: climate.toshiba_ac
data:
hvac_mode: "cool"
- delay: "00:00:01"
- service: climate.set_fan_mode
entity_id: climate.toshiba_ac
data:
fan_mode: "auto"
- delay: "00:00:01"
- service: climate.set_temperature
entity_id: climate.toshiba_ac
data_template:
temperature: "{{ states('input_number.toshiba_cool_temp') | default(19) }}"
- service: logbook.log
data:
name: "💨 Climate Module · "
message: "AC · Switching on · Cool"
domain: climate
toshiba_ac_on_heat:
sequence:
- service: climate.turn_on
entity_id: climate.toshiba_ac
- delay: "00:00:01"
- service: climate.set_hvac_mode
entity_id: climate.toshiba_ac
data:
hvac_mode: "heat"
- delay: "00:00:01"
- service: climate.set_fan_mode
entity_id: climate.toshiba_ac
data:
fan_mode: "auto"
- delay: "00:00:01"
- service: climate.set_temperature
entity_id: climate.toshiba_ac
data_template:
temperature: "{{ states('input_number.toshiba_heat_temp') | default(26) }}"
- service: logbook.log
data:
name: "💨 Climate Module · "
message: "AC · Switching on · Heat"
domain: climate
toshiba_ac_on_cool_if_hot:
sequence:
- condition: state
entity_id: binary_sensor.toshiba_ac_conditions_met
state: 'on'
- service: script.toshiba_ac_on_cool
automation:
- alias: Climate · AC · Turn on if hot
trigger:
- platform: template
value_template: "{{ states('sensor.multisensor_6_temperature')|float|default(0) > states('input_number.toshiba_trigger_temp')|float }}"
for: "00:05:00"
- platform: state
entity_id:
- binary_sensor.living_room_right_window
- group.bedroom_windows
- binary_sensor.kitchen_window
- binary_sensor.kitchen_door
from: "on"
to: "off"
action:
- service: script.toshiba_ac_on_cool_if_hot
- alias: Climate · AC · Turn off
trigger:
- platform: time
at: "05:00:00"
# TODO: this below trigger works only for summer :)
- platform: numeric_state
entity_id: sensor.multisensor_6_temperature
below: 23
- platform: state
entity_id:
- binary_sensor.living_room_right_window
- group.bedroom_windows
from: "off"
to: "on"
for: "00:01:00"
condition:
condition: not
conditions:
- condition: state
entity_id: climate.toshiba_ac
state: 'off'
action:
- service: climate.turn_off
entity_id: climate.toshiba_ac
- service: logbook.log
data:
name: "💨 Climate Module · "
message: "AC · Switching off"
domain: climate
- alias: Climate · AC · Notify conditions met
trigger:
platform: state
entity_id: binary_sensor.toshiba_ac_climate_conditions_met
from: 'off'
to: 'on'
action:
- service: notify.telegram
data:
title: "💨 Climate Module · AC · Conditions met"
message: "I would turn the AC on, but some windows or doors are open."