Fujitsu Air Conditioning integration - Airstage dongle

Should work standard I think it’s just a Conditional Card with a Button Card
So you could do it manually


Repeat for the off button
State is equal to on
script turn off airco

Anyways got round to do some of @ravenland set operations added to my setup

The following rest command together with an input_select helper and an automation on change of state of select to trigger it works pretty well. Original post updated.

  airco_bedroom_setmode:
    url: http://aircoip/SetParam
    method: POST
    payload: >
      {% set aircomodes = {"Auto": 0, "Cooling": 1,"Dry": 2,"Fan": 3,"Heating": 4} %}
      {% set opmode = aircomodes[states('input_select.setaircoopmodebedroom')]  %}
      {"device_id":"aircomac","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_op_mode":"{{ opmode }}"}}

I found it!
In your sample configuration.yaml entry I found out that I also have to change {“device_id”:“106838461B49” to {“device_id”:“aircomac”.
And I guess in Automation we should change - id: ‘1689096049994’ to - id: ‘aircomac’ as well.
Thank you for all yr help!
My next steps are making the cards to be able to shut them down and turn them on and in addition set the temp. I still didn’t succeed in getting your card into my HA, But am working on that.
A question: Why not making the automation which reads the airco’s parameters in a tim schedule like every minute orso?

automation id is not aircomac is a automatic generated id when you create an automation via UI. So you can ignore that.
Reading the airco parameters are already done in a time schedule of 1 minute that is the scan interval.

sensor:
  - platform: rest
    scan_interval: 60
1 Like

When trying to create the manual card in this post I get an error (see below).
I have tried adjusting the indentation etc but to no avail.
Can someone give me the code they used?

Configuration errors detected:
bad indentation of a mapping entry (2:15)

1 | - type: conditional
2 | conditions:
-------------------^
3 | - entity: binary_sensor.airco_bedroom_on
4 | state: ‘on’

- type: conditional
    conditions:
      - entity: binary_sensor.airco_bedroom_on
        state: 'on'
    card:
      show_name: true
      show_icon: true
      type: button
      tap_action:
        action: call-service
        service: script.turn_off_airco_bedroom
        target: {}
      hold_action:
        action: none
      icon: mdi:air-conditioner
      show_state: false
      entity: binary_sensor.airco_bedroom_on
      name: Airco
  - type: conditional
    conditions:
      - entity: binary_sensor.airco_bedroom_on
        state: 'off'
    card:
      show_name: true
      show_icon: true
      type: button
      tap_action:
        action: call-service
        service: script.turn_on_airco_bedroom
        target: {}
      hold_action:
        action: none
      icon: mdi:air-conditioner
      name: Airco
      show_state: false
      entity: binary_sensor.airco_bedroom_on

Can I make a suggestion to your post/solution?

The first of the two automations at the end of the script does not work (as it has wrong indentations and the ID included)

Can I suggest the following (I have also tidied up the naming) as two separate items of code:

alias: Airco bedroom temp Update
description: ""
trigger:
  - platform: state
    entity_id:
      - input_number.setaircotempbedroom
condition: []
action:
  - service: rest_command.airco_bedroom_set_temp
    data: {}
  - service: homeassistant.update_entity
    data: {}
    target:
      entity_id: sensor.requested_temp_airco_bedroom
mode: single
alias: Airco bedroom mode change
description: ""
trigger:
  - platform: state
    entity_id:
      - input_select.setaircoopmodebedroom
condition: []
action:
  - service: rest_command.airco_bedroom_setmode
    data: {}
  - service: homeassistant.update_entity
    data: {}
    target:
      entity_id: sensor.requested_temp_airco_bedroom
mode: single

1 Like

Cheers to all your good work!
I recently bought Fuijitsu aircons and I’m very excited to see this work turn into an integration in HA (to make it easier for me to use it :smiley: )

Updated the post with your suggestion and also recopied my on off button card solution…

I think I may have a simpler way of setting up Airstage integration which is just editing configuration.yaml minimally and adding another yaml file (with some search&replace for IP, mac address and device name)

Let me know if this works for others and if it is simpler than the previous instructions - if so I will link from the first post.

# See the HA Community thread https://community.home-assistant.io/t/fujitsu-air-conditioning-integration-airstage-dongle/589679
# Integration for Fujitsu wi-fi adpaters that use Airstage app (n.b. will NOT work with the older/withdrawn FGLair app)
#
# 1) Install 'Climate IP' via the HACS integration manager https://github.com/jcwillox/hass-template-climate
# 2) Using 'Studio Code Server' from the HA add-ons store is useful
# 3) Use seach&replace funcitonality is useful!
# 4) Save this file as e.g. 'upstairs_aircon.yaml'. 
# 5) Place this file in the same folder as your configuration.yaml
# 6) Search & replace all '192.168.1.188' with the IP address of your aircon (assign a static IP to this device)
# 7) Search & replace all 'E8FB1CFF5FF5' with the MAC address of your aircon (do not put any : in the address)
# 8) Search & replace all instances of 'upstairs' with what you want to name the new aircon device (n.b. needs to be in lower case except where indicated)
# 9) Have a look through at # out sections to see if you want to enable
# 10) Add the following lines to your configuration.yaml (ensure it refers to the correct filename & you remove the #'s')
###############
#homeassistant:
#  packages:
#    pack_1: !include upstairs_aircon.yaml 
###############
#
# **swing mode is not tested as my device does not have that function** (please report back in the thread if it works)
#
# Thanks to all the people in the aforemetnioned thread including @pietervanh @ravenland

rest_command:
  upstairs_aircon_setmode:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: >
      {% set aircomodes = {"auto": 0, "cool": 1,"dry": 2,"fan_only": 3,"heat": 4} %}
      {% set opmode = aircomodes.get(hvac_mode, 0) %}
      {"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_op_mode":"{{ opmode }}"}} 
  upstairs_aircon_settemp:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: >
      {% set setroomtemp = (target_temp | float   * 10) | int %}
      {"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_set_tmp":"{{ setroomtemp }}"}}
  upstairs_aircon_set_fan_speed:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: >
      {% set fanspds = {"auto": 0, "Quiet": 2,"low": 5,"medium": 8,"high": 11} %}
      {% set spd = fanspds.get(fan_mode, 0) %}
      {"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_fan_spd":"{{ spd }}"}}

