Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Creating Daikin AC remote in HA using broadlink pro IR Remote ##
- # Basic idea is to use input_selects to choose the settings (mode/temp/fan speed) you want.
- # Learn the broadlink IR codes for every AC setting you want available and save them as scripts with formulaic names.
- # A template sensor uses the input_select settings to show the correct script.
- # Turning on an input_boolean, triggers an automation.
- # The automation action turns on the correct script, causeing the correct IR Code to be sent.
- input_boolean:
- aircon_change_settings:
- initial: off
- name: Change Aircon Settings
- input_select:
- aircon_mode:
- name: Aircon Mode
- options:
- - "Cool"
- - "Fan"
- - "Heat"
- icon: mdi:air-conditioner
- aircon_speed:
- name: Fan Speed
- options:
- - "0"
- - "1"
- - "2"
- - "3"
- - "4"
- - "5"
- icon: mdi:fan
- aircon_temp_cool: # Adjust to the temps you want available
- name: Cool Temp
- options:
- - "21"
- - "22"
- - "23"
- - "24"
- - "25"
- - "26"
- icon: mdi:snowflake
- aircon_temp_heat: # Adjust to the temps you want available
- name: Heat Temp
- options:
- - "14"
- - "15"
- - "16"
- - "17"
- - "18"
- icon: mdi:white-balance-sunny
- script:
- ## One script for each aircon setting, all following the format "aircon_m[mode]_t[temp]_s[speed] (fan excludes temp section). Need to learn IR Code for every setting you want to be able to set. Learn all codes from off position. i.e us AC remote to set temp/speed/mode, turn AC off, then learn the code from pressing the on button. Ensures that AC will turn on if off and that the code learned is for the exact settings you want. Also, learn the AC off code.
- aircon_off:
- sequence:
- - service: broadlink.send
- data:
- host: 192.168.1.4
- packet:
- - 'IR CODE'
- - delay: "00:00:01"
- aircon_mfan_s1:
- sequence:
- - service: broadlink.send
- data:
- host: 192.168.1.4
- packet:
- - 'IR CODE'
- - delay: "00:00:01"
- aircon_mfan_s2:
- sequence:
- - service: broadlink.send
- data:
- host: 192.168.1.4
- packet:
- - 'IR CODE'
- - delay: "00:00:01"
- aircon_mcool_t21_s4:
- sequence:
- - service: broadlink.send
- data:
- host: 192.168.1.4
- packet:
- - 'IR CODE'
- - delay: "00:00:01"
- aircon_mheat_t18_s2:
- sequence:
- - service: broadlink.send
- data:
- host: 192.168.1.4
- packet:
- - 'IR CODE'
- - delay: "00:00:01"
- sensor:
- aircon_settings:
- friendly_name: Aircon Settings
- entity_id:
- - input_select.aircon_mode
- - input_select.aircon_temp_heat
- - input_select.aircon_temp_cool
- - input_select.aircon_speed
- value_template: >
- {% set mode = states('input_select.aircon_mode') | lower%}
- {% set tempHeat = states('input_select.aircon_temp_heat') %}
- {% set tempCold = states('input_select.aircon_temp_cool') %}
- {% set speed = states('input_select.aircon_speed') %}
- {% if mode == 'fan' %}
- script.aircon_m{{mode}}_s{{speed}}
- {% elif mode == 'heat' %}
- script.aircon_m{{mode}}_t{{tempHeat}}_s{{speed}}
- {% else %}
- script.aircon_m{{mode}}_t{{tempCold}}_s{{speed}}
- {% endif %}
- automation:
- - alias: Change Aircon Setting
- trigger:
- - platform: state
- entity_id: input_boolean.aircon_change_settings
- to: 'on'
- action:
- - service: script.turn_on
- data_template:
- entity_id: "{{states.sensor.aircon_settings.state}}"
- - service: input_boolean.turn_off
- entity_id: input_boolean.aircon_change_settings
- switch:
- aircon:
- friendly_name: Air Conditioner Switch
- value_template: "{{ is_state('sensor.aircon', 'on') }}"
- turn_on:
- - service: input_boolean.turn_on
- entity_id: input_boolean.aircon_change_settings
- turn_off:
- - service: script.aircon_off
- icon_template: >
- {% set mode = states.input_select.aircon_mode.state %}
- {% if mode == 'Fan' %}
- mdi:weather-windy
- {% elif mode == 'Cool' %}
- mdi:snowflake
- {% elif mode == 'Heat' %}
- mdi:white-balance-sunny
- {% else %}
- mdi:fan-off
- {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement