Use entity name translations in 1-wire (#90696)

* Use entity name translations in onewire

* Adjust binary sensors

* Adjust switches

* Cleanup
This commit is contained in:
epenet 2023-04-03 19:07:02 +02:00 committed by GitHub
parent 9d508ac7ae
commit 2d1bb6135c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 310 additions and 88 deletions

View File

@ -37,8 +37,8 @@ DEVICE_BINARY_SENSORS: dict[str, tuple[OneWireBinarySensorEntityDescription, ...
OneWireBinarySensorEntityDescription( OneWireBinarySensorEntityDescription(
key=f"sensed.{id}", key=f"sensed.{id}",
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
name=f"Sensed {id}",
read_mode=READ_MODE_BOOL, read_mode=READ_MODE_BOOL,
translation_key=f"sensed_{id.lower()}",
) )
for id in DEVICE_KEYS_A_B for id in DEVICE_KEYS_A_B
), ),
@ -46,8 +46,8 @@ DEVICE_BINARY_SENSORS: dict[str, tuple[OneWireBinarySensorEntityDescription, ...
OneWireBinarySensorEntityDescription( OneWireBinarySensorEntityDescription(
key=f"sensed.{id}", key=f"sensed.{id}",
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
name=f"Sensed {id}",
read_mode=READ_MODE_BOOL, read_mode=READ_MODE_BOOL,
translation_key=f"sensed_{id}",
) )
for id in DEVICE_KEYS_0_7 for id in DEVICE_KEYS_0_7
), ),
@ -55,8 +55,8 @@ DEVICE_BINARY_SENSORS: dict[str, tuple[OneWireBinarySensorEntityDescription, ...
OneWireBinarySensorEntityDescription( OneWireBinarySensorEntityDescription(
key=f"sensed.{id}", key=f"sensed.{id}",
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
name=f"Sensed {id}",
read_mode=READ_MODE_BOOL, read_mode=READ_MODE_BOOL,
translation_key=f"sensed_{id.lower()}",
) )
for id in DEVICE_KEYS_A_B for id in DEVICE_KEYS_A_B
), ),
@ -69,10 +69,10 @@ HOBBYBOARD_EF: dict[str, tuple[OneWireBinarySensorEntityDescription, ...]] = {
OneWireBinarySensorEntityDescription( OneWireBinarySensorEntityDescription(
key=f"hub/short.{id}", key=f"hub/short.{id}",
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
name=f"Hub Short on Branch {id}",
read_mode=READ_MODE_BOOL, read_mode=READ_MODE_BOOL,
entity_category=EntityCategory.DIAGNOSTIC, entity_category=EntityCategory.DIAGNOSTIC,
device_class=BinarySensorDeviceClass.PROBLEM, device_class=BinarySensorDeviceClass.PROBLEM,
translation_key=f"hub_short_{id}",
) )
for id in DEVICE_KEYS_0_3 for id in DEVICE_KEYS_0_3
), ),
@ -120,14 +120,12 @@ def get_entities(onewire_hub: OneWireHub) -> list[OneWireBinarySensor]:
continue continue
for description in get_sensor_types(device_sub_type)[family]: for description in get_sensor_types(device_sub_type)[family]:
device_file = os.path.join(os.path.split(device.path)[0], description.key) device_file = os.path.join(os.path.split(device.path)[0], description.key)
name = f"{device_id} {description.name}"
entities.append( entities.append(
OneWireBinarySensor( OneWireBinarySensor(
description=description, description=description,
device_id=device_id, device_id=device_id,
device_file=device_file, device_file=device_file,
device_info=device_info, device_info=device_info,
name=name,
owproxy=onewire_hub.owproxy, owproxy=onewire_hub.owproxy,
) )
) )

View File

@ -27,6 +27,7 @@ class OneWireEntity(Entity):
"""Implementation of a 1-Wire entity.""" """Implementation of a 1-Wire entity."""
entity_description: OneWireEntityDescription entity_description: OneWireEntityDescription
_attr_has_entity_name = True
def __init__( def __init__(
self, self,
@ -34,7 +35,6 @@ class OneWireEntity(Entity):
device_id: str, device_id: str,
device_info: DeviceInfo, device_info: DeviceInfo,
device_file: str, device_file: str,
name: str,
owproxy: protocol._Proxy, owproxy: protocol._Proxy,
) -> None: ) -> None:
"""Initialize the entity.""" """Initialize the entity."""
@ -42,7 +42,6 @@ class OneWireEntity(Entity):
self._last_update_success = True self._last_update_success = True
self._attr_unique_id = f"/{device_id}/{description.key}" self._attr_unique_id = f"/{device_id}/{description.key}"
self._attr_device_info = device_info self._attr_device_info = device_info
self._attr_name = name
self._device_file = device_file self._device_file = device_file
self._state: StateType = None self._state: StateType = None
self._value_raw: float | None = None self._value_raw: float | None = None

View File

