Lenn 70c4fa8475
Add Motionblinds BLE integration (#109497)
* initial fork

* intial tests

* Initial test coverage

* extra coverage

* complete config flow tests

* fix generated

* Update CODEOWNERS

* Move logic to PyPi library and update to pass config_flow test and pre-commit

* Remove Button, Select and Sensor platform for initial PR

* Update manifest.json

* Change info logs to debug in cover

* Use _abort_if_unique_id_configured instead of custom loop checking existing entries

* Change platforms list to PLATFORMS global

Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* Remove VERSION from ConfigFlow

Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* Replace all info logs by debug

* Use instance attributes in ConfigFlow

Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* Add return type and docstring to init in ConfigFlow

* Add recovery to tests containing errors

* Make NoBluetoothAdapter and NoDevicesFound abort instead of show error

* Change info logs to debug

* Add and change integration type from hub to device

* Use CONF_ADDRESS from homeassistant.const

* Move cover attributes initialization out of constructor

* Change CONF_ADDRESS in tests from const to homeassistant.const

* Remove unused part of tests

* Change 'not motion_device' to 'motion_device is None'

* Change _attr_connection_type to _connection_type

* Add connections to DeviceInfo

* Add model to DeviceInfo and change MotionBlindType values

* Remove identifiers from DeviceInfo

* Move constants from const to library

* Move calibration and running to library, re-add all platforms

* Remove platforms from init

* Remove button platform

* Remove select platform

* Remove sensor platform

* Bump motionblindsble to 0.0.4

* Remove closed, opening and closing attribute default values

Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* Remove CONFIG_SCHEMA from init

Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>

* Remove unused platform attributes and icons

* Re-add _attr_is_closed to GenericBlind to fix error

* Use entry.async_create_background_task for library instead of entry.async_create_task

* Move updating of position on disconnect to library

* Remove type hints, keep for _attr_is_closed

* Use DISPLAY_NAME constant from library for display name

* Add TYPE_CHECKING condition to assert in config_flow

* Re-add CONFIG_SCHEMA to __init__ to pass hassfest

* Change FlowResult type to ConfigFlowResult

* Fix import in tests

* Fix ruff import

* Fix tests by using value of enum

* Use lowercase name of MotionBlindType enum for data schema selector and translation

* Fix using name instead of value for MotionBlindType

* Improve position None handling

Co-authored-by: starkillerOG <starkiller.og@gmail.com>

* Improve tilt None handling

Co-authored-by: starkillerOG <starkiller.og@gmail.com>

* Change BLIND_TO_ENTITY_TYPE name

* Set entity name of cover to None and use DeviceInfo name

* Add base entity

* Move async_update to base entity

* Move unique ID with suffix to base class

* Add entity.py to .coveragerc

* Remove extra state attribute connection type

* Remove separate line hass.data.setdefault(DOMAIN, {})

* Remove use of field for key and translation_key in MotionCoverEntityDescription

* Remove entity translation with extra state_attributes from strings.json

* Use super().__init__(device, entry)

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

* Change if block in async_update_running

* Use if blocks in async_update_position

* Add additional scanner check before show_form

* Remove default value of device_class in MotionCoverEntityDescription

* Fix entry.data[CONF_BLIND_TYPE] uppercase

* Fix device info model name

* Bump motionblindsble to 0.0.5

* Fix tests

* Move entity_description to MotionblindsBLEEntity

* Change double roller blind name

* Bump motionblindsble to 0.0.6

* Fix ruff

* Use status_query for async_update

* Bump motionblindsble to 0.0.7

* Change bluetooth local name

* Set kw_only=True for dataclass

* Change name of GenericBlind

* Change scanner_count conditional

* Wrap async_register_callback in entry.async_on_unload

* Bump motionblindsble to 0.0.8

* Use set_create_task_factory and set_call_later_factory

* Update bluetooth.py generated

* Simplify COVER_TYPES dictionary

* Move registering callbacks to async_added_to_hass

* Remove check for ATTR_POSITION and ATTR_TILT_POSITION in kwargs

* Add naming consistency for device and entry

* Use if block instead of ternary for _attr_unique_id

* Improve errors ternary in config_flow

* Use set instead of list for running_type

* Improve errors ternary in config_flow

* Remove init from MotionblindsBLECoverEntity and move debug log to async_added_to_hass

* Update debug log create cover

* Fix ruff

* Use identity check instead of equals

* Use identity check instead of equals

* Change MotionblindsBLECoverEntityDescription name

* Change debug log text

* Remove ATTR_CONNECTION from const

* Add types for variables in async_setup_entry

* Add types for variables in async_setup_entry

* Change PositionBlind class name to PositionCover etc

* Improve docstrings

* Improve docstrings

---------

Co-authored-by: starkillerOG <starkiller.og@gmail.com>
Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
2024-03-26 09:52:04 +01:00

668 lines
16 KiB
Python

"""Automatically generated file.
To update, run python3 -m script.hassfest
"""
from __future__ import annotations
BLUETOOTH: list[dict[str, bool | str | int | list[int]]] = [
{
"domain": "airthings_ble",
"manufacturer_id": 820,
"service_uuid": "b42e1f6e-ade7-11e4-89d3-123b93f75cba",
},
{
"domain": "airthings_ble",
"manufacturer_id": 820,
"service_uuid": "b42e4a8e-ade7-11e4-89d3-123b93f75cba",
},
{
"domain": "airthings_ble",
"manufacturer_id": 820,
"service_uuid": "b42e1c08-ade7-11e4-89d3-123b93f75cba",
},
{
"domain": "airthings_ble",
"manufacturer_id": 820,
"service_uuid": "b42e3882-ade7-11e4-89d3-123b93f75cba",
},
{
"connectable": False,
"domain": "aranet",
"manufacturer_id": 1794,
"service_uuid": "f0cd1400-95da-4f4b-9ac8-aa55d312af0c",
},
{
"connectable": False,
"domain": "aranet",
"manufacturer_id": 1794,
"service_uuid": "0000fce0-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "bluemaestro",
"manufacturer_id": 307,
},
{
"connectable": False,
"domain": "bthome",
"service_data_uuid": "0000181c-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "bthome",
"service_data_uuid": "0000181e-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "bthome",
"service_data_uuid": "0000fcd2-0000-1000-8000-00805f9b34fb",
},
{
"domain": "dormakaba_dkey",
"service_uuid": "e7a60000-6639-429f-94fd-86de8ea26897",
},
{
"domain": "dormakaba_dkey",
"service_uuid": "e7a60001-6639-429f-94fd-86de8ea26897",
},
{
"domain": "eufylife_ble",
"local_name": "eufy T9140",
},
{
"domain": "eufylife_ble",
"local_name": "eufy T9146",
},
{
"domain": "eufylife_ble",
"local_name": "eufy T9147",
},
{
"domain": "eufylife_ble",
"local_name": "eufy T9148",
},
{
"domain": "eufylife_ble",
"local_name": "eufy T9149",
},
{
"connectable": False,
"domain": "fjaraskupan",
"manufacturer_data_start": [
79,
68,
70,
74,
65,
82,
],
"manufacturer_id": 20296,
},
{
"connectable": True,
"domain": "gardena_bluetooth",
"manufacturer_id": 1062,
"service_uuid": "98bd0001-0b0e-421a-84e5-ddbf75dc6de4",
},
{
"connectable": False,
"domain": "govee_ble",
"local_name": "Govee*",
},
{
"connectable": False,
"domain": "govee_ble",
"local_name": "GVH5*",
},
{
"connectable": False,
"domain": "govee_ble",
"local_name": "B5178*",
},
{
"connectable": False,
"domain": "govee_ble",
"manufacturer_id": 1,
"service_uuid": "0000ec88-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "govee_ble",
"manufacturer_id": 6966,
"service_uuid": "00008451-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "govee_ble",
"manufacturer_id": 63391,
"service_uuid": "00008351-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "govee_ble",
"manufacturer_id": 26589,
"service_uuid": "00008351-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "govee_ble",
"manufacturer_id": 57391,
"service_uuid": "00008351-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "govee_ble",
"manufacturer_id": 18994,
"service_uuid": "00008551-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "govee_ble",
"manufacturer_id": 818,
"service_uuid": "00008551-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "govee_ble",
"manufacturer_id": 53579,
"service_uuid": "00008151-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "govee_ble",
"manufacturer_id": 43682,
"service_uuid": "00008151-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "govee_ble",
"manufacturer_id": 59970,
"service_uuid": "00008151-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "govee_ble",
"manufacturer_id": 63585,
"service_uuid": "00008151-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "govee_ble",
"manufacturer_id": 14474,
"service_uuid": "00008151-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "govee_ble",
"manufacturer_id": 10032,
"service_uuid": "00008251-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "govee_ble",
"manufacturer_id": 19506,
"service_uuid": "00001801-0000-1000-8000-00805f9b34fb",
},
{
"domain": "homekit_controller",
"manufacturer_data_start": [
6,
],
"manufacturer_id": 76,
},
{
"domain": "ibeacon",
"manufacturer_data_start": [
2,
21,
],
"manufacturer_id": 76,
},
{
"domain": "idasen_desk",
"service_uuid": "99fa0001-338a-1024-8a49-009c0215f78a",
},
{
"domain": "improv_ble",
"service_data_uuid": "00004677-0000-1000-8000-00805f9b34fb",
"service_uuid": "00467768-6228-2272-4663-277478268000",
},
{
"connectable": False,
"domain": "inkbird",
"local_name": "sps",
},
{
"connectable": False,
"domain": "inkbird",
"local_name": "Inkbird*",
},
{
"connectable": False,
"domain": "inkbird",
"local_name": "iBBQ*",
},
{
"connectable": False,
"domain": "inkbird",
"local_name": "xBBQ*",
},
{
"connectable": False,
"domain": "inkbird",
"local_name": "tps",
},
{
"connectable": False,
"domain": "kegtron",
"manufacturer_id": 65535,
},
{
"domain": "keymitt_ble",
"service_uuid": "0000abcd-0000-1000-8000-00805f9b34fb",
},
{
"domain": "keymitt_ble",
"local_name": "mib*",
},
{
"domain": "lamarzocco",
"local_name": "MICRA_*",
},
{
"domain": "lamarzocco",
"local_name": "MINI_*",
},
{
"domain": "lamarzocco",
"local_name": "GS3_*",
},
{
"domain": "lamarzocco",
"local_name": "GS3AV_*",
},
{
"domain": "ld2410_ble",
"local_name": "HLK-LD2410B_*",
},
{
"domain": "ld2410_ble",
"local_name": "HLK-LD2410_*",
},
{
"domain": "ld2410_ble",
"manufacturer_data_start": [
7,
1,
],
"manufacturer_id": 256,
"service_uuid": "0000af30-0000-1000-8000-00805f9b34fb",
},
{
"domain": "led_ble",
"local_name": "LEDnet*",
},
{
"domain": "led_ble",
"local_name": "BLE-LED*",
},
{
"domain": "led_ble",
"local_name": "LEDBLE*",
},
{
"domain": "led_ble",
"local_name": "Triones*",
},
{
"domain": "led_ble",
"local_name": "LEDBlue*",
},
{
"domain": "led_ble",
"local_name": "Dream~*",
},
{
"domain": "led_ble",
"local_name": "QHM-*",
},
{
"domain": "led_ble",
"local_name": "AP-*",
},
{
"domain": "medcom_ble",
"service_uuid": "39b31fec-b63a-4ef7-b163-a7317872007f",
},
{
"domain": "melnor",
"manufacturer_data_start": [
89,
],
"manufacturer_id": 13,
},
{
"connectable": False,
"domain": "moat",
"local_name": "Moat_S*",
},
{
"connectable": False,
"domain": "mopeka",
"manufacturer_data_start": [
3,
],
"manufacturer_id": 89,
"service_uuid": "0000fee5-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "mopeka",
"manufacturer_data_start": [
4,
],
"manufacturer_id": 89,
"service_uuid": "0000fee5-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "mopeka",
"manufacturer_data_start": [
5,
],
"manufacturer_id": 89,
"service_uuid": "0000fee5-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "mopeka",
"manufacturer_data_start": [
6,
],
"manufacturer_id": 89,
"service_uuid": "0000fee5-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "mopeka",
"manufacturer_data_start": [
8,
],
"manufacturer_id": 89,
"service_uuid": "0000fee5-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "mopeka",
"manufacturer_data_start": [
9,
],
"manufacturer_id": 89,
"service_uuid": "0000fee5-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "mopeka",
"manufacturer_data_start": [
10,
],
"manufacturer_id": 89,
"service_uuid": "0000fee5-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "mopeka",
"manufacturer_data_start": [
11,
],
"manufacturer_id": 89,
"service_uuid": "0000fee5-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "mopeka",
"manufacturer_data_start": [
12,
],
"manufacturer_id": 89,
"service_uuid": "0000fee5-0000-1000-8000-00805f9b34fb",
},
{
"connectable": True,
"domain": "motionblinds_ble",
"local_name": "MOTION_*",
},
{
"domain": "oralb",
"manufacturer_id": 220,
},
{
"connectable": False,
"domain": "qingping",
"local_name": "Qingping*",
},
{
"connectable": False,
"domain": "qingping",
"local_name": "Lee Guitars*",
},
{
"connectable": False,
"domain": "qingping",
"service_data_uuid": "0000fdcd-0000-1000-8000-00805f9b34fb",
},
{
"domain": "rapt_ble",
"manufacturer_data_start": [
80,
84,
],
"manufacturer_id": 16722,
},
{
"domain": "rapt_ble",
"manufacturer_data_start": [
71,
],
"manufacturer_id": 17739,
},
{
"connectable": False,
"domain": "ruuvitag_ble",
"manufacturer_id": 1177,
},
{
"connectable": False,
"domain": "ruuvitag_ble",
"local_name": "Ruuvi *",
},
{
"connectable": False,
"domain": "sensirion_ble",
"manufacturer_id": 1749,
},
{
"connectable": False,
"domain": "sensirion_ble",
"local_name": "MyCO2*",
},
{
"connectable": False,
"domain": "sensorpro",
"manufacturer_data_start": [
1,
1,
164,
193,
],
"manufacturer_id": 43605,
},
{
"connectable": False,
"domain": "sensorpro",
"manufacturer_data_start": [
1,
5,
164,
193,
],
"manufacturer_id": 43605,
},
{
"connectable": False,
"domain": "sensorpush",
"local_name": "SensorPush*",
},
{
"connectable": False,
"domain": "sensorpush",
"local_name": "s",
"service_uuid": "ef090000-11d6-42ba-93b8-9dd7ec090aa9",
},
{
"domain": "snooz",
"local_name": "Snooz*",
},
{
"domain": "snooz",
"service_uuid": "729f0608-496a-47fe-a124-3a62aaa3fbc0",
},
{
"connectable": False,
"domain": "switchbot",
"service_data_uuid": "00000d00-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "switchbot",
"service_data_uuid": "0000fd3d-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "switchbot",
"service_uuid": "cba20d00-224d-11e6-9fb8-0002a5d5c51b",
},
{
"connectable": False,
"domain": "switchbot",
"manufacturer_id": 2409,
},
{
"connectable": True,
"domain": "switchbot",
"manufacturer_id": 89,
},
{
"connectable": True,
"domain": "switchbot",
"manufacturer_id": 741,
},
{
"connectable": False,
"domain": "thermobeacon",
"manufacturer_data_start": [
0,
],
"manufacturer_id": 16,
"service_uuid": "0000fff0-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "thermobeacon",
"manufacturer_data_start": [
0,
],
"manufacturer_id": 17,
"service_uuid": "0000fff0-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "thermobeacon",
"manufacturer_data_start": [
0,
],
"manufacturer_id": 21,
"service_uuid": "0000fff0-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "thermobeacon",
"manufacturer_data_start": [
0,
],
"manufacturer_id": 24,
"service_uuid": "0000fff0-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "thermobeacon",
"manufacturer_data_start": [
0,
],
"manufacturer_id": 27,
"service_uuid": "0000fff0-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "thermobeacon",
"local_name": "ThermoBeacon",
},
{
"connectable": False,
"domain": "thermopro",
"local_name": "TP35*",
},
{
"connectable": False,
"domain": "thermopro",
"local_name": "TP39*",
},
{
"connectable": False,
"domain": "thermopro",
"local_name": "TP96*",
},
{
"connectable": False,
"domain": "thermopro",
"local_name": "TP97*",
},
{
"domain": "tilt_ble",
"manufacturer_data_start": [
2,
21,
164,
149,
187,
],
"manufacturer_id": 76,
},
{
"connectable": False,
"domain": "xiaomi_ble",
"service_data_uuid": "0000181b-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "xiaomi_ble",
"service_data_uuid": "0000181d-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "xiaomi_ble",
"service_data_uuid": "0000fd50-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "xiaomi_ble",
"service_data_uuid": "0000fe95-0000-1000-8000-00805f9b34fb",
},
{
"domain": "yalexs_ble",
"manufacturer_id": 465,
"service_uuid": "0000fe24-0000-1000-8000-00805f9b34fb",
},
]