My Alexa compatible Sensibo (Climate) Project

Living in Melbourne, one of the best things you could have in your house is air-conditioning/climate control, much needed heating in winter, and much needed cooling in summer. This is why I’ve spent a bit of time making and customising my Sensibo component to what I want it to do. I’ve utilised a few different components to make it all work, but this is how the finished product looks, and it’s fully Alexa compatible, even offering more control than the official skill provided by Sensibo on Alexa.

Most of this is also compatible with any device that utilises the Climate service in HA.

I’ve used the standard built in Sensibo component for the main part. For the on/off switch and to show the inside temperature/humidity I’ve used Amir974’s Switch and Sensor components.

For the Temperature, Fan and Operation selections, I’ve created my own Input Selections as follows:

ac_temp:
  name: Temperature
  options: 
    - "18"
    - "19"
    - "20"
    - "21"
    - "22"
    - "23"
    - "24"
    - "25"
    - "26"
    - "27"
  initial: "21"
  icon: mdi:oil-temperature

ac_fan:
  name: Fan Mode
  options:
    - Low
    - Medium
    - High
    - Auto
  initial: Medium
  icon: mdi:fan

ac_operation:
  name: Operation
  options:
    - Cool
    - Heat
  initial: Cool
  icon: mdi:hot-tub

Then I set up the following 3 template automations to basically translate and relay the input selections to the climate service:

- alias: "AC Temp"
  initial_state: 'on'
  trigger:
    platform: state
    entity_id: input_select.ac_temp
  action:
    service: climate.set_temperature
    data_template:
      entity_id: climate.living
      temperature: >
       {% if is_state('input_select.ac_temp', '18') %}
       18
       {% elif is_state('input_select.ac_temp', '19') %}
       19
       {% elif is_state('input_select.ac_temp', '20') %}
       20
       {% elif is_state('input_select.ac_temp', '21') %}
       21
       {% elif is_state('input_select.ac_temp', '22') %}
       22
       {% elif is_state('input_select.ac_temp', '23') %}
       23
       {% elif is_state('input_select.ac_temp', '24') %}
       24
       {% elif is_state('input_select.ac_temp', '25') %}
       25
       {% elif is_state('input_select.ac_temp', '26') %}
       26
       {% elif is_state('input_select.ac_temp', '27') %}
       27
       {% endif %}

- alias: "AC Fan Mode"
  initial_state: 'on'
  trigger:
    platform: state
    entity_id: input_select.ac_fan
  action:
    service: climate.set_fan_mode
    data_template:
      entity_id: climate.living
      fan_mode: >
       {% if is_state('input_select.ac_fan', 'Low') %}
       low
       {% elif is_state('input_select.ac_fan', 'Medium') %}
       medium
       {% elif is_state('input_select.ac_fan', 'High') %}
       high
       {% elif is_state('input_select.ac_fan', 'Auto') %}
       auto
       {% endif %}

- alias: "AC Mode"
  initial_state: 'on'
  trigger:
    platform: state
    entity_id: input_select.ac_operation
  action:
    service: climate.set_operation_mode
    data_template:
      entity_id: climate.living
      operation_mode: >
       {% if is_state('input_select.ac_operation', 'Cool') %}
       cool
       {% elif is_state('input_select.ac_operation', 'Heat') %}
       heat
       {% endif %}

With everything above, you’ll get what I have in the screenshot. The real fun is the Alexa component. First in Home Assistant I have the following under intent_script in the configuration.yaml:

TemperatureIntent:
  speech:
    type: plain
    text: >
      It is currently {{ states.sensor.inside_temperature.state }} degrees celsius inside

HumidityIntent:
  speech:
    type: plain
    text: >
      The humidity inside is currently at {{ states.sensor.inside_humidity.state }} percent

FanIntent:
  action: 
    - service: input_select.select_option
      entity_id: input_select.ac_fan
      data_template:
        option: '{{ Fan }}'
  speech:
    type: plain
    text: >
      AC fan mode set to {{ Fan }}

TempIntent:
  action:
    - service: input_select.select_option
      entity_id: input_select.ac_temp
      data_template:
        option: '{{ Temperature }}'
  speech:
    type: plain
    text: >
      AC temperature set to {{ Temperature }} degrees celsius.

ModeIntent:
  action:
    - service: input_select.select_option
      entity_id: input_select.ac_operation
      data_template:
        option: '{{ Mode }}'
  speech:
    type: plain
    text: >
      AC set to {{ Mode }}.