@ -70,10 +70,10 @@ def _get_sensor_precision_family_28(device_id: str, options: Mapping[str, Any])
SIMPLE_TEMPERATURE_SENSOR_DESCRIPTION = OneWireSensorEntityDescription( SIMPLE_TEMPERATURE_SENSOR_DESCRIPTION = OneWireSensorEntityDescription(
key="temperature", key="temperature",
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
name="Temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS, native_unit_of_measurement=UnitOfTemperature.CELSIUS,
read_mode=READ_MODE_FLOAT, read_mode=READ_MODE_FLOAT,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
translation_key="temperature",
) )
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -86,19 +86,19 @@ DEVICE_SENSORS: dict[str, tuple[OneWireSensorEntityDescription, ...]] = {
key="TAI8570/temperature", key="TAI8570/temperature",
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
name="Temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS, native_unit_of_measurement=UnitOfTemperature.CELSIUS,
read_mode=READ_MODE_FLOAT, read_mode=READ_MODE_FLOAT,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
translation_key="temperature",
), ),
OneWireSensorEntityDescription( OneWireSensorEntityDescription(
key="TAI8570/pressure", key="TAI8570/pressure",
device_class=SensorDeviceClass.PRESSURE, device_class=SensorDeviceClass.PRESSURE,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
name="Pressure",
native_unit_of_measurement=UnitOfPressure.MBAR, native_unit_of_measurement=UnitOfPressure.MBAR,
read_mode=READ_MODE_FLOAT, read_mode=READ_MODE_FLOAT,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
translation_key="pressure",
), ),
), ),
"22": (SIMPLE_TEMPERATURE_SENSOR_DESCRIPTION,), "22": (SIMPLE_TEMPERATURE_SENSOR_DESCRIPTION,),
@ -108,102 +108,102 @@ DEVICE_SENSORS: dict[str, tuple[OneWireSensorEntityDescription, ...]] = {
key="humidity", key="humidity",
device_class=SensorDeviceClass.HUMIDITY, device_class=SensorDeviceClass.HUMIDITY,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
name="Humidity",
native_unit_of_measurement=PERCENTAGE, native_unit_of_measurement=PERCENTAGE,
read_mode=READ_MODE_FLOAT, read_mode=READ_MODE_FLOAT,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
translation_key="humidity",
), ),
OneWireSensorEntityDescription( OneWireSensorEntityDescription(
key="HIH3600/humidity", key="HIH3600/humidity",
device_class=SensorDeviceClass.HUMIDITY, device_class=SensorDeviceClass.HUMIDITY,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
name="Humidity HIH3600",
native_unit_of_measurement=PERCENTAGE, native_unit_of_measurement=PERCENTAGE,
read_mode=READ_MODE_FLOAT, read_mode=READ_MODE_FLOAT,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
translation_key="humidity_hih3600",
), ),
OneWireSensorEntityDescription( OneWireSensorEntityDescription(
key="HIH4000/humidity", key="HIH4000/humidity",
device_class=SensorDeviceClass.HUMIDITY, device_class=SensorDeviceClass.HUMIDITY,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
name="Humidity HIH4000",
native_unit_of_measurement=PERCENTAGE, native_unit_of_measurement=PERCENTAGE,
read_mode=READ_MODE_FLOAT, read_mode=READ_MODE_FLOAT,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
translation_key="humidity_hih4000",
), ),
OneWireSensorEntityDescription( OneWireSensorEntityDescription(
key="HIH5030/humidity", key="HIH5030/humidity",
device_class=SensorDeviceClass.HUMIDITY, device_class=SensorDeviceClass.HUMIDITY,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
name="Humidity HIH5030",
native_unit_of_measurement=PERCENTAGE, native_unit_of_measurement=PERCENTAGE,
read_mode=READ_MODE_FLOAT, read_mode=READ_MODE_FLOAT,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
translation_key="humidity_hih5030",
), ),
OneWireSensorEntityDescription( OneWireSensorEntityDescription(
key="HTM1735/humidity", key="HTM1735/humidity",
device_class=SensorDeviceClass.HUMIDITY, device_class=SensorDeviceClass.HUMIDITY,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
name="Humidity HTM1735",
native_unit_of_measurement=PERCENTAGE, native_unit_of_measurement=PERCENTAGE,
read_mode=READ_MODE_FLOAT, read_mode=READ_MODE_FLOAT,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
translation_key="humidity_htm1735",
), ),
OneWireSensorEntityDescription( OneWireSensorEntityDescription(
key="B1-R1-A/pressure", key="B1-R1-A/pressure",
device_class=SensorDeviceClass.PRESSURE, device_class=SensorDeviceClass.PRESSURE,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
name="Pressure",
native_unit_of_measurement=UnitOfPressure.MBAR, native_unit_of_measurement=UnitOfPressure.MBAR,
read_mode=READ_MODE_FLOAT, read_mode=READ_MODE_FLOAT,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
translation_key="pressure",
), ),
OneWireSensorEntityDescription( OneWireSensorEntityDescription(
key="S3-R1-A/illuminance", key="S3-R1-A/illuminance",
device_class=SensorDeviceClass.ILLUMINANCE, device_class=SensorDeviceClass.ILLUMINANCE,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
name="Illuminance",
native_unit_of_measurement=LIGHT_LUX, native_unit_of_measurement=LIGHT_LUX,
read_mode=READ_MODE_FLOAT, read_mode=READ_MODE_FLOAT,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
translation_key="illuminance",
), ),
OneWireSensorEntityDescription( OneWireSensorEntityDescription(
key="VAD", key="VAD",
device_class=SensorDeviceClass.VOLTAGE, device_class=SensorDeviceClass.VOLTAGE,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
name="Voltage VAD",
native_unit_of_measurement=UnitOfElectricPotential.VOLT, native_unit_of_measurement=UnitOfElectricPotential.VOLT,
read_mode=READ_MODE_FLOAT, read_mode=READ_MODE_FLOAT,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
translation_key="voltage_vad",
), ),
OneWireSensorEntityDescription( OneWireSensorEntityDescription(
key="VDD", key="VDD",
device_class=SensorDeviceClass.VOLTAGE, device_class=SensorDeviceClass.VOLTAGE,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
name="Voltage VDD",
native_unit_of_measurement=UnitOfElectricPotential.VOLT, native_unit_of_measurement=UnitOfElectricPotential.VOLT,
read_mode=READ_MODE_FLOAT, read_mode=READ_MODE_FLOAT,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
translation_key="voltage_vdd",
), ),
OneWireSensorEntityDescription( OneWireSensorEntityDescription(
key="vis", key="vis",
device_class=SensorDeviceClass.VOLTAGE, device_class=SensorDeviceClass.VOLTAGE,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
name="vis",
native_unit_of_measurement=UnitOfElectricPotential.VOLT, native_unit_of_measurement=UnitOfElectricPotential.VOLT,
read_mode=READ_MODE_FLOAT, read_mode=READ_MODE_FLOAT,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
translation_key="voltage_vis",
), ),
), ),
"28": ( "28": (
OneWireSensorEntityDescription( OneWireSensorEntityDescription(
key="temperature", key="temperature",
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
name="Temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS, native_unit_of_measurement=UnitOfTemperature.CELSIUS,
override_key=_get_sensor_precision_family_28, override_key=_get_sensor_precision_family_28,
read_mode=READ_MODE_FLOAT, read_mode=READ_MODE_FLOAT,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
translation_key="temperature",
), ),
), ),
"30": ( "30": (
@ -212,29 +212,29 @@ DEVICE_SENSORS: dict[str, tuple[OneWireSensorEntityDescription, ...]] = {
key="typeX/temperature", key="typeX/temperature",
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
name="Thermocouple temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS, native_unit_of_measurement=UnitOfTemperature.CELSIUS,
read_mode=READ_MODE_FLOAT, read_mode=READ_MODE_FLOAT,
override_key=lambda d, o: "typeK/temperature", override_key=lambda d, o: "typeK/temperature",
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
translation_key="thermocouple_temperature_k",
), ),
OneWireSensorEntityDescription( OneWireSensorEntityDescription(
key="volt", key="volt",
device_class=SensorDeviceClass.VOLTAGE, device_class=SensorDeviceClass.VOLTAGE,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
name="Voltage",
native_unit_of_measurement=UnitOfElectricPotential.VOLT, native_unit_of_measurement=UnitOfElectricPotential.VOLT,
read_mode=READ_MODE_FLOAT, read_mode=READ_MODE_FLOAT,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
translation_key="voltage",
), ),
OneWireSensorEntityDescription( OneWireSensorEntityDescription(
key="vis", key="vis",
device_class=SensorDeviceClass.VOLTAGE, device_class=SensorDeviceClass.VOLTAGE,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
name="vis",
native_unit_of_measurement=UnitOfElectricPotential.VOLT, native_unit_of_measurement=UnitOfElectricPotential.VOLT,
read_mode=READ_MODE_FLOAT, read_mode=READ_MODE_FLOAT,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
translation_key="voltage_vis_gradient",
), ),
), ),
"3B": (SIMPLE_TEMPERATURE_SENSOR_DESCRIPTION,), "3B": (SIMPLE_TEMPERATURE_SENSOR_DESCRIPTION,),
@ -242,10 +242,10 @@ DEVICE_SENSORS: dict[str, tuple[OneWireSensorEntityDescription, ...]] = {
"1D": tuple( "1D": tuple(
OneWireSensorEntityDescription( OneWireSensorEntityDescription(
key=f"counter.{id}", key=f"counter.{id}",
name=f"Counter {id}",
native_unit_of_measurement="count", native_unit_of_measurement="count",
read_mode=READ_MODE_INT, read_mode=READ_MODE_INT,
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
translation_key=f"counter_{id.lower()}",
) )
for id in DEVICE_KEYS_A_B for id in DEVICE_KEYS_A_B
), ),
@ -258,36 +258,36 @@ HOBBYBOARD_EF: dict[str, tuple[OneWireSensorEntityDescription, ...]] = {
OneWireSensorEntityDescription( OneWireSensorEntityDescription(
key="humidity/humidity_corrected", key="humidity/humidity_corrected",
device_class=SensorDeviceClass.HUMIDITY, device_class=SensorDeviceClass.HUMIDITY,
name="Humidity",
native_unit_of_measurement=PERCENTAGE, native_unit_of_measurement=PERCENTAGE,
read_mode=READ_MODE_FLOAT, read_mode=READ_MODE_FLOAT,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
translation_key="humidity",
), ),
OneWireSensorEntityDescription( OneWireSensorEntityDescription(
key="humidity/humidity_raw", key="humidity/humidity_raw",
device_class=SensorDeviceClass.HUMIDITY, device_class=SensorDeviceClass.HUMIDITY,
name="Humidity Raw",
native_unit_of_measurement=PERCENTAGE, native_unit_of_measurement=PERCENTAGE,
read_mode=READ_MODE_FLOAT, read_mode=READ_MODE_FLOAT,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
translation_key="humidity_raw",
), ),
OneWireSensorEntityDescription( OneWireSensorEntityDescription(
key="humidity/temperature", key="humidity/temperature",
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
name="Temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS, native_unit_of_measurement=UnitOfTemperature.CELSIUS,
read_mode=READ_MODE_FLOAT, read_mode=READ_MODE_FLOAT,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
translation_key="temperature",
), ),
), ),
"HB_MOISTURE_METER": tuple( "HB_MOISTURE_METER": tuple(
OneWireSensorEntityDescription( OneWireSensorEntityDescription(
key=f"moisture/sensor.{id}", key=f"moisture/sensor.{id}",
device_class=SensorDeviceClass.PRESSURE, device_class=SensorDeviceClass.PRESSURE,
name=f"Moisture {id}",
native_unit_of_measurement=UnitOfPressure.CBAR, native_unit_of_measurement=UnitOfPressure.CBAR,
read_mode=READ_MODE_FLOAT, read_mode=READ_MODE_FLOAT,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
translation_key=f"moisture_{id}",
) )
for id in DEVICE_KEYS_0_3 for id in DEVICE_KEYS_0_3
), ),
@ -300,52 +300,52 @@ EDS_SENSORS: dict[str, tuple[OneWireSensorEntityDescription, ...]] = {
OneWireSensorEntityDescription( OneWireSensorEntityDescription(
key="EDS0066/temperature", key="EDS0066/temperature",
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
name="Temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS, native_unit_of_measurement=UnitOfTemperature.CELSIUS,
read_mode=READ_MODE_FLOAT, read_mode=READ_MODE_FLOAT,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
translation_key="temperature",
), ),
OneWireSensorEntityDescription( OneWireSensorEntityDescription(
key="EDS0066/pressure", key="EDS0066/pressure",
device_class=SensorDeviceClass.PRESSURE, device_class=SensorDeviceClass.PRESSURE,
name="Pressure",
native_unit_of_measurement=UnitOfPressure.MBAR, native_unit_of_measurement=UnitOfPressure.MBAR,
read_mode=READ_MODE_FLOAT, read_mode=READ_MODE_FLOAT,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
translation_key="pressure",
), ),
), ),
"EDS0068": ( "EDS0068": (
OneWireSensorEntityDescription( OneWireSensorEntityDescription(
key="EDS0068/temperature", key="EDS0068/temperature",
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
name="Temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS, native_unit_of_measurement=UnitOfTemperature.CELSIUS,
read_mode=READ_MODE_FLOAT, read_mode=READ_MODE_FLOAT,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
translation_key="temperature",
), ),
OneWireSensorEntityDescription( OneWireSensorEntityDescription(
key="EDS0068/pressure", key="EDS0068/pressure",
device_class=SensorDeviceClass.PRESSURE, device_class=SensorDeviceClass.PRESSURE,
name="Pressure",
native_unit_of_measurement=UnitOfPressure.MBAR, native_unit_of_measurement=UnitOfPressure.MBAR,
read_mode=READ_MODE_FLOAT, read_mode=READ_MODE_FLOAT,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
translation_key="pressure",
), ),
OneWireSensorEntityDescription( OneWireSensorEntityDescription(
key="EDS0068/light", key="EDS0068/light",
device_class=SensorDeviceClass.ILLUMINANCE, device_class=SensorDeviceClass.ILLUMINANCE,
name="Illuminance",
native_unit_of_measurement=LIGHT_LUX, native_unit_of_measurement=LIGHT_LUX,
read_mode=READ_MODE_FLOAT, read_mode=READ_MODE_FLOAT,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
translation_key="illuminance",
), ),
OneWireSensorEntityDescription( OneWireSensorEntityDescription(
key="EDS0068/humidity", key="EDS0068/humidity",
device_class=SensorDeviceClass.HUMIDITY, device_class=SensorDeviceClass.HUMIDITY,
name="Humidity",
native_unit_of_measurement=PERCENTAGE, native_unit_of_measurement=PERCENTAGE,
read_mode=READ_MODE_FLOAT, read_mode=READ_MODE_FLOAT,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
translation_key="humidity",
), ),
), ),
} }
@ -412,7 +412,8 @@ def get_entities(
description = copy.deepcopy(description) description = copy.deepcopy(description)
description.device_class = SensorDeviceClass.HUMIDITY description.device_class = SensorDeviceClass.HUMIDITY
description.native_unit_of_measurement = PERCENTAGE description.native_unit_of_measurement = PERCENTAGE
description.name = f"Wetness {s_id}" description.translation_key = f"wetness_{s_id}"
_LOGGER.info(description.translation_key)
override_key = None override_key = None
if description.override_key: if description.override_key:
override_key = description.override_key(device_id, options) override_key = description.override_key(device_id, options)
@ -420,7 +421,6 @@ def get_entities(
os.path.split(device.path)[0], os.path.split(device.path)[0],
override_key or description.key, override_key or description.key,
) )
name = f"{device_id} {description.name}"
if family == "12": if family == "12":
# We need to check if there is TAI8570 plugged in # We need to check if there is TAI8570 plugged in
try: try:
@ -438,7 +438,6 @@ def get_entities(
device_id=device_id, device_id=device_id,
device_file=device_file, device_file=device_file,
device_info=device_info, device_info=device_info,
name=name,
owproxy=onewire_hub.owproxy, owproxy=onewire_hub.owproxy,
) )
) )

