Capturing bluetooth errors

Hey folks

I’m using switchbot which mostly works well, but I’m regularly getting errors:
“Failed to connect to peripheral %s, addr type: %s” % (addr, addrType))
bluepy.btle.BTLEException: Failed to connect to peripheral 4C:65:A8:D2:9A:E8 addr type: random

I realise this might be a range issue. Is there any way to capture this error and trigger an automation with it?

I’ve read about using grep and the command line sensor, but I wonder if this would trigger falsely because the error is repeated multiple times in the log. I’m hoping there’s a slightly more robust way to capture the issue and correct it with an automation. Any ideas?