The first 2 intents just tell me what the inside temperature and humidity are when asked. With the above configuration, every time I ask Alexa to change the temperature or fan, HA changes the input_select which is automated to pass onto Sensibo’s API. I found this to be the quickest and most reliable way to do it, since the Sensibo API can be quite slow at the best of times, and if Alexa goes directly to Sensibo, it times out 9 out of 10 times. This way Alexa’s Sensibo settings are also synced with the input selects in HA.

The Amazon Alexa interaction are as follows:

Intent Schema:

{
  "intents": [
    {
      "intent": "TemperatureIntent"
    },
    {
      "intent": "HumidityIntent"
    },
    {
      "slots": [
        {
          "name": "Fan",
          "type": "Fans"
        }
      ],
      "intent": "FanIntent"
    },
    {
      "slots": [
        {
          "name": "Temperature",
          "type": "Temperatures"
        }
      ],
      "intent": "TempIntent"
    },
    {
      "slots": [
        {
          "name": "Mode",
          "type": "Modes"
        }
      ],
      "intent": "ModeIntent"
    }
  ]
}

Custom Slot Types are as follows:

Utterances as follows:

TemperatureIntent What is the inside temperature
TemperatureIntent What's the inside temperature
TemperatureIntent What is the indoor temperature
TemperatureIntent What's the indoor temperature
HumidityIntent What is the inside humidity
HumidityIntent What's the inside humidity
HumidityIntent What is the indoor humidity
HumidityIntent What's the indoor humidity
FanIntent set the AC fan to {Fan}
TempIntent set the temperature to {Temperature} degrees
ModeIntent turn on {Mode}

It’s also worth noting that the A/C switch is exposed to Alexa via emulated hue, so no need for that to go via the Alexa API, although you could set it up that way. I prefer to say “Alexa, turn on AC” rather than “Alexa, tell Sensibo to turn on AC”.

I hope this is a handy guide for others!

6 Likes

I made a Smart Home skill for Alexa that allows me to control my ac unit via Home Assistant API.
It can control multiple units: on/off, temperature and mode (without the fan).

1 Like

Hi!
Great skill!
Mine look like this:

1 Like

This is cool! Also getting ready for the hot summer to come here in Sydney but I am doing this for my friend.

I will be getting the Sensibo today and set it up for the person I am looking after. He has MS and with this type of condition, he is very susceptible to heat and humidity.

Would this enable me to turn on the AC when it reaches a certain level of room humidity or temperature?

Also, it would be nice to know if home assistant would be able to control the AC vanes so that the air coming out is directed to where the person is in the room. The problem with the AC unit that my friend have right now is that the vanes reset to their default position every time the AC is turned off. He would have to position the vanes again every time he turns it back on.

Thank you for sharing this amazing automation.

Yes this can be done with automations in HA. I use humidity and temperature to change status on your AC.

Here is my automation:

homeassistant:
  customize:
    sensor.humidity:
      icon: 'mdi:water-percent'
    climate.ac:
     friendly_name: Status
     icon: 'mdi:air-conditioner'
    input_boolean.turn_on_ac:
     friendly_name: Varmepumpe AV/PÅ
     icon: 'mdi:power'
     persistent: true
    input_select.operation:
     friendly_name: Modus
     icon: 'mdi:rotate-3d'
     precedence: true
    input_select.fan:
     precedence: true
    input_select.swing:
     precedence: true




automation:
- alias: 'skru AC på'
  initial_state: 'on'
  trigger: 
    platform: state
    entity_id: input_boolean.turn_on_ac
    to: 'on'
  action:
    - service: climate.turn_on
      entity_id: climate.ac

- alias: 'skru AC av'
  initial_state: 'on'        
  trigger:
    platform: state 
    entity_id: input_boolean.turn_on_ac
    to: 'off'
  action:
    - service: climate.turn_off
      entity_id: climate.ac

      
- alias: 'turn off boolean'
  initial_state: 'on'
  trigger:
    platform: state
    entity_id: climate.ac
    to: 'off'
  action:
    - service: homeassistant.turn_off
      entity_id: input_boolean.turn_on_ac

- alias: 'turn on boolean'
  initial_state: 'on'
  trigger:
    platform: state
    entity_id: climate.ac
    to: 'heat'
  action:
    - service: homeassistant.turn_on
      entity_id: input_boolean.turn_on_ac