View File

@ -16,6 +16,233 @@
} }
} }
}, },
"entity": {
"binary_sensor": {
"sensed_a": {
"name": "Sensed A"
},
"sensed_b": {
"name": "Sensed B"
},
"sensed_0": {
"name": "Sensed 0"
},
"sensed_1": {
"name": "Sensed 1"
},
"sensed_2": {
"name": "Sensed 2"
},
"sensed_3": {
"name": "Sensed 3"
},
"sensed_4": {
"name": "Sensed 4"
},
"sensed_5": {
"name": "Sensed 5"
},
"sensed_6": {
"name": "Sensed 6"
},
"sensed_7": {
"name": "Sensed 7"
},
"hub_short_0": {
"name": "Hub short on branch 0"
},
"hub_short_1": {
"name": "Hub short on branch 1"
},
"hub_short_2": {
"name": "Hub short on branch 2"
},
"hub_short_3": {
"name": "Hub short on branch 3"
}
},
"sensor": {
"counter_a": {
"name": "Counter A"
},
"counter_b": {
"name": "Counter B"
},
"humidity": {
"name": "[%key:component::sensor::entity_component::humidity::name%]"
},
"humidity_hih3600": {
"name": "HIH3600 humidity"
},
"humidity_hih4000": {
"name": "HIH4000 humidity"
},
"humidity_hih5030": {
"name": "HIH5030 humidity"
},
"humidity_htm1735": {
"name": "HTM1735 humidity"
},
"humidity_raw": {
"name": "Raw humidity"
},
"illuminance": {
"name": "[%key:component::sensor::entity_component::illuminance::name%]"
},
"moisture_1": {
"name": "Moisture 1"
},
"moisture_2": {
"name": "Moisture 2"
},
"moisture_3": {
"name": "Moisture 3"
},
"moisture_4": {
"name": "Moisture 4"
},
"pressure": {
"name": "[%key:component::sensor::entity_component::pressure::name%]"
},
"temperature": {
"name": "[%key:component::sensor::entity_component::temperature::name%]"
},
"thermocouple_temperature_k": {
"name": "Thermocouple K temperature"
},
"voltage": {
"name": "[%key:component::sensor::entity_component::voltage::name%]"
},
"voltage_vad": {
"name": "VAD voltage"
},
"voltage_vdd": {
"name": "VDD voltage"
},
"voltage_vis": {
"name": "VIS voltage difference"
},
"voltage_vis_gradient": {
"name": "VIS voltage gradient"
},
"wetness_0": {
"name": "Wetness 0"
},
"wetness_1": {
"name": "Wetness 1"
},
"wetness_2": {
"name": "Wetness 2"
},
"wetness_3": {
"name": "Wetness 3"
}
},
"switch": {
"hub_branch_0": {
"name": "Hub branch 0"
},
"hub_branch_1": {
"name": "Hub branch 1"
},
"hub_branch_2": {
"name": "Hub branch 2"
},
"hub_branch_3": {
"name": "Hub branch 3"
},
"iad": {
"name": "Current A/D control"
},
"latch_0": {
"name": "Latch 0"
},
"latch_1": {
"name": "Latch 1"
},
"latch_2": {
"name": "Latch 2"
},
"latch_3": {
"name": "Latch 3"
},
"latch_4": {
"name": "Latch 4"
},
"latch_5": {
"name": "Latch 5"
},
"latch_6": {
"name": "Latch 6"
},
"latch_7": {
"name": "Latch 7"
},
"latch_a": {
"name": "Latch A"
},
"latch_b": {
"name": "Latch B"
},
"leaf_sensor_0": {
"name": "Leaf sensor 0"
},
"leaf_sensor_1": {
"name": "Leaf sensor 1"
},
"leaf_sensor_2": {
"name": "Leaf sensor 2"
},
"leaf_sensor_3": {
"name": "Leaf sensor 3"
},
"moisture_sensor_0": {
"name": "Moisture sensor 0"
},
"moisture_sensor_1": {
"name": "Moisture sensor 1"
},
"moisture_sensor_2": {
"name": "Moisture sensor 2"
},
"moisture_sensor_3": {
"name": "Moisture sensor 3"
},
"pio": {
"name": "Programmed input-output"
},
"pio_0": {
"name": "Programmed input-output 0"
},
"pio_1": {
"name": "Programmed input-output 1"
},
"pio_2": {
"name": "Programmed input-output 2"
},
"pio_3": {
"name": "Programmed input-output 3"
},
"pio_4": {
"name": "Programmed input-output 4"
},
"pio_5": {
"name": "Programmed input-output 5"
},
"pio_6": {
"name": "Programmed input-output 6"
},
"pio_7": {
"name": "Programmed input-output 7"
},
"pio_a": {
"name": "Programmed input-output A"
},
"pio_b": {
"name": "Programmed input-output B"
}
}
},
"options": { "options": {
"error": { "error": {
"device_not_selected": "Select devices to configure" "device_not_selected": "Select devices to configure"

View File

@ -32,8 +32,8 @@ DEVICE_SWITCHES: dict[str, tuple[OneWireEntityDescription, ...]] = {
OneWireSwitchEntityDescription( OneWireSwitchEntityDescription(
key="PIO", key="PIO",
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
name="PIO",
read_mode=READ_MODE_BOOL, read_mode=READ_MODE_BOOL,
translation_key="pio",
), ),
), ),
"12": tuple( "12": tuple(
@ -41,8 +41,8 @@ DEVICE_SWITCHES: dict[str, tuple[OneWireEntityDescription, ...]] = {
OneWireSwitchEntityDescription( OneWireSwitchEntityDescription(
key=f"PIO.{id}", key=f"PIO.{id}",
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
name=f"PIO {id}",
read_mode=READ_MODE_BOOL, read_mode=READ_MODE_BOOL,
translation_key=f"pio_{id.lower()}",
) )
for id in DEVICE_KEYS_A_B for id in DEVICE_KEYS_A_B
] ]
@ -50,8 +50,8 @@ DEVICE_SWITCHES: dict[str, tuple[OneWireEntityDescription, ...]] = {
OneWireSwitchEntityDescription( OneWireSwitchEntityDescription(
key=f"latch.{id}", key=f"latch.{id}",
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
name=f"Latch {id}",
read_mode=READ_MODE_BOOL, read_mode=READ_MODE_BOOL,
translation_key=f"latch_{id.lower()}",
) )
for id in DEVICE_KEYS_A_B for id in DEVICE_KEYS_A_B
] ]
@ -61,8 +61,8 @@ DEVICE_SWITCHES: dict[str, tuple[OneWireEntityDescription, ...]] = {
key="IAD", key="IAD",
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
name="IAD",
read_mode=READ_MODE_BOOL, read_mode=READ_MODE_BOOL,
translation_key="iad",
), ),
), ),
"29": tuple( "29": tuple(
@ -70,8 +70,8 @@ DEVICE_SWITCHES: dict[str, tuple[OneWireEntityDescription, ...]] = {
OneWireSwitchEntityDescription( OneWireSwitchEntityDescription(
key=f"PIO.{id}", key=f"PIO.{id}",
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
name=f"PIO {id}",
read_mode=READ_MODE_BOOL, read_mode=READ_MODE_BOOL,
translation_key=f"pio_{id}",
) )
for id in DEVICE_KEYS_0_7 for id in DEVICE_KEYS_0_7
] ]
@ -79,8 +79,8 @@ DEVICE_SWITCHES: dict[str, tuple[OneWireEntityDescription, ...]] = {
OneWireSwitchEntityDescription( OneWireSwitchEntityDescription(
key=f"latch.{id}", key=f"latch.{id}",
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
name=f"Latch {id}",
read_mode=READ_MODE_BOOL, read_mode=READ_MODE_BOOL,
translation_key=f"latch_{id}",
) )
for id in DEVICE_KEYS_0_7 for id in DEVICE_KEYS_0_7
] ]
@ -89,8 +89,8 @@ DEVICE_SWITCHES: dict[str, tuple[OneWireEntityDescription, ...]] = {
OneWireSwitchEntityDescription( OneWireSwitchEntityDescription(
key=f"PIO.{id}", key=f"PIO.{id}",
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
name=f"PIO {id}",
read_mode=READ_MODE_BOOL, read_mode=READ_MODE_BOOL,
translation_key=f"pio_{id.lower()}",
) )
for id in DEVICE_KEYS_A_B for id in DEVICE_KEYS_A_B
), ),
@ -104,9 +104,9 @@ HOBBYBOARD_EF: dict[str, tuple[OneWireEntityDescription, ...]] = {
OneWireSwitchEntityDescription( OneWireSwitchEntityDescription(
key=f"hub/branch.{id}", key=f"hub/branch.{id}",
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
name=f"Hub Branch {id} Enable",
read_mode=READ_MODE_BOOL, read_mode=READ_MODE_BOOL,
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
translation_key=f"hub_branch_{id}",
) )
for id in DEVICE_KEYS_0_3 for id in DEVICE_KEYS_0_3
), ),
@ -115,9 +115,9 @@ HOBBYBOARD_EF: dict[str, tuple[OneWireEntityDescription, ...]] = {
OneWireSwitchEntityDescription( OneWireSwitchEntityDescription(
key=f"moisture/is_leaf.{id}", key=f"moisture/is_leaf.{id}",
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
name=f"Leaf Sensor {id} Enable",
read_mode=READ_MODE_BOOL, read_mode=READ_MODE_BOOL,
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
translation_key=f"leaf_sensor_{id}",
) )
for id in DEVICE_KEYS_0_3 for id in DEVICE_KEYS_0_3
] ]
@ -125,9 +125,9 @@ HOBBYBOARD_EF: dict[str, tuple[OneWireEntityDescription, ...]] = {
OneWireSwitchEntityDescription( OneWireSwitchEntityDescription(
key=f"moisture/is_moisture.{id}", key=f"moisture/is_moisture.{id}",
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
name=f"Moisture Sensor {id} Enable",
read_mode=READ_MODE_BOOL, read_mode=READ_MODE_BOOL,
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
translation_key=f"moisture_sensor_{id}",
) )
for id in DEVICE_KEYS_0_3 for id in DEVICE_KEYS_0_3
] ]
@ -177,14 +177,12 @@ def get_entities(onewire_hub: OneWireHub) -> list[OneWireSwitch]:
continue continue
for description in get_sensor_types(device_sub_type)[family]: for description in get_sensor_types(device_sub_type)[family]:
device_file = os.path.join(os.path.split(device.path)[0], description.key) device_file = os.path.join(os.path.split(device.path)[0], description.key)
name = f"{device_id} {description.name}"
entities.append( entities.append(
OneWireSwitch( OneWireSwitch(
description=description, description=description,
device_id=device_id, device_id=device_id,
device_file=device_file, device_file=device_file,
device_info=device_info, device_info=device_info,
name=name,
owproxy=onewire_hub.owproxy, owproxy=onewire_hub.owproxy,
) )
) )