# enable if your device has a swing mode
#  upstairs_aircon_set_swing_mode:
#    url: http://192.168.1.188/SetParam
#    method: POST
#    payload: >
#      {% set mode = {"off": 0, "on": 1} %}
#      {% set swing = mode.get(swing_mode, 0) %}
#      {"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_fan_spd":"{{ swing }}"}}
    
# not all units especially ducted have powerful mode. Powerful runs for a short period then stops
  upstairs_aircon_pwrfull_on:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: '{"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_powerfull":"1"}}'
  upstairs_aircon_pwrfull_off:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: '{"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_powerfull":"0"}}'

# these aren't used by the template but included for completion
  upstairs_aircon_on:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: '{"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_onoff":"1"}}'
  upstairs_aircon_off:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: '{"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_onoff":"0"}}'
  upstairs_aircon_eco_on:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: '{"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_economy":"1"}}'
  upstairs_aircon_eco_off:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: '{"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_economy":"0"}}'
  upstairs_aircon_fanctrl_on:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: '{"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_fan_ctrl":"1"}}'
  upstairs_aircon_fanctrl_off:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: '{"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_fan_ctrl":"0"}}'

rest:
  - resource: http://192.168.1.188/GetParam
    scan_interval: 60
    payload: '{"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"03","list":["iu_set_tmp","iu_indoor_tmp","iu_outdoor_tmp","iu_onoff","iu_economy","iu_fan_ctrl","iu_fan_ctrl","iu_powerful","ou_low_noise","iu_op_mode","iu_fan_spd","iu_af_swg_vrt"]}'
    sensor:
      - name: "Temp Outside upstairs Aircon"
        value_template: "{{ (((value_json['value']['iu_outdoor_tmp'] | float  / 100 ) - 32 ) * 5/9) | round(2) }}"
        unit_of_measurement: "°C"
      - name: "Temp Inside upstairs Aircon"
        value_template: "{{ (((value_json['value']['iu_indoor_tmp'] | float  / 100 ) - 32 ) * 5/9) | round(2) }}"
        unit_of_measurement: "°C"
      - name: "Requested Temp upstairs Aircon"
        value_template: "{{ (value_json['value']['iu_set_tmp'] | float / 10 )| round(2) }}"
        unit_of_measurement: "°C"
      - name: "Mode upstairs Aircon"
        value_template: >
          {% set mapper ={'0': 'auto','1': 'cool','2': 'dry','3': 'fan_only','4': 'heat'} %}
          {% set state =  value_json['value']['iu_op_mode'] %}
          {{ mapper[state] if state in mapper else 'Unknown' }}
      - name: "Fan Speed Upstairs Aircon"
        value_template: >
          {% set mapper ={'0': 'auto','2': 'Quiet','5': 'low','8': 'medium','11': 'high'} %}
          {% set state =  value_json['value']['iu_fan_spd'] %}
          {{ mapper[state] if state in mapper else 'Unknown' }}