- alias: 'AC nattmodus tv av'
  initial_state: 'on'
  trigger: 
    platform: state
    entity_id: media_player.tv_stuen
    to: 'off'
  condition:
    condition: and
    conditions:
    - condition: state
      entity_id: climate.ac
      state: 'heat'
    - condition: time
      after: '23:00:00'
      before: '03:00:00'
    - condition: numeric_state
      entity_id: sensor.temperature
      above: '18'
  action:
    - service: climate.set_temperature
      entity_id: climate.ac
      data:
        temperature: '18'

         


- alias: 'AC på ved bevegelse'
  initial_state: 'on'
  trigger: 
    - platform: state
      entity_id: binary_sensor.ring_front_door_motion
      to: 'on'
  condition:
    condition: and
    conditions:
     - condition: time
       after: '12:00:00'
       before: '14:30:00'
     - condition: state
       entity_id: climate.ac
       state: 'heat'
     - condition: numeric_state 
       entity_id: sensor.yr_temperature
       below: '12'
     - condition: state
       entity_id: calendar.skoleferie_20182019
       state: 'off'
     - condition: state
       entity_id: binary_sensor.workday_sensor
       state: 'on'
     - condition: state
       entity_id: device_tracker.henningsiniphone
       state: 'not_home'
     - condition: state
       entity_id: device_tracker.linda_k_sin_iphone_6
       state: 'not_home'
  action:
    - service: climate.set_temperature
      entity_id: climate.ac
      data:
        temperature: '24'
    - delay: '01:00:00'
    - service: climate.set_temperature
      entity_id: climate.ac
      data:
        temperature: '21'

- alias: 'AC automation av'
  initial_state: 'on'
  trigger:
    - platform: state
      entity_id: binary_sensor.ring_front_door_motion
      to: 'on'
  condition:
    condition: and
    conditions:
     - condition: time
       after: '12:00:00'
       before: '14:30:00'
     - condition: state
       entity_id: automation.ac_pa_ved_bevegelse
       state: 'on'
  action:
    - delay: '00:00:20'
    - service: homeassistant.turn_off
      entity_id: automation.ac_pa_ved_bevegelse

- alias: 'AC automation på'
  initial_state: 'on'
  trigger:
    - platform: time
      at: '14:31:00'
  action:
    - service: homeassistant.turn_on
      entity_id: automation.ac_pa_ved_bevegelse


- alias: 'AC av ved høy utetemperatur ove 15 grader'
  initial_state: 'on'
  trigger:
    - platform: numeric_state
      entity_id: sensor.yr_temperature
      above: '15'
  condition:
    condition: and
    conditions:
    - condition: state
      entity_id: climate.ac
      state: 'heat'
  action:
    - service: homeassistant.turn_off
      entity_id: climate.ac

- alias: 'AC på ved lav utetemperatur'
  initial_state: 'on'
  trigger:
    - platform: numeric_state
      entity_id: sensor.yr_temperature
      below: '11'
  condition:
    condition: and
    conditions:
    - condition: state
      entity_id: climate.ac
      state: 'off'
    - condition: state
      entity_id: climate.ac
      state: 'heat'
    - condition: time
      after: '13:00:00'
      before: '22:30:00'
    - condition: state
      entity_id: binary_sensor.workday_sensor
      state: 'on'
  action:
    - service: climate.set_temperature
      entity_id: climate.ac
      data:
        temperature: '21'

- alias: 'AC til 18 grader ved høy innetemperatur'
  initial_state: 'on'
  trigger:
    - platform: numeric_state
      entity_id: sensor.current_temperature
      above: '24'
  condition:
    condition: and
    conditions:
    - condition: state
      entity_id: input_boolean.turn_on_ac
      state: 'on'
    - condition: state
      entity_id: climate.ac
      state: 'heat'
    - condition: numeric_state
      entity_id: sensor.temperature
      above: '21'
  action:
    - service: climate.set_temperature
      entity_id: climate.ac
      data:
        temperature: '18'
        
        
- alias: 'AC på ved innetemperatur under 19'
  initial_state: 'on'
  trigger:
     platform: template
     value_template: "{{ states.climate.ac.attributes.current_temperature < 19}}" 
  condition:
    condition: and
    conditions:
    - condition: state
      entity_id: device_tracker.henningsiniphone
      state: 'home'
    - condition: state
      entity_id: device_tracker.linda_k_sin_iphone_6
      state: 'home'
    - condition: state
      entity_id: input_boolean.turn_on_ac
      state: 'on'
  action: 
    - service: homeassistant.turn_on
      entity_id: input_boolean.turn_on_ac
    - service: climate.set_temperature
      entity_id: climate.ac
      data:
        temperature: '22'

