Skip to content

Home Assistant

Morten Mathiasen edited this page May 16, 2021 · 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:

Home Assistant installation comes with or without Docker containers. With Docker the installation is called Hassio, otherwise Home Assistant Core. The Home Assistant Core version is configured by following this guide. The Hassio version is configured by following this guide.

To use PIIR in your Home assistant installation you need to configure the user interface and automation. From Home assistant you add climate control using PIIR by 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

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_mode', 'quiet') else 'POWERFUL' if is_state_attr('climate.HVAC', 'fan_mode', 'powerful') else 'AUTO' }} --feature fan={{ 'VERYFAST' if is_state_attr('climate.HVAC', 'fan_mode', 'powerful') else 'VERYSLOW' if is_state_attr('climate.HVAC', 'fan_mode', 'quiet') else 'VERYFAST' if is_state_attr('climate.HVAC', 'fan_mode', 'very fast') else 'FAST' if is_state_attr('climate.HVAC', 'fan_mode', 'fast') else 'MEDIUM' if is_state_attr('climate.HVAC', 'fan_mode', 'medium') else 'SLOW' if is_state_attr('climate.HVAC', 'fan_mode', 'slow') else 'VERYSLOW' if is_state_attr('climate.HVAC', 'fan_mode', '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