Skip to content

IR Air climatiser Home Assistant integration

Florian edited this page Jul 28, 2018 · 1 revision
  1. Simply record all the button codes send by the remote as raw signals; here IRRemote has an issue as for AC signals are much longer than for regular IR sent by TV/VCR as it includes the full state of the device (target temperature, mode, fan, swing, etc); you actually told me what line to modify in IRRemote as it was recording only about 400 char (I think that it was IRRecv.h line #define RAWBUF 100U // Length of raw duration buffer but I don't I recall exactly :) ); when you release the pre-compiled versions of OpenMQTT you can modify the respective IRRecv.h line to have the full signal recorded.

The buttons on my remote are On/Off; Sleep; Fan; Swing; Mode; Temp. As a result, there are 153 different signals sent by the remote.

  1. Create a script with the payload for each button press (153 scripts :) ). The name of the script is important as it includes the button pressed.
livinghvacoff:
  alias: off
  sequence:
    - service: mqtt.publish
      data:
        topic: "home/GatewayOpenMQTT7/commands/IR_Raw"
        payload: "3106,1704,526,..."
livinghvaconnoautofalsecool16:
  alias: onnoautoFALSEcool16
  sequence:
    - service: mqtt.publish
      data:
        topic: "home/GatewayOpenMQTT7/commands/IR_Raw"
        payload: "3052,1702,528,..."
  1. Set component MQTT HVAC; the topics where the component posts the commands are being used in step 4 to be concatenated and matched against scripts names:
- platform: mqtt
  name: HVAC Living
  modes:
    - dry
    - cool
    - fan
  swing_modes:
    - yes
    - no
  fan_modes:
    - auto
    - high
    - medium
    - low
  hold:
    - yes
    - no
  power_command_topic: "hvac/living/power/set"
  mode_command_topic: "hvac/living/mode/set"
  temperature_command_topic: "hvac/living/temperature/set"
  fan_mode_command_topic: "hvac/living/fan/set"
  swing_mode_command_topic: "hvac/living/swing/set"
  hold_command_topic: "hvac/living/swing/set"
  current_temperature_topic: "hvac/living/state/temperature"
  payload_on: "on"
  payload_off: "off"
  retain: true
  initial: 22
  1. Sensors; the first 6 sensors are intermediary and are based on the topics sent by the HVAC component for each of the remote buttons; the next 6 are used for dealing with the error messages after a reboot (5% core code, 95% error handling :) ).
- platform: mqtt  
  state_topic: "hvac/living/power/set"
  name: 'HVACi living power'  
- platform: mqtt  
  state_topic: "hvac/living/mode/set"
  name: 'HVACi living mode'  
- platform: mqtt  
  state_topic: "hvac/living/temperature/set"
  name: 'HVACi living temperature'  
- platform: mqtt  
  state_topic: "hvac/living/fan/set"
  name: 'HVACi living fan'
- platform: mqtt  
  state_topic: "hvac/living/swing/set"
  name: 'HVACi living swing'
- platform: mqtt  
  state_topic: "hvac/living/sleep/set"
  name: 'HVACi living sleep'
- platform: template
  sensors:
    hvac_living_power:
      friendly_name: HVAC living power
      value_template: >
        {% if is_state('sensor.hvaci_living_power', 'unknown') %}
          off
        {% else %}
          {{ states.sensor.hvaci_living_power.state }}
        {% endif %}
- platform: template
  sensors:
    hvac_living_mode:
      friendly_name: HVAC living mode
      value_template: >
        {% if is_state('sensor.hvaci_living_mode', 'unknown') %}
          cool
        {% else %}
          {{ states.sensor.hvaci_living_mode.state }}
        {% endif %}
- platform: template
  sensors:
    hvac_living_temperature:
      friendly_name: HVAC living temperature
      value_template: >
        {% if is_state('sensor.hvaci_living_temperature', 'unknown') %}
          22
        {% else %}
          {{ states.sensor.hvaci_living_temperature.state }}
        {% endif %}
- platform: template
  sensors:
    hvac_living_fan:
      friendly_name: HVAC living fan
      value_template: >
        {% if is_state('sensor.hvaci_living_fan', 'unknown') %}
          auto
        {% else %}
          {{ states.sensor.hvaci_living_fan.state }}
        {% endif %}
- platform: template
  sensors:
    hvac_living_swing:
      friendly_name: HVAC living swing
      value_template: >
        {% if is_state('sensor.hvaci_living_swing', 'unknown') %}
          false
        {% else %}
          {{ states.sensor.hvaci_living_swing.state }}
        {% endif %}
- platform: template
  sensors:
    hvac_living_sleep:
      friendly_name: HVAC living sleep
      value_template: >
        {% if is_state('sensor.hvaci_living_sleep', 'unknown') %}
          no
        {% else %}
          {{ states.sensor.hvaci_living_sleep.state }}
        {% endif %}
  1. Automations; each command sent by the HVAC component modifies the sensors values and executes the script with the name resulted from the concatenation of the sensors names.
- alias: 'HVAC living operation'
  initial_state: 'on'
  trigger:
    - platform: state
      entity_id:
        - sensor.hvac_living_mode
        - sensor.hvac_living_temperature
        - sensor.hvac_living_fan
        - sensor.hvac_living_swing
  action:
    - service: homeassistant.turn_on
      data_template:
        entity_id: script.livinghvac{{states.sensor.hvac_living_power.state|replace("ON","on")|replace("OFF","off")}}{{states.sensor.hvac_living_sleep.state}}{{states.sensor.hvac_living_fan.state}}{{states.sensor.hvac_living_swing.state|replace("False","false")|replace("True","true")}}{{states.sensor.hvac_living_mode.state}}{{states.sensor.hvac_living_temperature.state|replace(".0","")}}
- alias: 'HVAC living off'
  initial_state: 'on'
  trigger:
    - platform: state
      entity_id: sensor.hvac_living_power
      to: "off"
  action:
    - service: homeassistant.turn_on
      entity_id: script.livinghvacoff
- alias: 'HVAC living sleep mode off'
  initial_state: 'on'
  trigger:
    - platform: sun
      event: sunrise
      offset: "+02:00:00"
  action:
    - service: mqtt.publish
      data:
        topic: 'hvac/living/sleep/set'
        payload: "no"
- alias: 'HVAC living sleep mode on'
  initial_state: 'on'
  trigger:
    - platform: sun
      event: sunset
      offset: "+02:00:00"
  action:
    - service: mqtt.publish
      data:
        topic: 'hvac/living/sleep/set'
        payload: "yes"
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.