- alias: 'Varmepumpe'
  initial_state: 'on'
  trigger:
    - platform: state
      entity_id: input_select.operation
  action:
    - service: climate.set_operation_mode
      data_template:
        entity_id: climate.ac
        operation_mode: >-
          {% if is_state("input_select.operation", "auto") %}
            auto
          {%-elif is_state("input_select.operation", "cool") %}
            cool
          {% elif is_state("input_select.operation", "dry") %}
            dry
          {% elif is_state("input_select.operation", "fan") %}
            fan
          {% elif is_state("input_select.operation", "heat") %}
            heat
          {% else %}
            auto
          {% endif %}
          
- alias: 'Vifte varmepumpe'
  initial_state: 'on'
  trigger:
    - platform: state
      entity_id: input_select.fan
  action:
    - service: climate.set_fan_mode
      data_template:
        entity_id: climate.ac
        fan_mode: >-
          {% if is_state("input_select.fan", "quiet") %}
            quiet
          {%-elif is_state("input_select.fan", "low") %}
            low
          {% elif is_state("input_select.fan", "medium") %}
            medium
          {% elif is_state("input_select.fan", "medium_high") %}
            medium_high
          {% elif is_state("input_select.fan", "high") %}
            high
          {% elif is_state("input_select.fan", "auto") %}
            auto
          {% else %}
            auto
          {% endif %}

- alias: 'Svingarm varmepumpe'
  initial_state: 'on'
  trigger:
    - platform: state
      entity_id: input_select.swing
  action:
    - service: climate.set_swing_mode
      data_template:
        entity_id: climate.ac
        swing_mode: >-
          {% if is_state("input_select.swing", "stopped") %}
            stopped
          {%-elif is_state("input_select.swing",  "fixedTop") %}
            fixedTop
          {% elif is_state("input_select.swing", "fixedMiddleTop") %}
            fixedMiddleTop
          {% elif is_state("input_select.swing", "fixedMiddle") %}
            fixedMiddle
          {% elif is_state("input_select.swing", "fixedMiddleBottom") %}
            fixedMiddleBottom
          {% elif is_state("input_select.swing", "fixedBottom") %}
            fixedBottom
          {% elif is_state("input_select.swing", "rangeFull") %}
            rangeFull
          {% else %}
            auto
          {% endif %}


- alias: 'Temperatur varmepumpe'
  initial_state: 'on'
  trigger:
    - platform: state
      entity_id: input_number.air_condition_temp
  action:
    - service: climate.set_temperature
      data_template:
        entity_id: climate.ac
        temperature: '{{ states.input_number.air_condition_temp.state | int }}'
        target_temp_high: '30'
        target_temp_low: '10'

      
      
- alias: 'Heating, Living Room Set Slider'
  initial_state: 'on'
  trigger:
    platform: state
    entity_id: sensor.temperature
  action:
    service: input_number.set_value
    entity_id: input_number.air_condition_temp
    data_template:
      value: "{{ states.climate.ac.attributes.temperature }}"

            
      
input_select:
  operation:
    name: Modus
    options:
      - auto
      - cool
      - dry
      - fan
      - heat
    initial: heat
    icon: 'mdi:ac_conditioner'

  fan:
    name: Vifte 
    options:
      - quiet
      - low
      - medium
      - medium_high
      - high
      - auto
    initial: auto
    icon: 'mdi:fan'
  
  swing:
    name: Svingspjeld
    options:
      - stopped
      - fixedTop
      - fixedMiddleTop
      - fixedMiddle
      - fixedMiddleBottom
      - fixedBottom
      - rangeFull
    initial: fixedMiddleTop
    icon: 'mdi:arrow-all' 
  
input_number:
  air_condition_temp:
    name: Temperatur
    min: 10
    max: 30
    step: 1
    icon: 'mdi:temperature-celsius'
  
input_boolean:
  turn_on_ac:
    name: 'AC ON'
    initial: off
  
  turn_off_ac:
    name: 'AC OFF'
    initial: off
  
  air_conditioner:
    name: 'Air Conditioner'
    initial: off
    
    
sensor:
  - platform: template
    sensors: 
      humidity:
        friendly_name: Målt Fuktighet
        value_template: "{{ states.climate.ac.attributes.current_humidity }}%"

  - platform: template
    sensors: 
      temperature:
        friendly_name: Temperatur
        value_template: "{{ states.climate.ac.attributes.temperature }}"

  - platform: template
    sensors: 
      current_temperature:
        friendly_name: Nåværende temperatur
        value_template: "{{ states.climate.ac.attributes.current_temperature }}"