Help with Custom Bluetooth device integration

Hi,
I’ve been using Home assistant for a while now. Until now all my usage was simple and straight forward. This is the first time I’m trying something new.
I recently bought Lasko Bluetooth window fan. It has a phone app and is working fine. Now, I want to integrate it to Home assistant.
Using btsnoop_hci.log and Wireshark, I was able to gather the BT commands required for controlling the fan.
I need some help with connecting the fan to Pi, integrating the commands to Home assistant and control the fan through Automation.
Thanks in advance.

1 Like

Interestingly I started working on exactly same thing ( also Lasko BT Fan ) :).

Could you post the commands I mapped only On/Off so far ( same way as you btw ).

I also got it to work with pygatt maybe it will help you.

import pygatt

adapter = pygatt.GATTToolBackend()

try:
    adapter.start()
    device = adapter.connect(<MAC>)
	
	device.char_write('0000fff2-0000-1000-8000-00805f9b34fb',bytearray([4,3,4,1,8]))
	device.char_write('0000fff2-0000-1000-8000-00805f9b34fb',bytearray([4,3,4,0,7]))
	
finally:
    adapter.stop()

1 Like

Managed to do custom integration for it.

Feel free to test it. Cannot promise quick fixes but will try to review any pull request if any submitted.

Put the content in config/custom_components and add

fan:
  - platform: lasko_bt_fan_w9560
    mac: "<MAC>"

The code for discovery is ready but it is not yet tested/enabled. WIP