mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 07:37:34 +00:00
Avoid mutating entity descriptions in onewire (#105970)
This commit is contained in:
parent
57a6effd70
commit
7a9e303e20
@ -2,8 +2,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Callable, Mapping
|
||||
import copy
|
||||
from dataclasses import dataclass
|
||||
import dataclasses
|
||||
import logging
|
||||
import os
|
||||
from types import MappingProxyType
|
||||
@ -43,7 +42,7 @@ from .onewire_entities import OneWireEntity, OneWireEntityDescription
|
||||
from .onewirehub import OneWireHub
|
||||
|
||||
|
||||
@dataclass
|
||||
@dataclasses.dataclass
|
||||
class OneWireSensorEntityDescription(OneWireEntityDescription, SensorEntityDescription):
|
||||
"""Class describing OneWire sensor entities."""
|
||||
|
||||
@ -393,10 +392,12 @@ def get_entities(
|
||||
).decode()
|
||||
)
|
||||
if is_leaf:
|
||||
description = copy.deepcopy(description)
|
||||
description.device_class = SensorDeviceClass.HUMIDITY
|
||||
description.native_unit_of_measurement = PERCENTAGE
|
||||
description.translation_key = f"wetness_{s_id}"
|
||||
description = dataclasses.replace(
|
||||
description,
|
||||
device_class=SensorDeviceClass.HUMIDITY,
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
translation_key=f"wetness_{s_id}",
|
||||
)
|
||||
_LOGGER.info(description.translation_key)
|
||||
override_key = None
|
||||
if description.override_key:
|
||||
|
Loading…
x
Reference in New Issue
Block a user