Avoid mutating entity descriptions in airthings_ble (#105627)
This commit is contained in:
parent
7ab003c746
commit
2d59eba4c7
1 changed files with 6 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
"""Support for airthings ble sensors."""
|
"""Support for airthings ble sensors."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import dataclasses
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from airthings_ble import AirthingsDevice
|
from airthings_ble import AirthingsDevice
|
||||||
|
@ -167,10 +168,13 @@ async def async_setup_entry(
|
||||||
# we need to change some units
|
# we need to change some units
|
||||||
sensors_mapping = SENSORS_MAPPING_TEMPLATE.copy()
|
sensors_mapping = SENSORS_MAPPING_TEMPLATE.copy()
|
||||||
if not is_metric:
|
if not is_metric:
|
||||||
for val in sensors_mapping.values():
|
for key, val in sensors_mapping.items():
|
||||||
if val.native_unit_of_measurement is not VOLUME_BECQUEREL:
|
if val.native_unit_of_measurement is not VOLUME_BECQUEREL:
|
||||||
continue
|
continue
|
||||||
val.native_unit_of_measurement = VOLUME_PICOCURIE
|
sensors_mapping[key] = dataclasses.replace(
|
||||||
|
val,
|
||||||
|
native_unit_of_measurement=VOLUME_PICOCURIE,
|
||||||
|
)
|
||||||
|
|
||||||
entities = []
|
entities = []
|
||||||
_LOGGER.debug("got sensors: %s", coordinator.data.sensors)
|
_LOGGER.debug("got sensors: %s", coordinator.data.sensors)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue