Switchbot, bluetooth, Hyper-v VM
I recently took a gamble and ordered a switchbot. I considered ordering a Hub as well, but couldn’t find anything that proved it would give me wifi access to a local API for the switchbot.
Instead I wondered if I could pipe the Hyper-V host bluetooth hardware into the virtual machine, to talk directly with the Switchbot. Turn out yes, using USB Redirector.
USB Redirector is a software we make minor use of at work, so I downloaded and trialled, and ended up purchasing it. It allows various hardware of the host to be offered to a virtual machine. In my testing so far, that includes the built-in bluetooth, an external AP capable WiFi dongle, and an external Zigbee dongle.
After that I installed Wondersoft python-host on the virtual machine (and hcitool etc), created a bash script to trigger the Switchbot, and a node-red Exec node to call the script. Presto.