Hello guys
I am developing an integration right now for a custom BLE air sensor. This device should be connected via BLE to the OS Home Assistant is running on. I wrote a package that does the connection an reading and now I face to problem on how to use my package as Home Assistant.
I look at the “Xiaomi Mijia BLE Temperature and Humidity Sensor” integration which creates a platform and inside an entity for each sensor (eg. air quality, temperature, humidity, etc.)
Now my question is from where do I call my connect_ble_device
method? If I put the call in the async_setup_platform
it delays the startup and also doesn’t even work. As soon as the call for the async method is made, nothing happens. The method is not actually called. My call looks like this:
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
...
device = hass.async_create_task(gateway.connect_ble_device(mac))
...
I hope this is the right place to ask. Thanks in advance for your help