#Switchbot Bluetooth integration check for the Bluetooth integration dependency

1 messages · Page 1 of 1 (latest)

vivid gyro
#

Hi, I am a complete newbie when it comes to HA. I am using Home Assistant Green and tried to add my Switchbot Meter to it. I searched for a Switchbot integration and found Switchbot Bluetooth. I attempted to add it and got this:

No supported SwitchBot devices found in range; …

I put the meter into the pairing mode and it was still not showing up. I read the Switchbot Bluetooth readme and found I needed to install the Bluetooth integration too, so I tried and go this:

No unconfigured Bluetooth adapters found.

Then I realized that Home Assistant Green was not equipped with a Bluetooth radio so I ordered a USB to BLE adapter.

I wondered if the Switchbot Bluetooth integration could have told me to get the Bluetooth integration so I looked at its code and found _async_discover_devices in config_flow.py:

    @callback
    def _async_discover_devices(self) -> None:
        current_addresses = self._async_current_ids(include_ignore=False)
        for connectable in (True, False):
            for discovery_info in async_discovered_service_info(self.hass, connectable):
                address = discovery_info.address
                # ...
                if (...) or model_name in NON_CONNECTABLE_SUPPORTED_MODEL_TYPES:
                    self._discovered_advs[address] = parsed

        if not self._discovered_advs:
            raise AbortFlow("no_devices_found")

I found https://developers.home-assistant.io/docs/dev_101_hass#the-hass-object which has broken links, but I wonder if there could be a condition a-la self.hass.services.get("bluetooth") and if not defined, display an error telling the user to get the Bluetooth integration?

Or even state it as a dependency in manifest.json if that's how it works? It depends on bluetooth_adapters right now which I am not sure how that's different from the Bluetooth integration itself.

Thanks for entertaining a complete novice's question.

pine salmon
vivid gyro
#

Thank you for the warm welcome! I did consider opening a GitHub issue, but I thought my post was a bit too questiony for that. I will re-post it on the forum.