Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions homeassistant/components/airthings_ble/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,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

Expand All @@ -41,7 +40,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."""
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/airthings_ble/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
6 changes: 2 additions & 4 deletions homeassistant/components/airthings_ble/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from homeassistant.const import (
CONCENTRATION_PARTS_PER_BILLION,
CONCENTRATION_PARTS_PER_MILLION,
LIGHT_LUX,
PERCENTAGE,
EntityCategory,
Platform,
Expand Down Expand Up @@ -107,8 +106,7 @@
),
"illuminance": SensorEntityDescription(
key="illuminance",
device_class=SensorDeviceClass.ILLUMINANCE,
native_unit_of_measurement=LIGHT_LUX,
native_unit_of_measurement=PERCENTAGE,
state_class=SensorStateClass.MEASUREMENT,
),
}
Expand Down Expand Up @@ -223,7 +221,7 @@ def __init__(
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
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,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
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,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
Expand Down
9 changes: 6 additions & 3 deletions tests/components/airthings_ble/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@

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
Expand Down Expand Up @@ -162,8 +166,7 @@ def patch_airthings_device_update():
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={
Expand Down
8 changes: 3 additions & 5 deletions tests/components/airthings_ble/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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
Expand All @@ -29,8 +29,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",
)
Expand Down Expand Up @@ -112,8 +111,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",
)
Expand Down