SmartIR Aircond ON/OFF Sync State with HA

Dear All,

I am using SmartIR custom component with Broadlink RM Mini to control my AC.

The component is installed well and the commands and all work properly.

The issue I face is, when controlled with Google Assistant, on my voice command ‘Switch on the Room AC’ it respond back as ‘Changing the Room AC to cool’ The IR code send is for setting the mode to cool but this does not turn the AC On.

The only way I can turn the AC on and off is by saying ‘Switch off the room AC’

I guess the issue here is the AC remote has one button for on and off, and syncing the state with HA is a mess.

Any suggestions to circumvent this issue? Maybe by using an automation or scripting.

Open to suggestion thanks.

3 Likes

You could create an input boolean and expose that to voice assistant. Then have automations to ir based on input boolean state.

To sync on/off you need to provide ha a binary status somehow if ac is on. Power meter, reed sensor on the flaps, put temperature sensor to air flow and measure difference to some other location.

I have hidden the actual remote and force everyone use home assistant or alexa :smiley:

Wow, that’s very smart suggestion.

If you have done the same, do you mind sharing the code. Sorry, I am not so good in programming.

My AC turns on when I send the heat command by saying “Turn on heat pump to heat (or cool)”. What model you have? Just out of curiosity.

Crafted this out of my head wihtout verifying. Hope it works!
The first automation first turn on the AC and then sets the mode. But I find it weird that you would need this. What does it actually do if you manually press (fromm the climate card) the on/off button? I would assume that it sends the last status information. If it was in heat mode the AC should start in heat mode.

Second automation just turns off. But if the AC turns on correctly when you press the manual on/off button (from the climate card) then you can supress the first automation to match the seconds. This would then force the on command only and not the voice assistant do anything else (because controlling directly the climate entity it can).

input_boolean:
  heat_pump: #Pick some name that is not already common to your voice assistant
    name: Heat Pump
    icon: mdi:fan

automation:
  - alias: "Heat pump (on)"
    trigger:
      - platform: state
        entity_id: input_boolean.heat_pump
        to: "on"
    action:
      - service: climate.turn_on
        data:
          entity_id: climate.<add your entity>
     # - delay:   #might need this to give your AC time to turn of before sending next command
     #   seconds: 3
      - service: climate.set_temperature
        data:
          entity_id: climate.<add your entity>
          temperature: 24
          hvac_mode: heat

  - alias: "Heat pump (off)"
    trigger:
      - platform: state
        entity_id: input_boolean.heat_pump
        to: "off"
    action:
      - service: climate.turn_off
        data:
          entity_id: climate.<add your entity>

This is the card I see in lovelace. If i hit the right most button, i.e. power button my ac can toggle ON and OFF. But essentially that button sends the IR code for OFF using broadlink. The control with lovelace is fine.

.My issue is when I ask google to switch on room ac, it does not trigger that button, but instead sets the fan mode to Cool. As a workaround, the only way I get google to switch ON my ac is to actually tell her to switch OFF my AC. Since the ON/OFF is a toggle command, my AC can be toggled ON and OFF using the OFF command.

The flaw in this workaround is, although my AC is ON, for HA its OFF, because I used the OFF voice command to ON the AC. This prevents HA from knowing the exact state any time and its hard to use automation.

Can your code address this issue?

Okay so in the end works just like mine.

Did you try saying “turn on to heat”?

But the above code will make this work. The on command is enough to have just this

automation:
  - alias: "Heat pump (on)"
    trigger:
      - platform: state
        entity_id: input_boolean.heat_pump
        to: "on"
    action:
      - service: climate.turn_on
        data:
          entity_id: climate.<add your entity>

HI turn on to Heat also did not work.

This is how I did mine:

  1. Installed a tuya smart plug on the AC, this allowed me to have power measurement sensor in HA. I would trigger the AC OFF only when the Power value is above/below certain value.
  2. To turn ON AC using google assistant, I created a scene, and then made an automation to trigger the AC ON using climate_turnoff service. Again here, the condition to toggle the AC is based on the power measurement reading.

In summary, the only way for me to ON/OFF the ac is using climate_turnoff service. Having the sensor allowed me to program Condition and only trigger the service action when its supposed to and not when its not required. Just add 2 action for switching the AC ON (i) call service climate_turnoff (ii) call service climate_hvac_mode = cool. This way, my climate state is always in sync with the intended state I want.

I hope this helps others.