Automation for Kasa Matter dimmer switches

Does anyone have an automation that works with a pair of Kasa Matter dimmer switches, where the second switch is an accessory? I have tried a bunch of automations posted by other people, but nothing seems to work. The main swich works fine, and the accessory works also (although it does nothing). Both swiches are Kasa dimmers, and are configured with Matter.