Skip to content

Home Assistant

Morten Mathiasen edited this page Sep 28, 2020 · 29 revisions

Home assistant

Home assistant is an open source home control system running on more platforms, e.g. Raspberry PI. It provides nice looking web and mobile app frontends to remote control IR enabled devices using PIIR. To use PIIR from within Home assistant you need to configure user interface and automation inside the configuration of Home assistant.

For climate control you can add a MQTT enabled Climate card:

climate:
  - platform: mqtt
    name: "HVAC"
    min_temp: 8
    max_temp: 30
    modes:
      - auto
      - heat
      - cool
      - fan_only
      - "off"
    swing_modes:
      - auto
      - horisontal
      - vertical
      - off
    fan_modes:
      - auto
      - powerful
      - quiet
      - very high
      - high
      - medium
      - low
      - very low
    power_command_topic: "hvac/power/set"
    mode_command_topic: "hvac/mode/set"
    temperature_command_topic: "hvac/temperature/set"
    fan_mode_command_topic: "hvac/fan/set"
    swing_mode_command_topic: "hvac/swing/set"
    precision: 1.0

Such a configuration will generate a card like this within Home assistant user interface:

When the user card state changes then PIIR will be called from Home assistant by an automation trigger which is configured like this:

automation:
  - alias: run_set_ac
    trigger:
      platform: state
      entity_id: climate.HVAC
    action:
      service: shell_command.send_ac_state

shell_command:
  send_ac_state: "sudo piir --remote hvac_panasonic --feature temperature={{ state_attr('climate.HVAC', 'temperature') }} --feature mode={{ 'HEAT' if is_state('climate.HVAC','heat') else 'COOL' if is_state('climate.HVAC', 'cool') else 'FAN' if is_state('climate.HVAC', 'fan_only') else 'AUTO' if is_state('climate.HVAC', 'auto') else 'OFF' }} --feature option={{ 'QUIET' if is_state_attr('climate.HVAC', 'fan_modes', 'quiet') else 'POWERFUL' if is_state_attr('climate.HVAC', 'fan_modes', 'powerful') else 'AUTO' }} --feature fan={{ 'AUTO' 'POWERFUL' if is_state_attr('climate.HVAC', 'fan_modes', 'powerful') else 'QUIET' if is_state_attr('climate.HVAC', 'fan_modes', 'quiet') else 'VERYFAST' if is_state_attr('climate.HVAC', 'fan_modes', 'very fast') else 'FAST' if is_state_attr('climate.HVAC', 'fan_modes', 'fast') else 'MEDIUM' if is_state_attr('climate.HVAC', 'fan_modes', 'medium') else 'SLOW' if is_state_attr('climate.HVAC', 'fan_modes', 'slow') else 'VERYSLOW' if is_state_attr('climate.HVAC', 'fan_modes', 'very slow') else 'AUTO' }} --feature updown={{ 'AUTO' if is_state_attr('climate.HVAC', 'swing_modes', 'auto') else 'AUTO' if is_state_attr('climate.HVAC', 'swing_modes', 'vertical') else 'HIGH' }} --feature leftright={{ 'AUTO' if is_state_attr('climate.HVAC', 'swing_modes', 'auto') else 'AUTO' if is_state_attr('climate.HVAC', 'swing_modes', 'horisontial') else 'MIDDLE' }}"

Now your climate device is remote controlled by PIIR when users alter climate state within the web and mobile app frontends of Home assistant.

Clone this wiki locally