diff --git a/homeassistant/components/airthings_ble/__init__.py b/homeassistant/components/airthings_ble/__init__.py index 3a97813741b..8258f7baf3d 100644 --- a/homeassistant/components/airthings_ble/__init__.py +++ b/homeassistant/components/airthings_ble/__init__.py @@ -27,7 +27,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: hass.data.setdefault(DOMAIN, {}) address = entry.unique_id - elevation = hass.config.elevation is_metric = hass.config.units is METRIC_SYSTEM assert address is not None @@ -40,7 +39,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: f"Could not find Airthings device with address {address}" ) - airthings = AirthingsBluetoothDeviceData(_LOGGER, elevation, is_metric) + airthings = AirthingsBluetoothDeviceData(_LOGGER, is_metric) async def _async_update_method() -> AirthingsDevice: """Get data from Airthings BLE.""" diff --git a/homeassistant/components/airthings_ble/manifest.json b/homeassistant/components/airthings_ble/manifest.json index 97e27793da2..3f7bd02a33e 100644 --- a/homeassistant/components/airthings_ble/manifest.json +++ b/homeassistant/components/airthings_ble/manifest.json @@ -24,5 +24,5 @@ "dependencies": ["bluetooth_adapters"], "documentation": "https://www.home-assistant.io/integrations/airthings_ble", "iot_class": "local_polling", - "requirements": ["airthings-ble==0.6.1"] + "requirements": ["airthings-ble==0.7.1"] } diff --git a/homeassistant/components/airthings_ble/sensor.py b/homeassistant/components/airthings_ble/sensor.py index 39c55e0b465..2bc2d5e726a 100644 --- a/homeassistant/components/airthings_ble/sensor.py +++ b/homeassistant/components/airthings_ble/sensor.py @@ -16,7 +16,6 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( CONCENTRATION_PARTS_PER_BILLION, CONCENTRATION_PARTS_PER_MILLION, - LIGHT_LUX, PERCENTAGE, EntityCategory, Platform, @@ -106,8 +105,7 @@ SENSORS_MAPPING_TEMPLATE: dict[str, SensorEntityDescription] = { ), "illuminance": SensorEntityDescription( key="illuminance", - device_class=SensorDeviceClass.ILLUMINANCE, - native_unit_of_measurement=LIGHT_LUX, + native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, ), } @@ -222,7 +220,7 @@ class AirthingsSensor( manufacturer=airthings_device.manufacturer, hw_version=airthings_device.hw_version, sw_version=airthings_device.sw_version, - model=airthings_device.model, + model=airthings_device.model.name, ) @property diff --git a/requirements_all.txt b/requirements_all.txt index 4a3121d78cf..629b029cbbf 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -419,7 +419,7 @@ aioymaps==1.2.2 airly==1.1.0 # homeassistant.components.airthings_ble -airthings-ble==0.6.1 +airthings-ble==0.7.1 # homeassistant.components.airthings airthings-cloud==0.2.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index f2b42cd3a36..e9d63c8612e 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -392,7 +392,7 @@ aioymaps==1.2.2 airly==1.1.0 # homeassistant.components.airthings_ble -airthings-ble==0.6.1 +airthings-ble==0.7.1 # homeassistant.components.airthings airthings-cloud==0.2.0 diff --git a/tests/components/airthings_ble/__init__.py b/tests/components/airthings_ble/__init__.py index 231ec12cb5f..50e3e0069bb 100644 --- a/tests/components/airthings_ble/__init__.py +++ b/tests/components/airthings_ble/__init__.py @@ -3,7 +3,11 @@ from __future__ import annotations from unittest.mock import patch -from airthings_ble import AirthingsBluetoothDeviceData, AirthingsDevice +from airthings_ble import ( + AirthingsBluetoothDeviceData, + AirthingsDevice, + AirthingsDeviceType, +) from homeassistant.components.airthings_ble.const import DOMAIN from homeassistant.components.bluetooth.models import BluetoothServiceInfoBleak @@ -161,8 +165,7 @@ WAVE_DEVICE_INFO = AirthingsDevice( manufacturer="Airthings AS", hw_version="REV A", sw_version="G-BLE-1.5.3-master+0", - model="Wave Plus", - model_raw="2930", + model=AirthingsDeviceType.WAVE_PLUS, name="Airthings Wave+", identifier="123456", sensors={ diff --git a/tests/components/airthings_ble/test_config_flow.py b/tests/components/airthings_ble/test_config_flow.py index 65ec91e69c2..2f20d889a85 100644 --- a/tests/components/airthings_ble/test_config_flow.py +++ b/tests/components/airthings_ble/test_config_flow.py @@ -1,7 +1,7 @@ """Test the Airthings BLE config flow.""" from unittest.mock import patch -from airthings_ble import AirthingsDevice +from airthings_ble import AirthingsDevice, AirthingsDeviceType from bleak import BleakError from homeassistant.components.airthings_ble.const import DOMAIN @@ -28,8 +28,7 @@ async def test_bluetooth_discovery(hass: HomeAssistant) -> None: with patch_async_ble_device_from_address(WAVE_SERVICE_INFO), patch_airthings_ble( AirthingsDevice( manufacturer="Airthings AS", - model="Wave Plus", - model_raw="2930", + model=AirthingsDeviceType.WAVE_PLUS, name="Airthings Wave Plus", identifier="123456", ) @@ -111,8 +110,7 @@ async def test_user_setup(hass: HomeAssistant) -> None: ), patch_async_ble_device_from_address(WAVE_SERVICE_INFO), patch_airthings_ble( AirthingsDevice( manufacturer="Airthings AS", - model="Wave Plus", - model_raw="2930", + model=AirthingsDeviceType.WAVE_PLUS, name="Airthings Wave Plus", identifier="123456", )