For anyone with a similar issue to what I previously asked, I have found a solution.
As previously stated, you will need the rest command. I’ve included mine here, but it’s the same as all the other ones posted here.
rest_command:
switchbot_irdevice_command:
url: 'https://api.switch-bot.com/v1.0/devices/{{ deviceId }}/commands'
method: post
content_type: 'application/json'
headers:
Authorization: !secret switchbot_api
payload: '{"command": "{{ command }}","parameter": "default", "commandType": "customize"}'
Assuming you are adding more than one IR command, you will need to add multiple “switches” for each command. In my example below, I have a total of three “switches” (commands), power, speed control, and oscillation. They all need to go under the single “Switch” line.
switch:
- platform: template
switches:
fan_power:
friendly_name: Fan_Power
turn_on:
service: rest_command.switchbot_irdevice_command
data:
deviceId: !secret switchbot_fan_deviceId
command: "Power"
turn_off:
service: rest_command.switchbot_irdevice_command
data:
deviceId: !secret switchbot_fan_deviceId
command: "Power"
fan_speed:
friendly_name: Fan_Speed
turn_on:
service: rest_command.switchbot_irdevice_command
data:
deviceId: !secret switchbot_fan_deviceId
command: "Speed_Toggle"
turn_off:
service: rest_command.switchbot_irdevice_command
data:
deviceId: !secret switchbot_fan_deviceId
command: "Speed_Toggle"
fan_oscillate:
friendly_name: Fan_Oscillate
turn_on:
service: rest_command.switchbot_irdevice_command
data:
deviceId: !secret switchbot_fan_deviceId
command: "Oscillate"
turn_off:
service: rest_command.switchbot_irdevice_command
data:
deviceId: !secret switchbot_fan_deviceId
command: "Oscillate"
Finally, on the Switchbot app, make a custom button for each one of these, ensuring that the name of the button matches the command name. I.E. the command “Power” only works because I have a custom button programmed in the Switchbot app named “Power”.