# enable if your device has a swing mode
#      - name: "Swing Mode Upstairs Aircon"
#        value_template: >
#          {% set mapper ={'0': 'off','1': 'on'} %}
#          {% set state =  value_json['value']['iu_af_swg_vrt'] %}
#          {{ mapper[state] if state in mapper else 'Unknown' }}



climate:
  - platform: climate_template
# the name: can have capital letters if desired
    name: Upstairs Aircon
    modes: 
      - "auto"
      - "dry"
      - "off"
      - "cool"
      - "fan_only"
      - "heat"
    fan_modes:
      - "auto"
      - "Quiet"
      - "low"
      - "medium"
      - "high"

# enable if your device has a swing mode
#    swing_modes:
#      - "on"
#      - "off"

    min_temp: 15
    max_temp: 30

    current_temperature_template: "{{ states('sensor.temp_inside_upstairs_aircon') }}"

    hvac_mode_template: "{{ states('sensor.mode_upstairs_aircon') }}"
    
    target_temperature_template: "{{ states('sensor.requested_temp_upstairs_aircon') }}"
    
    fan_mode_template: "{{ states('sensor.fan_speed_upstairs_aircon') }}"

# enable if your device has a swing mode
#    swing_mode_template: "{{ states('sensor.swing_mode_upstairs_aircon') }}"

    set_hvac_mode:
      - service: rest_command.upstairs_aircon_setmode
        data:
          hvac_mode: "{{ hvac_mode }}"
      - delay: 2
      - service: homeassistant.update_entity
        entity_id: sensor.mode_upstairs_aircon

    set_temperature:
      - service: rest_command.upstairs_aircon_settemp
        data:
          target_temp: "{{ temperature }}"
      - delay: 2
      - service: homeassistant.update_entity
        entity_id: sensor.requested_temp_upstairs_aircon

    set_fan_mode:
      - service: rest_command.upstairs_aircon_set_fan_speed
        data:
          fan_mode: "{{ fan_mode }}"
      - delay: 2
      - service: homeassistant.update_entity
        entity_id: sensor.fan_speed_upstairs_aircon

# enable if your device has a swing mode
#    set_swing_mode:
#      - service: rest_command.upstairs_aircon_set_swing_mode
#        data:
#          swing_mode: "{{ swing_mode }}"
#      - delay: 2
#      - service: homeassistant.update_entity
#        entity_id: sensor.swing_mode_upstairs_aircon
1 Like

Ooh this looks promising and great idea to do a seperate yaml for each unit as was getting into a right search and replace mess by keeping multiple units in one config file.

Thank you for the work. Power on and off does not work for me.

I have just tested on/off and it is working here.

You have to go to:
Developer tools → services → “RESTful Command: upstairs_aircon_off” or “RESTful Command: upstairs_aircon_on”

You are correct that using the ‘off’ mode selection drop down does not work.

I need to somehow do an ‘if’ statement in the template of the payload for the hvac_modes if ‘off’ is selected (as that is a completely different command). Suggestions welcome!

rest_command:
  upstairs_aircon_setmode:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: >
      {% set aircomodes = {"auto": 0, "cool": 1,"dry": 2,"fan_only": 3,"heat": 4} %}
      {% set opmode = aircomodes.get(hvac_mode, 0) %}
      {"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_op_mode":"{{ opmode }}"}}

Correct, ‘off’ mode does not turn it off. The other modes like “cool” do not turn it on. They only work if the AC is already on. Ideally, pressing the modes like “cool” should turn the device on when it is currently off. :slight_smile:

Try this for size.

It should fix the being able to turn off via the mode dropdown, and if set to off and you select a mode it should turn on.

Sadly, it doesn’t show the off state in the UI yet (I need to fix the hvac_mode_template to first detect if it is off, and only if it is not off to detect the mode…)

Let me know if this works for you

