Control the air conditioner

hi everyone… I’m using SmartIR at its mention on monitoring the AC whether the status is ON/OFF. Anyone have idea how to do that?

Hello there. Can I view the shell_command codes? I am trying to study how you are controlling the aircon.

- id: lounge_aircon_manual
  alias: 'Lounge Room Aircon'
  initial_state: true
  trigger:
    platform: state
    entity_id: input_select.lounge_ac_mode
  action:
  - service_template: >
      {% if is_state('input_select.lounge_ac_mode', 'Powerful Heat') %} shell_command.lounge_ac_powerful_heat
      {% elif is_state('input_select.lounge_ac_mode', 'Normal Heat') %} shell_command.lounge_ac_normal_heat
      {% elif is_state('input_select.lounge_ac_mode', 'Silent Heat') %} shell_command.lounge_ac_silent_heat
      {% elif is_state('input_select.lounge_ac_mode', 'Powerful Cool') %} shell_command.lounge_ac_powerful_cool
      {% elif is_state('input_select.lounge_ac_mode', 'Normal Cool') %} shell_command.lounge_ac_normal_cool
      {% elif is_state('input_select.lounge_ac_mode', 'Silent Cool') %} shell_command.lounge_ac_silent_cool
      {% elif is_state('input_select.lounge_ac_mode', 'Dry') %} shell_command.lounge_ac_dry
      {% elif is_state('input_select.lounge_ac_mode', 'Off') %} shell_command.lounge_ac_off
      {% endif %}
  - service_template: >
      {% if is_state('input_select.lounge_ac_mode', 'Silent Heat') %} script.fireplace_25
      {% elif is_state('input_select.lounge_ac_mode', 'Normal Heat') %} script.fireplace_75
      {% elif is_state('input_select.lounge_ac_mode', 'Powerful Heat') %} script.fireplace_100
      {% else %} script.fireplace_0
      {% endif %}
lounge_ac_dry: 'curl -k "http://10.1.1.9/r?d=2&t={{states.input_number.lounge_ac_temp_set_cool.state | int}}&f=176&a=16&s=1"'
lounge_ac_off: 'curl -k "http://10.1.1.9/r?d=4&t={{states.input_number.lounge_ac_temp_set_heat.state | int}}&f=160&a=0&s=0"'
lounge_ac_normal_cool: 'curl -k "http://10.1.1.9/r?d=3&t={{states.input_number.lounge_ac_temp_set_cool.state | int}}&f=160&a=0&s=1"'
lounge_ac_normal_heat: 'curl -k "http://10.1.1.9/r?d=4&t={{states.input_number.lounge_ac_temp_set_heat.state | int}}&f=160&a=0&s=1"'
lounge_ac_powerful_cool: 'curl -k "http://10.1.1.9/r?d=3&t={{states.input_number.lounge_ac_temp_set_cool.state | int}}&f=160&a=1&s=1"'
lounge_ac_powerful_heat: 'curl -k "http://10.1.1.9/r?d=4&t={{states.input_number.lounge_ac_temp_set_heat.state | int}}&f=160&a=1&s=1"'
lounge_ac_silent_cool: 'curl -k "http://10.1.1.9/r?d=3&t={{states.input_number.lounge_ac_temp_set_cool.state | int}}&f=176&a=16&s=1"'
lounge_ac_silent_heat: 'curl -k "http://10.1.1.9/r?d=4&t={{states.input_number.lounge_ac_temp_set_heat.state | int}}&f=176&a=16&s=1"'

@tom_l
Thank you. also, how did you create the binary_sensor.lounge_room_dht_status. This is a good check. I notice one of my dht22 sensors at times, lose connections after restarting HA.

Thank you! One last question. I have added the automation to HA. The am/pm automation triggers when it falls below the target temperature. Does the automation stops the Aircon if temperature goes above the target temperature? I think not due to this line.

  condition:
  - condition: state # Only if AC is off (prevents oscillation between heat and cool mode if temperature over/undershoots set point)
    entity_id: input_select.lounge_ac_mode
    state: 'Off'

No the AC only turns off at the time in the off input datetime. The thermostat in the AC puts itself in a low power mode once the target temp is met.

Hello Tom,
I have implemented your codes to my aircon and got it working. Is it safe to delete all the entity_id in the sensors templates to keep inline with the updates?

Yes except for the templates that use now() you should add this line to those templates:

        {% set update = states('sensor.time') %}

After you update to v0.117 you can delete these added lines. See Heads up! Upcoming breaking change in the Template integration

1 Like

@tom_l
Hello
I was looking at the am/pm turn off automations and I notice it is trigger ever day when it is not suppose to. The aircon isn’t on at the set am/pm times.

This line is what triggering it. With the aircon in the off state, it should say false, but it is true.
automation:

  - condition: template # And only if AC is on
    value_template: "{{ not is_state('input_select.lr_ac_mode.state', 'Off') }}"

This is what I have in the input select. I double check the O in Off. It is capital ‘O’
input select:

  lr_ac_mode:
    name: LR AC Mode
    icon: mdi:air-conditioner
    options:
      - 'Off'
      - Fan
      - Ai Auto
      - Powerful Cool
      - Normal Cool
      - Silent Cool
      - Powerful Heat
      - Normal Heat
      - Silent Heat
      - Normal Humidifier

What does this return in the developer tools template editor:

{{ states('input_select.lr_ac_mode.state') }}
{{ is_state('input_select.lr_ac_mode.state', 'Off') }}
{{ not is_state('input_select.lr_ac_mode.state', 'Off') }}

Also:

:one::six: Should I tag people?

Generally, no.

It comes across as bad manners, you’re demanding somebody answers you. It’s different if you’re thanking somebody, obviously.
How to help us help you - or How to ask a good question

{{ states('input_select.lr_ac_mode.state') }} <- unknown
{{ is_state('input_select.lr_ac_mode.state', 'Off') }} <-- False
{{ not is_state('input_select.lr_ac_mode.state', 'Off') }} <-- True

So now you know what the problem is.

{{ states('input_select.lr_ac_mode.state') }} <- unknown

So now you know what the problem is.

Actually, I do not know what the problem is. I have checked that above statement with other input select, input number, input boolean and it all reads unknown. However, if I change the statement to this, it reads correctly.

{{ states(‘input_select.lr_ac_mode’) }} ← -Off

Since I can’t figure out why it’s not showing false, I changed the code to this.

{{ states("input_select.lr_ac_mode") != "Off" }}

Hi @KingRichard, did you find your answer to this?

I am using an HS110 power plug that supports energy consumption.

I used it in my SmartIR config after setting up a binary sensor in my configuration.yaml that turns on when a certain amount of power is drawn and off when it falls lower.

The only thing I want to figure out is how I can make the gauge in the standard thermostat lovelace card to change color when the binary power sensor is set to ON.

Does anyone have an idea?

Sir, pls guide me how you did it, I am struggling to do with Whirlpool AC, I have setup D1Mini with Mqtt for turning off lights and i want to add AC control

hello, this card is giving me an error (smartir process not found)when adding it in configuration.yaml,so may you help me ???

That post is over a year old and is no longer correct. Home Assistant has changed since then.

Start your own post with your issue including your card configuration and the full error you receive.

ok, thank you for your reply