Switchbot API integration: IR remote to control aircon

Hi

I’m starting to get Switchbot integrated with Home Assistant via API but don’t really understand what I’m doing.

Ultimately I’d like to be able to control the aircon via the Switchbot Hub Mini IR transmitter in the same way I would have done through the app (which is to have an On button, Off button, Temperature +/-, Preset Modes and Fan Settings). From the Switchbot API documentation, it’s possible to control via the Hub Mini IR transmitter the temperature, heating/cooling/fan/dry modes, fan speed and power state.
=> How should I be doing this via yaml? I have created a fan entity implementing the turn_on, turn_off and set_preset_mode methods as below.

fan:
  - platform: template
    fans:
      bedroom_aircon:
        friendly_name: "Bedroom Air Conditioner"
        turn_on:
          service: rest_command.switchbot_irdevice_command
          data:
            deviceId: !secret bedroom_aircon_deviceId
            command: "turnOn"
            commandType: ""
        turn_off:
          service: rest_command.switchbot_irdevice_command
          data:
            deviceId: !secret bedroom_aircon_deviceId
            command: "turnOff"
            commandType: "command"
        set_preset_mode:
            service: rest_command.switchbot_irdevice_command
            data:
              preset_mode: "auto"
              deviceId: !secret bedroom_aircon_deviceId
              command: "setAll"
              commandType: "command"
              parameter: "25,1,1,on"

If I set up a dashboard button to control, the aircon can be successfully switched on and off. Presumably this is because I’m implementing the turn_on and turn_off methods sucessfully.

When I try to implement the set_preset_mode method, HA returns that this service is not supported because fan.bedroom_aircon doesn’t support this service. HA documentation also says that the set_preset_mode method can only be implemented if the flag SUPPORT_PRESET_MODE is set.
=> How do I set the flag SUPPORT_PRESET_MODE?

Thanks

Hi, I started developing an Integration to get the Remote Switchbot devices on HomeAssistant.

Have a look here: GitHub - KiraPC/ha-switchbot-remote