# See the HA Community thread https://community.home-assistant.io/t/fujitsu-air-conditioning-integration-airstage-dongle/589679
# Integration for Fujitsu wi-fi adpaters that use Airstage app (n.b. will NOT work with the older/withdrawn FGLair app)
#
# 1) Install 'Climate IP' via the HACS integration manager https://github.com/jcwillox/hass-template-climate
# 2) Using 'Studio Code Server' from the HA add-ons store is useful
# 3) Use seach&replace funcitonality is useful!
# 4) Save this file as e.g. 'upstairs_aircon.yaml'. 
# 5) Place this file in the same folder as your configuration.yaml
# 6) Search & replace all '192.168.1.188' with the IP address of your aircon (assign a static IP to this device)
# 7) Search & replace all 'E8FB1CFF5FF5' with the MAC address of your aircon (do not put any : in the address)
# 8) Search & replace all instances of 'upstairs' with what you want to name the new aircon device (n.b. needs to be in lower case except where indicated)
# 9) Have a look through at # out sections to see if you want to enable
# 10) Add the following lines to your configuration.yaml (ensure it refers to the correct filename & you remove the #'s')
###############
#homeassistant:
#  packages:
#    pack_1: !include upstairs_aircon.yaml 
###############
#
# **swing mode is not tested as my device does not have that function** (please report back in the thread if it works)
# 
# Thanks to all the people in the aforemetnioned thread including @pietervanh @ravenland

rest_command:
  upstairs_aircon_setmode:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: >
      {% set aircomodes = {"auto": '"iu_op_mode":"0"',"cool": '"iu_op_mode":"1"',"dry": '"iu_op_mode":"2"',"fan_only": '"iu_op_mode":"3"',"heat": '"iu_op_mode":"4"',"off": '"iu_onoff":"0"'} %}
      {% set opmode = aircomodes.get(hvac_mode, 0) %}
      {"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{ {{opmode}} }} 
  upstairs_aircon_settemp:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: >
      {% set setroomtemp = (target_temp | float   * 10) | int %}
      {"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_set_tmp":"{{ setroomtemp }}"}}
  upstairs_aircon_set_fan_speed:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: >
      {% set fanspds = {"auto": 0, "Quiet": 2,"low": 5,"medium": 8,"high": 11} %}
      {% set spd = fanspds.get(fan_mode, 0) %}
      {"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_fan_spd":"{{ spd }}"}}

# enable if your device has a swing mode
#  upstairs_aircon_set_swing_mode:
#    url: http://192.168.1.188/SetParam
#    method: POST
#    payload: >
#      {% set mode = {"off": 0, "on": 1} %}
#      {% set swing = mode.get(swing_mode, 0) %}
#      {"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_fan_spd":"{{ swing }}"}}
    
# not all units especially ducted have powerful mode. Powerful runs for a short period then stops
  upstairs_aircon_pwrfull_on:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: '{"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_powerfull":"1"}}'
  upstairs_aircon_pwrfull_off:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: '{"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_powerfull":"0"}}'

# these aren't used by the template but included for completion
  upstairs_aircon_on:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: '{"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_onoff":"1"}}'
  upstairs_aircon_off:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: '{"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_onoff":"0"}}'
  upstairs_aircon_eco_on:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: '{"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_economy":"1"}}'
  upstairs_aircon_eco_off:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: '{"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_economy":"0"}}'
  upstairs_aircon_fanctrl_on:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: '{"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_fan_ctrl":"1"}}'
  upstairs_aircon_fanctrl_off:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: '{"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_fan_ctrl":"0"}}'

rest:
  - resource: http://192.168.1.188/GetParam
    scan_interval: 60
    payload: '{"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"03","list":["iu_set_tmp","iu_indoor_tmp","iu_outdoor_tmp","iu_onoff","iu_economy","iu_fan_ctrl","iu_fan_ctrl","iu_powerful","ou_low_noise","iu_op_mode","iu_fan_spd","iu_af_swg_vrt"]}'
    sensor:
      - name: "Temp Outside upstairs Aircon"
        value_template: "{{ (((value_json['value']['iu_outdoor_tmp'] | float  / 100 ) - 32 ) * 5/9) | round(2) }}"
        unit_of_measurement: "°C"
      - name: "Temp Inside upstairs Aircon"
        value_template: "{{ (((value_json['value']['iu_indoor_tmp'] | float  / 100 ) - 32 ) * 5/9) | round(2) }}"
        unit_of_measurement: "°C"
      - name: "Requested Temp upstairs Aircon"
        value_template: "{{ (value_json['value']['iu_set_tmp'] | float / 10 )| round(2) }}"
        unit_of_measurement: "°C"
      - name: "Mode upstairs Aircon"
        value_template: >
          {% set mapper ={'0': 'auto','1': 'cool','2': 'dry','3': 'fan_only','4': 'heat'} %}
          {% set state =  value_json['value']['iu_op_mode'] %}
          {{ mapper[state] if state in mapper else 'Unknown' }}
      - name: "Fan Speed Upstairs Aircon"
        value_template: >
          {% set mapper ={'0': 'auto','2': 'Quiet','5': 'low','8': 'medium','11': 'high'} %}
          {% set state =  value_json['value']['iu_fan_spd'] %}
          {{ mapper[state] if state in mapper else 'Unknown' }}

# enable if your device has a swing mode
#      - name: "Swing Mode Upstairs Aircon"
#        value_template: >
#          {% set mapper ={'0': 'off','1': 'on'} %}
#          {% set state =  value_json['value']['iu_af_swg_vrt'] %}
#          {{ mapper[state] if state in mapper else 'Unknown' }}



climate:
  - platform: climate_template
# the name: can have capital letters if desired
    name: Upstairs Aircon
    modes: 
      - "auto"
      - "dry"
      - "off"
      - "cool"
      - "fan_only"
      - "heat"
    fan_modes:
      - "auto"
      - "Quiet"
      - "low"
      - "medium"
      - "high"

# enable if your device has a swing mode
#    swing_modes:
#      - "on"
#      - "off"

    min_temp: 15
    max_temp: 30

    current_temperature_template: "{{ states('sensor.temp_inside_upstairs_aircon') }}"

    hvac_mode_template: "{{ states('sensor.mode_upstairs_aircon') }}"
    
    target_temperature_template: "{{ states('sensor.requested_temp_upstairs_aircon') }}"
    
    fan_mode_template: "{{ states('sensor.fan_speed_upstairs_aircon') }}"

# enable if your device has a swing mode
#    swing_mode_template: "{{ states('sensor.swing_mode_upstairs_aircon') }}"

    set_hvac_mode:
      - service: rest_command.upstairs_aircon_on
      - delay: 1
      - service: rest_command.upstairs_aircon_setmode
        data:
          hvac_mode: "{{ hvac_mode }}"
      - delay: 2
      - service: homeassistant.update_entity
        entity_id: sensor.mode_upstairs_aircon

    set_temperature:
      - service: rest_command.upstairs_aircon_settemp
        data:
          target_temp: "{{ temperature }}"
      - delay: 2
      - service: homeassistant.update_entity
        entity_id: sensor.requested_temp_upstairs_aircon

    set_fan_mode:
      - service: rest_command.upstairs_aircon_set_fan_speed
        data:
          fan_mode: "{{ fan_mode }}"
      - delay: 2
      - service: homeassistant.update_entity
        entity_id: sensor.fan_speed_upstairs_aircon

# enable if your device has a swing mode
#    set_swing_mode:
#      - service: rest_command.upstairs_aircon_set_swing_mode
#        data:
#          swing_mode: "{{ swing_mode }}"
#      - delay: 2
#      - service: homeassistant.update_entity
#        entity_id: sensor.swing_mode_upstairs_aircon
1 Like

Turn off via mode and turn on by selecting a mode works now! Show the off state in the UI would be nice. :slight_smile:

I think I have cracked it. Not bad for someone with little/no coding knowledge!

Changes (in case you don’t want to re-do the whole file)

  • Added the rest binary_sensor for on/off (~line 115)
  • Changed the template for hvac_mode to first check if the power is off (~line 156)

Updated yaml:

