Fan automations

I’m pretty sure I am in a very unique situation. I have a Kasa Smart Switch to control my fan (on/off). I also have Bond to control my fan speed.

If Kasa says the fan on, Bond has access to control the fan. If Kasa says the fan is off, Bond has no access to control the fan.

I was able to create an automation to control Bond via the wall switch. IE if the wall switch changes, Bond is triggered to turn the fan on.

But I can’t figure out how to control this in Lovelace based on fan speed. I have a custom HACS entity for fans (custom:fan-control-entity-row) that lets me set the fan speed via lovelace (Off, low, medium, high). If its off, and I click medium, I want Kasa to turn on then Bond to set speed to medium (low to low, high to high). But I can’t figure out how to do this via automation.

How do I pull the speed it thinks it is and resend that same command?

Here’s what I have so far

alias: 'Fan: Game Room (On) (Lovelace)'
description: ''
trigger:
  - platform: device
    type: turned_on
    entity_id: fan.game_room_fan_2
    domain: fan
condition:
  - condition: device
    type: is_off
    entity_id: switch.game_room_fan
    domain: switch
action:
  - type: turn_on
    entity_id: switch.game_room_fan
    domain: switch
  - service: fan.set_speed
    target:
      entity_id: fan.game_room_fan_2
    data:
      speed: high
mode: single

the only way I would know how to do it would be to try to create another template fan and try to figure out a script for the speed control portion that first turns on the fan and then sets the speed.

But it’s going to get complicated and i have no ideas on how to accomplish it.