View File

@ -40,6 +40,7 @@ def check_and_enable_disabled_entities(
if expected_entity.get(ATTR_DEFAULT_DISABLED): if expected_entity.get(ATTR_DEFAULT_DISABLED):
entity_id = expected_entity[ATTR_ENTITY_ID] entity_id = expected_entity[ATTR_ENTITY_ID]
registry_entry = entity_registry.entities.get(entity_id) registry_entry = entity_registry.entities.get(entity_id)
assert registry_entry, f"{entity_id} not found in registry"
assert registry_entry.disabled assert registry_entry.disabled
assert registry_entry.disabled_by is RegistryEntryDisabler.INTEGRATION assert registry_entry.disabled_by is RegistryEntryDisabler.INTEGRATION
entity_registry.async_update_entity(entity_id, **{"disabled_by": None}) entity_registry.async_update_entity(entity_id, **{"disabled_by": None})
@ -76,7 +77,7 @@ def check_entities(
for expected_entity in expected_entities: for expected_entity in expected_entities:
entity_id = expected_entity[ATTR_ENTITY_ID] entity_id = expected_entity[ATTR_ENTITY_ID]
registry_entry = entity_registry.entities.get(entity_id) registry_entry = entity_registry.entities.get(entity_id)
assert registry_entry is not None assert registry_entry is not None, f"{entity_id} not found in registry"
assert registry_entry.entity_category == expected_entity.get( assert registry_entry.entity_category == expected_entity.get(
ATTR_ENTITY_CATEGORY ATTR_ENTITY_CATEGORY
) )

View File

@ -70,7 +70,7 @@ MOCK_OWPROXY_DEVICES = {
Platform.SWITCH: [ Platform.SWITCH: [
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_ENTITY_ID: "switch.05_111111111111_pio", ATTR_ENTITY_ID: "switch.05_111111111111_programmed_input_output",
ATTR_INJECT_READS: b" 1", ATTR_INJECT_READS: b" 1",
ATTR_STATE: STATE_ON, ATTR_STATE: STATE_ON,
ATTR_UNIQUE_ID: "/05.111111111111/PIO", ATTR_UNIQUE_ID: "/05.111111111111/PIO",
@ -150,14 +150,14 @@ MOCK_OWPROXY_DEVICES = {
Platform.SWITCH: [ Platform.SWITCH: [
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_ENTITY_ID: "switch.12_111111111111_pio_a", ATTR_ENTITY_ID: "switch.12_111111111111_programmed_input_output_a",
ATTR_INJECT_READS: b" 1", ATTR_INJECT_READS: b" 1",
ATTR_STATE: STATE_ON, ATTR_STATE: STATE_ON,
ATTR_UNIQUE_ID: "/12.111111111111/PIO.A", ATTR_UNIQUE_ID: "/12.111111111111/PIO.A",
}, },
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_ENTITY_ID: "switch.12_111111111111_pio_b", ATTR_ENTITY_ID: "switch.12_111111111111_programmed_input_output_b",
ATTR_INJECT_READS: b" 0", ATTR_INJECT_READS: b" 0",
ATTR_STATE: STATE_OFF, ATTR_STATE: STATE_OFF,
ATTR_UNIQUE_ID: "/12.111111111111/PIO.B", ATTR_UNIQUE_ID: "/12.111111111111/PIO.B",
@ -312,7 +312,7 @@ MOCK_OWPROXY_DEVICES = {
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_DEVICE_CLASS: SensorDeviceClass.HUMIDITY, ATTR_DEVICE_CLASS: SensorDeviceClass.HUMIDITY,
ATTR_ENTITY_ID: "sensor.26_111111111111_humidity_hih3600", ATTR_ENTITY_ID: "sensor.26_111111111111_hih3600_humidity",
ATTR_INJECT_READS: b" 73.7563", ATTR_INJECT_READS: b" 73.7563",
ATTR_STATE: "73.8", ATTR_STATE: "73.8",
ATTR_STATE_CLASS: SensorStateClass.MEASUREMENT, ATTR_STATE_CLASS: SensorStateClass.MEASUREMENT,
@ -322,7 +322,7 @@ MOCK_OWPROXY_DEVICES = {
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_DEVICE_CLASS: SensorDeviceClass.HUMIDITY, ATTR_DEVICE_CLASS: SensorDeviceClass.HUMIDITY,
ATTR_ENTITY_ID: "sensor.26_111111111111_humidity_hih4000", ATTR_ENTITY_ID: "sensor.26_111111111111_hih4000_humidity",
ATTR_INJECT_READS: b" 74.7563", ATTR_INJECT_READS: b" 74.7563",
ATTR_STATE: "74.8", ATTR_STATE: "74.8",
ATTR_STATE_CLASS: SensorStateClass.MEASUREMENT, ATTR_STATE_CLASS: SensorStateClass.MEASUREMENT,
@ -332,7 +332,7 @@ MOCK_OWPROXY_DEVICES = {
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_DEVICE_CLASS: SensorDeviceClass.HUMIDITY, ATTR_DEVICE_CLASS: SensorDeviceClass.HUMIDITY,
ATTR_ENTITY_ID: "sensor.26_111111111111_humidity_hih5030", ATTR_ENTITY_ID: "sensor.26_111111111111_hih5030_humidity",
ATTR_INJECT_READS: b" 75.7563", ATTR_INJECT_READS: b" 75.7563",
ATTR_STATE: "75.8", ATTR_STATE: "75.8",
ATTR_STATE_CLASS: SensorStateClass.MEASUREMENT, ATTR_STATE_CLASS: SensorStateClass.MEASUREMENT,
@ -342,7 +342,7 @@ MOCK_OWPROXY_DEVICES = {
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_DEVICE_CLASS: SensorDeviceClass.HUMIDITY, ATTR_DEVICE_CLASS: SensorDeviceClass.HUMIDITY,
ATTR_ENTITY_ID: "sensor.26_111111111111_humidity_htm1735", ATTR_ENTITY_ID: "sensor.26_111111111111_htm1735_humidity",
ATTR_INJECT_READS: ProtocolError, ATTR_INJECT_READS: ProtocolError,
ATTR_STATE: STATE_UNKNOWN, ATTR_STATE: STATE_UNKNOWN,
ATTR_STATE_CLASS: SensorStateClass.MEASUREMENT, ATTR_STATE_CLASS: SensorStateClass.MEASUREMENT,
@ -372,7 +372,7 @@ MOCK_OWPROXY_DEVICES = {
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_DEVICE_CLASS: SensorDeviceClass.VOLTAGE, ATTR_DEVICE_CLASS: SensorDeviceClass.VOLTAGE,
ATTR_ENTITY_ID: "sensor.26_111111111111_voltage_vad", ATTR_ENTITY_ID: "sensor.26_111111111111_vad_voltage",
ATTR_INJECT_READS: b" 2.97", ATTR_INJECT_READS: b" 2.97",
ATTR_STATE: "3.0", ATTR_STATE: "3.0",
ATTR_STATE_CLASS: SensorStateClass.MEASUREMENT, ATTR_STATE_CLASS: SensorStateClass.MEASUREMENT,
@ -382,7 +382,7 @@ MOCK_OWPROXY_DEVICES = {
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_DEVICE_CLASS: SensorDeviceClass.VOLTAGE, ATTR_DEVICE_CLASS: SensorDeviceClass.VOLTAGE,
ATTR_ENTITY_ID: "sensor.26_111111111111_voltage_vdd", ATTR_ENTITY_ID: "sensor.26_111111111111_vdd_voltage",
ATTR_INJECT_READS: b" 4.74", ATTR_INJECT_READS: b" 4.74",
ATTR_STATE: "4.7", ATTR_STATE: "4.7",
ATTR_STATE_CLASS: SensorStateClass.MEASUREMENT, ATTR_STATE_CLASS: SensorStateClass.MEASUREMENT,
@ -392,7 +392,7 @@ MOCK_OWPROXY_DEVICES = {
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_DEVICE_CLASS: SensorDeviceClass.VOLTAGE, ATTR_DEVICE_CLASS: SensorDeviceClass.VOLTAGE,
ATTR_ENTITY_ID: "sensor.26_111111111111_vis", ATTR_ENTITY_ID: "sensor.26_111111111111_vis_voltage_difference",
ATTR_INJECT_READS: b" 0.12", ATTR_INJECT_READS: b" 0.12",
ATTR_STATE: "0.1", ATTR_STATE: "0.1",
ATTR_STATE_CLASS: SensorStateClass.MEASUREMENT, ATTR_STATE_CLASS: SensorStateClass.MEASUREMENT,
@ -404,7 +404,7 @@ MOCK_OWPROXY_DEVICES = {
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_ENTITY_CATEGORY: EntityCategory.CONFIG, ATTR_ENTITY_CATEGORY: EntityCategory.CONFIG,
ATTR_ENTITY_ID: "switch.26_111111111111_iad", ATTR_ENTITY_ID: "switch.26_111111111111_current_a_d_control",
ATTR_INJECT_READS: b" 1", ATTR_INJECT_READS: b" 1",
ATTR_STATE: STATE_ON, ATTR_STATE: STATE_ON,
ATTR_UNIQUE_ID: "/26.111111111111/IAD", ATTR_UNIQUE_ID: "/26.111111111111/IAD",
@ -552,56 +552,56 @@ MOCK_OWPROXY_DEVICES = {
Platform.SWITCH: [ Platform.SWITCH: [
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_ENTITY_ID: "switch.29_111111111111_pio_0", ATTR_ENTITY_ID: "switch.29_111111111111_programmed_input_output_0",
ATTR_INJECT_READS: b" 1", ATTR_INJECT_READS: b" 1",
ATTR_STATE: STATE_ON, ATTR_STATE: STATE_ON,
ATTR_UNIQUE_ID: "/29.111111111111/PIO.0", ATTR_UNIQUE_ID: "/29.111111111111/PIO.0",
}, },
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_ENTITY_ID: "switch.29_111111111111_pio_1", ATTR_ENTITY_ID: "switch.29_111111111111_programmed_input_output_1",
ATTR_INJECT_READS: b" 0", ATTR_INJECT_READS: b" 0",
ATTR_STATE: STATE_OFF, ATTR_STATE: STATE_OFF,
ATTR_UNIQUE_ID: "/29.111111111111/PIO.1", ATTR_UNIQUE_ID: "/29.111111111111/PIO.1",
}, },
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_ENTITY_ID: "switch.29_111111111111_pio_2", ATTR_ENTITY_ID: "switch.29_111111111111_programmed_input_output_2",
ATTR_INJECT_READS: b" 1", ATTR_INJECT_READS: b" 1",
ATTR_STATE: STATE_ON, ATTR_STATE: STATE_ON,
ATTR_UNIQUE_ID: "/29.111111111111/PIO.2", ATTR_UNIQUE_ID: "/29.111111111111/PIO.2",
}, },
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_ENTITY_ID: "switch.29_111111111111_pio_3", ATTR_ENTITY_ID: "switch.29_111111111111_programmed_input_output_3",
ATTR_INJECT_READS: b" 0", ATTR_INJECT_READS: b" 0",
ATTR_STATE: STATE_OFF, ATTR_STATE: STATE_OFF,
ATTR_UNIQUE_ID: "/29.111111111111/PIO.3", ATTR_UNIQUE_ID: "/29.111111111111/PIO.3",
}, },
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_ENTITY_ID: "switch.29_111111111111_pio_4", ATTR_ENTITY_ID: "switch.29_111111111111_programmed_input_output_4",
ATTR_INJECT_READS: b" 1", ATTR_INJECT_READS: b" 1",
ATTR_STATE: STATE_ON, ATTR_STATE: STATE_ON,
ATTR_UNIQUE_ID: "/29.111111111111/PIO.4", ATTR_UNIQUE_ID: "/29.111111111111/PIO.4",
}, },
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_ENTITY_ID: "switch.29_111111111111_pio_5", ATTR_ENTITY_ID: "switch.29_111111111111_programmed_input_output_5",
ATTR_INJECT_READS: b" 0", ATTR_INJECT_READS: b" 0",
ATTR_STATE: STATE_OFF, ATTR_STATE: STATE_OFF,
ATTR_UNIQUE_ID: "/29.111111111111/PIO.5", ATTR_UNIQUE_ID: "/29.111111111111/PIO.5",
}, },
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_ENTITY_ID: "switch.29_111111111111_pio_6", ATTR_ENTITY_ID: "switch.29_111111111111_programmed_input_output_6",
ATTR_INJECT_READS: b" 1", ATTR_INJECT_READS: b" 1",
ATTR_STATE: STATE_ON, ATTR_STATE: STATE_ON,
ATTR_UNIQUE_ID: "/29.111111111111/PIO.6", ATTR_UNIQUE_ID: "/29.111111111111/PIO.6",
}, },
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_ENTITY_ID: "switch.29_111111111111_pio_7", ATTR_ENTITY_ID: "switch.29_111111111111_programmed_input_output_7",
ATTR_INJECT_READS: b" 0", ATTR_INJECT_READS: b" 0",
ATTR_STATE: STATE_OFF, ATTR_STATE: STATE_OFF,
ATTR_UNIQUE_ID: "/29.111111111111/PIO.7", ATTR_UNIQUE_ID: "/29.111111111111/PIO.7",
@ -688,7 +688,7 @@ MOCK_OWPROXY_DEVICES = {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_DEVICE_CLASS: SensorDeviceClass.TEMPERATURE, ATTR_DEVICE_CLASS: SensorDeviceClass.TEMPERATURE,
ATTR_DEVICE_FILE: "/30.111111111111/typeK/temperature", ATTR_DEVICE_FILE: "/30.111111111111/typeK/temperature",
ATTR_ENTITY_ID: "sensor.30_111111111111_thermocouple_temperature", ATTR_ENTITY_ID: "sensor.30_111111111111_thermocouple_k_temperature",
ATTR_INJECT_READS: b" 173.7563", ATTR_INJECT_READS: b" 173.7563",
ATTR_STATE: "173.8", ATTR_STATE: "173.8",
ATTR_STATE_CLASS: SensorStateClass.MEASUREMENT, ATTR_STATE_CLASS: SensorStateClass.MEASUREMENT,
@ -708,7 +708,7 @@ MOCK_OWPROXY_DEVICES = {
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_DEVICE_CLASS: SensorDeviceClass.VOLTAGE, ATTR_DEVICE_CLASS: SensorDeviceClass.VOLTAGE,
ATTR_ENTITY_ID: "sensor.30_111111111111_vis", ATTR_ENTITY_ID: "sensor.30_111111111111_vis_voltage_gradient",
ATTR_INJECT_READS: b" 0.12", ATTR_INJECT_READS: b" 0.12",
ATTR_STATE: "0.1", ATTR_STATE: "0.1",
ATTR_STATE_CLASS: SensorStateClass.MEASUREMENT, ATTR_STATE_CLASS: SensorStateClass.MEASUREMENT,
@ -746,14 +746,14 @@ MOCK_OWPROXY_DEVICES = {
Platform.SWITCH: [ Platform.SWITCH: [
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_ENTITY_ID: "switch.3a_111111111111_pio_a", ATTR_ENTITY_ID: "switch.3a_111111111111_programmed_input_output_a",
ATTR_INJECT_READS: b" 1", ATTR_INJECT_READS: b" 1",
ATTR_STATE: STATE_ON, ATTR_STATE: STATE_ON,
ATTR_UNIQUE_ID: "/3A.111111111111/PIO.A", ATTR_UNIQUE_ID: "/3A.111111111111/PIO.A",
}, },
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_ENTITY_ID: "switch.3a_111111111111_pio_b", ATTR_ENTITY_ID: "switch.3a_111111111111_programmed_input_output_b",
ATTR_INJECT_READS: b" 0", ATTR_INJECT_READS: b" 0",
ATTR_STATE: STATE_OFF, ATTR_STATE: STATE_OFF,
ATTR_UNIQUE_ID: "/3A.111111111111/PIO.B", ATTR_UNIQUE_ID: "/3A.111111111111/PIO.B",
@ -826,7 +826,7 @@ MOCK_OWPROXY_DEVICES = {
}, },
{ {
ATTR_DEVICE_CLASS: SensorDeviceClass.HUMIDITY, ATTR_DEVICE_CLASS: SensorDeviceClass.HUMIDITY,
ATTR_ENTITY_ID: "sensor.ef_111111111111_humidity_raw", ATTR_ENTITY_ID: "sensor.ef_111111111111_raw_humidity",
ATTR_INJECT_READS: b" 65.541", ATTR_INJECT_READS: b" 65.541",
ATTR_STATE: "65.5", ATTR_STATE: "65.5",
ATTR_STATE_CLASS: SensorStateClass.MEASUREMENT, ATTR_STATE_CLASS: SensorStateClass.MEASUREMENT,
@ -900,7 +900,7 @@ MOCK_OWPROXY_DEVICES = {
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_ENTITY_CATEGORY: EntityCategory.CONFIG, ATTR_ENTITY_CATEGORY: EntityCategory.CONFIG,
ATTR_ENTITY_ID: "switch.ef_111111111112_leaf_sensor_0_enable", ATTR_ENTITY_ID: "switch.ef_111111111112_leaf_sensor_0",
ATTR_INJECT_READS: b"1", ATTR_INJECT_READS: b"1",
ATTR_STATE: STATE_ON, ATTR_STATE: STATE_ON,
ATTR_UNIQUE_ID: "/EF.111111111112/moisture/is_leaf.0", ATTR_UNIQUE_ID: "/EF.111111111112/moisture/is_leaf.0",
@ -908,7 +908,7 @@ MOCK_OWPROXY_DEVICES = {
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_ENTITY_CATEGORY: EntityCategory.CONFIG, ATTR_ENTITY_CATEGORY: EntityCategory.CONFIG,
ATTR_ENTITY_ID: "switch.ef_111111111112_leaf_sensor_1_enable", ATTR_ENTITY_ID: "switch.ef_111111111112_leaf_sensor_1",
ATTR_INJECT_READS: b"1", ATTR_INJECT_READS: b"1",
ATTR_STATE: STATE_ON, ATTR_STATE: STATE_ON,
ATTR_UNIQUE_ID: "/EF.111111111112/moisture/is_leaf.1", ATTR_UNIQUE_ID: "/EF.111111111112/moisture/is_leaf.1",
@ -916,7 +916,7 @@ MOCK_OWPROXY_DEVICES = {
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_ENTITY_CATEGORY: EntityCategory.CONFIG, ATTR_ENTITY_CATEGORY: EntityCategory.CONFIG,
ATTR_ENTITY_ID: "switch.ef_111111111112_leaf_sensor_2_enable", ATTR_ENTITY_ID: "switch.ef_111111111112_leaf_sensor_2",
ATTR_INJECT_READS: b"0", ATTR_INJECT_READS: b"0",
ATTR_STATE: STATE_OFF, ATTR_STATE: STATE_OFF,
ATTR_UNIQUE_ID: "/EF.111111111112/moisture/is_leaf.2", ATTR_UNIQUE_ID: "/EF.111111111112/moisture/is_leaf.2",
@ -924,7 +924,7 @@ MOCK_OWPROXY_DEVICES = {
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_ENTITY_CATEGORY: EntityCategory.CONFIG, ATTR_ENTITY_CATEGORY: EntityCategory.CONFIG,
ATTR_ENTITY_ID: "switch.ef_111111111112_leaf_sensor_3_enable", ATTR_ENTITY_ID: "switch.ef_111111111112_leaf_sensor_3",
ATTR_INJECT_READS: b"0", ATTR_INJECT_READS: b"0",
ATTR_STATE: STATE_OFF, ATTR_STATE: STATE_OFF,
ATTR_UNIQUE_ID: "/EF.111111111112/moisture/is_leaf.3", ATTR_UNIQUE_ID: "/EF.111111111112/moisture/is_leaf.3",
@ -932,7 +932,7 @@ MOCK_OWPROXY_DEVICES = {
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_ENTITY_CATEGORY: EntityCategory.CONFIG, ATTR_ENTITY_CATEGORY: EntityCategory.CONFIG,
ATTR_ENTITY_ID: "switch.ef_111111111112_moisture_sensor_0_enable", ATTR_ENTITY_ID: "switch.ef_111111111112_moisture_sensor_0",
ATTR_INJECT_READS: b"1", ATTR_INJECT_READS: b"1",
ATTR_STATE: STATE_ON, ATTR_STATE: STATE_ON,
ATTR_UNIQUE_ID: "/EF.111111111112/moisture/is_moisture.0", ATTR_UNIQUE_ID: "/EF.111111111112/moisture/is_moisture.0",
@ -940,7 +940,7 @@ MOCK_OWPROXY_DEVICES = {
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_ENTITY_CATEGORY: EntityCategory.CONFIG, ATTR_ENTITY_CATEGORY: EntityCategory.CONFIG,
ATTR_ENTITY_ID: "switch.ef_111111111112_moisture_sensor_1_enable", ATTR_ENTITY_ID: "switch.ef_111111111112_moisture_sensor_1",
ATTR_INJECT_READS: b"1", ATTR_INJECT_READS: b"1",
ATTR_STATE: STATE_ON, ATTR_STATE: STATE_ON,
ATTR_UNIQUE_ID: "/EF.111111111112/moisture/is_moisture.1", ATTR_UNIQUE_ID: "/EF.111111111112/moisture/is_moisture.1",
@ -948,7 +948,7 @@ MOCK_OWPROXY_DEVICES = {
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_ENTITY_CATEGORY: EntityCategory.CONFIG, ATTR_ENTITY_CATEGORY: EntityCategory.CONFIG,
ATTR_ENTITY_ID: "switch.ef_111111111112_moisture_sensor_2_enable", ATTR_ENTITY_ID: "switch.ef_111111111112_moisture_sensor_2",
ATTR_INJECT_READS: b"0", ATTR_INJECT_READS: b"0",
ATTR_STATE: STATE_OFF, ATTR_STATE: STATE_OFF,
ATTR_UNIQUE_ID: "/EF.111111111112/moisture/is_moisture.2", ATTR_UNIQUE_ID: "/EF.111111111112/moisture/is_moisture.2",
@ -956,7 +956,7 @@ MOCK_OWPROXY_DEVICES = {
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_ENTITY_CATEGORY: EntityCategory.CONFIG, ATTR_ENTITY_CATEGORY: EntityCategory.CONFIG,
ATTR_ENTITY_ID: "switch.ef_111111111112_moisture_sensor_3_enable", ATTR_ENTITY_ID: "switch.ef_111111111112_moisture_sensor_3",
ATTR_INJECT_READS: b"0", ATTR_INJECT_READS: b"0",
ATTR_STATE: STATE_OFF, ATTR_STATE: STATE_OFF,
ATTR_UNIQUE_ID: "/EF.111111111112/moisture/is_moisture.3", ATTR_UNIQUE_ID: "/EF.111111111112/moisture/is_moisture.3",
@ -1015,7 +1015,7 @@ MOCK_OWPROXY_DEVICES = {
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_ENTITY_CATEGORY: EntityCategory.CONFIG, ATTR_ENTITY_CATEGORY: EntityCategory.CONFIG,
ATTR_ENTITY_ID: "switch.ef_111111111113_hub_branch_0_enable", ATTR_ENTITY_ID: "switch.ef_111111111113_hub_branch_0",
ATTR_INJECT_READS: b"1", ATTR_INJECT_READS: b"1",
ATTR_STATE: STATE_ON, ATTR_STATE: STATE_ON,
ATTR_UNIQUE_ID: "/EF.111111111113/hub/branch.0", ATTR_UNIQUE_ID: "/EF.111111111113/hub/branch.0",
@ -1023,7 +1023,7 @@ MOCK_OWPROXY_DEVICES = {
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_ENTITY_CATEGORY: EntityCategory.CONFIG, ATTR_ENTITY_CATEGORY: EntityCategory.CONFIG,
ATTR_ENTITY_ID: "switch.ef_111111111113_hub_branch_1_enable", ATTR_ENTITY_ID: "switch.ef_111111111113_hub_branch_1",
ATTR_INJECT_READS: b"0", ATTR_INJECT_READS: b"0",
ATTR_STATE: STATE_OFF, ATTR_STATE: STATE_OFF,
ATTR_UNIQUE_ID: "/EF.111111111113/hub/branch.1", ATTR_UNIQUE_ID: "/EF.111111111113/hub/branch.1",
@ -1031,7 +1031,7 @@ MOCK_OWPROXY_DEVICES = {
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_ENTITY_CATEGORY: EntityCategory.CONFIG, ATTR_ENTITY_CATEGORY: EntityCategory.CONFIG,
ATTR_ENTITY_ID: "switch.ef_111111111113_hub_branch_2_enable", ATTR_ENTITY_ID: "switch.ef_111111111113_hub_branch_2",
ATTR_INJECT_READS: b"1", ATTR_INJECT_READS: b"1",
ATTR_STATE: STATE_ON, ATTR_STATE: STATE_ON,
ATTR_UNIQUE_ID: "/EF.111111111113/hub/branch.2", ATTR_UNIQUE_ID: "/EF.111111111113/hub/branch.2",
@ -1039,7 +1039,7 @@ MOCK_OWPROXY_DEVICES = {
{ {
ATTR_DEFAULT_DISABLED: True, ATTR_DEFAULT_DISABLED: True,
ATTR_ENTITY_CATEGORY: EntityCategory.CONFIG, ATTR_ENTITY_CATEGORY: EntityCategory.CONFIG,
ATTR_ENTITY_ID: "switch.ef_111111111113_hub_branch_3_enable", ATTR_ENTITY_ID: "switch.ef_111111111113_hub_branch_3",
ATTR_INJECT_READS: b"0", ATTR_INJECT_READS: b"0",
ATTR_STATE: STATE_OFF, ATTR_STATE: STATE_OFF,
ATTR_UNIQUE_ID: "/EF.111111111113/hub/branch.3", ATTR_UNIQUE_ID: "/EF.111111111113/hub/branch.3",