# Integration for Fujitsu wi-fi adapters that use Airstage app (n.b. will NOT work with the older/discontinued adapters that use FGLair app)
# See the HA Community thread https://community.home-assistant.io/t/fujitsu-air-conditioning-integration-airstage-dongle/589679
#
# 1) Install 'Climate IP' via the HACS integration manager https://github.com/jcwillox/hass-template-climate
# 2) Using 'Studio Code Server' from the HA add-ons store is useful
# 3) Use seach&replace funcitonality is useful!
# 4) Save this file as e.g. 'upstairs_aircon.yaml'. 
# 5) Place this file in the same folder as your configuration.yaml
# 6) Search & replace all '192.168.1.188' with the IP address of your aircon (assign a static IP to this device)
# 7) Search & replace all 'E8FB1CFF5FF5' with the MAC address of your aircon (do not put any : in the address)
# 8) Search & replace all instances of 'upstairs' with what you want to name the new aircon device (n.b. needs to be in lower case except where indicated)
# 9) Have a look through at # out sections to see if you want to enable
# 10) Add the following lines to your configuration.yaml (ensure it refers to the correct filename & you remove the #'s')
###############
#homeassistant:
#  packages:
#    pack_1: !include upstairs_aircon.yaml 
###############
#
# ***you will need to do a 'proper'' restart of HA rather than just a quick reload ***
#
# **swing mode is not tested as my device does not have that function** (please report back in the thread if it works)
# 
# Thanks to all the people in the aforemetnioned thread including @pietervanh @ravenland

rest_command:
  upstairs_aircon_setmode:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: >
      {% set aircomodes = {"auto": '"iu_op_mode":"0"',"cool": '"iu_op_mode":"1"',"dry": '"iu_op_mode":"2"',"fan_only": '"iu_op_mode":"3"',"heat": '"iu_op_mode":"4"',"off": '"iu_onoff":"0"'} %}
      {% set opmode = aircomodes.get(hvac_mode, 0) %}
      {"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{ {{opmode}} }} 
  upstairs_aircon_settemp:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: >
      {% set setroomtemp = (target_temp | float   * 10) | int %}
      {"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_set_tmp":"{{ setroomtemp }}"}}
  upstairs_aircon_set_fan_speed:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: >
      {% set fanspds = {"auto": 0, "Quiet": 2,"low": 5,"medium": 8,"high": 11} %}
      {% set spd = fanspds.get(fan_mode, 0) %}
      {"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_fan_spd":"{{ spd }}"}}

# enable if your device has a swing mode
#  upstairs_aircon_set_swing_mode:
#    url: http://192.168.1.188/SetParam
#    method: POST
#    payload: >
#      {% set mode = {"off": 0, "on": 1} %}
#      {% set swing = mode.get(swing_mode, 0) %}
#      {"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_fan_spd":"{{ swing }}"}}
    
# not all units especially ducted have powerful mode. Powerful runs for a short period then stops
  upstairs_aircon_pwrfull_on:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: '{"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_powerfull":"1"}}'
  upstairs_aircon_pwrfull_off:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: '{"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_powerfull":"0"}}'

# these aren't used by the template but included for completion
  upstairs_aircon_on:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: '{"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_onoff":"1"}}'
  upstairs_aircon_off:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: '{"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_onoff":"0"}}'
  upstairs_aircon_eco_on:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: '{"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_economy":"1"}}'
  upstairs_aircon_eco_off:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: '{"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_economy":"0"}}'
  upstairs_aircon_fanctrl_on:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: '{"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_fan_ctrl":"1"}}'
  upstairs_aircon_fanctrl_off:
    url: http://192.168.1.188/SetParam
    method: POST
    payload: '{"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_fan_ctrl":"0"}}'

rest:
  - resource: http://192.168.1.188/GetParam
    scan_interval: 60
    payload: '{"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"03","list":["iu_set_tmp","iu_indoor_tmp","iu_outdoor_tmp","iu_onoff","iu_economy","iu_fan_ctrl","iu_fan_ctrl","iu_powerful","ou_low_noise","iu_op_mode","iu_fan_spd","iu_af_swg_vrt"]}'
    sensor:
      - name: "Temp Outside upstairs Aircon"
        value_template: "{{ (((value_json['value']['iu_outdoor_tmp'] | float  / 100 ) - 32 ) * 5/9) | round(2) }}"
        unit_of_measurement: "°C"
      - name: "Temp Inside upstairs Aircon"
        value_template: "{{ (((value_json['value']['iu_indoor_tmp'] | float  / 100 ) - 32 ) * 5/9) | round(2) }}"
        unit_of_measurement: "°C"
      - name: "Requested Temp upstairs Aircon"
        value_template: "{{ (value_json['value']['iu_set_tmp'] | float / 10 )| round(2) }}"
        unit_of_measurement: "°C"
      - name: "Mode upstairs Aircon"
        value_template: >
          {% set mapper ={'0': 'auto','1': 'cool','2': 'dry','3': 'fan_only','4': 'heat'} %}
          {% set state =  value_json['value']['iu_op_mode'] %}
          {{ mapper[state] if state in mapper else 'Unknown' }}
      - name: "Fan Speed Upstairs Aircon"
        value_template: >
          {% set mapper ={'0': 'auto','2': 'Quiet','5': 'low','8': 'medium','11': 'high'} %}
          {% set state =  value_json['value']['iu_fan_spd'] %}
          {{ mapper[state] if state in mapper else 'Unknown' }}
    binary_sensor:
      - name: "Power Status upstairs Aircon"
        value_template: "{{ (value_json['value']['iu_onoff']) }}"

# enable if your device has a swing mode
#      - name: "Swing Mode Upstairs Aircon"
#        value_template: >
#          {% set mapper ={'0': 'off','1': 'on'} %}
#          {% set state =  value_json['value']['iu_af_swg_vrt'] %}
#          {{ mapper[state] if state in mapper else 'Unknown' }}



climate:
  - platform: climate_template
# the name: can have capital letters if desired
    name: Upstairs Aircon
    modes: 
      - "auto"
      - "dry"
      - "off"
      - "cool"
      - "fan_only"
      - "heat"
    fan_modes:
      - "auto"
      - "Quiet"
      - "low"
      - "medium"
      - "high"

# enable if your device has a swing mode
#    swing_modes:
#      - "on"
#      - "off"

    min_temp: 15
    max_temp: 30

    current_temperature_template: "{{ states('sensor.temp_inside_upstairs_aircon') }}"

    hvac_mode_template: >
      {% if is_state('binary_sensor.power_status_upstairs_aircon', 'off') %}
        off
      {% else %}
        {{ states('sensor.mode_upstairs_aircon') }}
      {% endif %}
    
    target_temperature_template: "{{ states('sensor.requested_temp_upstairs_aircon') }}"
    
    fan_mode_template: "{{ states('sensor.fan_speed_upstairs_aircon') }}"

# enable if your device has a swing mode
#    swing_mode_template: "{{ states('sensor.swing_mode_upstairs_aircon') }}"

    set_hvac_mode:
      - service: rest_command.upstairs_aircon_on
      - delay: 1
      - service: rest_command.upstairs_aircon_setmode
        data:
          hvac_mode: "{{ hvac_mode }}"
      - delay: 2
      - service: homeassistant.update_entity
        entity_id: sensor.mode_upstairs_aircon

    set_temperature:
      - service: rest_command.upstairs_aircon_settemp
        data:
          target_temp: "{{ temperature }}"
      - delay: 2
      - service: homeassistant.update_entity
        entity_id: sensor.requested_temp_upstairs_aircon

    set_fan_mode:
      - service: rest_command.upstairs_aircon_set_fan_speed
        data:
          fan_mode: "{{ fan_mode }}"
      - delay: 2
      - service: homeassistant.update_entity
        entity_id: sensor.fan_speed_upstairs_aircon

# enable if your device has a swing mode
#    set_swing_mode:
#      - service: rest_command.upstairs_aircon_set_swing_mode
#        data:
#          swing_mode: "{{ swing_mode }}"
#      - delay: 2
#      - service: homeassistant.update_entity
#        entity_id: sensor.swing_mode_upstairs_aircon 

3 Likes

Good job, now it is a realy nice soultion to control the ac.
Thanks to you and all other people here.

Can you confirm if the swing control is working?

Would be good if someone could convert it into a HACS integration! (With minimal config file editing)

Swing control does not work.
Fix:

#  upstairs_aircon_set_swing_mode:
#    url: http://192.168.1.188/SetParam
#    method: POST
#    payload: >
#      {% set mode = {"off": 0, "on": 1} %}
#      {% set swing = mode.get(swing_mode, 0) %}
#      {"device_id":"E8FB1CFF5FF5","device_sub_id":0,"req_id":"","modified_by":"","set_level":"02","value":{"iu_af_swg_vrt":"{{ swing }}"}}

Turn swing on works after fix but sensor always shows state off, even if swing is on.

My schoolboy error in the rest_command!

To debug the status can you put this as a template in developer tools? (Changing the name of the Aircon device to suit your setup)

{{ states(‘sensor.swing_mode_upstairs_aircon’) }}

Have you removed the # on both the bonary_sensor section and all three parts of the climate section?

If the above template isn’t working then try replacing the binary_sensor with this:

      - name: "Swing Mode upstairs Aircon"
        value_template: "{{ (value_json['value']['iu_af_swg_vrt']) }}"