Drop deprecated CONF_NAMES from onewire (#61094)

Co-authored-by: epenet <epenet@users.noreply.github.com>
pull/63224/head
epenet 2022-01-02 17:10:19 +01:00 committed by GitHub
parent ebc8e19788
commit 24e27290b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 17 deletions

View File

@ -4,7 +4,6 @@ from __future__ import annotations
from homeassistant.const import Platform
CONF_MOUNT_DIR = "mount_dir"
CONF_NAMES = "names"
CONF_TYPE_OWSERVER = "OWServer"
CONF_TYPE_SYSBUS = "SysBus"

View File

@ -33,7 +33,6 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import StateType
from .const import (
CONF_NAMES,
CONF_TYPE_OWSERVER,
CONF_TYPE_SYSBUS,
DEVICE_KEYS_0_3,
@ -333,10 +332,6 @@ def get_entities(
return []
entities: list[SensorEntity] = []
device_names = {}
if CONF_NAMES in config and isinstance(config[CONF_NAMES], dict):
device_names = config[CONF_NAMES]
conf_type = config[CONF_TYPE]
# We have an owserver on a remote(or local) host/port
if conf_type == CONF_TYPE_OWSERVER:
@ -375,7 +370,7 @@ def get_entities(
device_file = os.path.join(
os.path.split(device.path)[0], description.key
)
name = f"{device_names.get(device_id, device_id)} {description.name}"
name = f"{device_id} {description.name}"
entities.append(
OneWireProxySensor(
description=description,
@ -398,7 +393,7 @@ def get_entities(
device_info = device.device_info
description = SIMPLE_TEMPERATURE_SENSOR_DESCRIPTION
device_file = f"/sys/bus/w1/devices/{device_id}/w1_slave"
name = f"{device_names.get(device_id, device_id)} {description.name}"
name = f"{device_id} {description.name}"
entities.append(
OneWireDirectSensor(
description=description,

View File

@ -6,7 +6,6 @@ import pytest
from homeassistant.components.onewire.const import (
CONF_MOUNT_DIR,
CONF_NAMES,
CONF_TYPE_OWSERVER,
CONF_TYPE_SYSBUS,
DEFAULT_SYSBUS_MOUNT_DIR,
@ -37,9 +36,6 @@ def get_config_entry(hass: HomeAssistant) -> ConfigEntry:
CONF_TYPE: CONF_TYPE_OWSERVER,
CONF_HOST: "1.2.3.4",
CONF_PORT: 1234,
CONF_NAMES: {
"10.111111111111": "My DS18B20",
},
},
options={},
entry_id="2",
@ -57,9 +53,6 @@ def get_sysbus_config_entry(hass: HomeAssistant) -> ConfigEntry:
data={
CONF_TYPE: CONF_TYPE_SYSBUS,
CONF_MOUNT_DIR: DEFAULT_SYSBUS_MOUNT_DIR,
CONF_NAMES: {
"10-111111111111": "My DS18B20",
},
},
unique_id=f"{CONF_TYPE_SYSBUS}:{DEFAULT_SYSBUS_MOUNT_DIR}",
options={},

View File

@ -92,7 +92,7 @@ MOCK_OWPROXY_DEVICES = {
Platform.SENSOR: [
{
ATTR_DEVICE_CLASS: SensorDeviceClass.TEMPERATURE,
ATTR_ENTITY_ID: "sensor.my_ds18b20_temperature",
ATTR_ENTITY_ID: "sensor.10_111111111111_temperature",
ATTR_INJECT_READS: b" 25.123",
ATTR_STATE: "25.1",
ATTR_STATE_CLASS: SensorStateClass.MEASUREMENT,
@ -1045,7 +1045,7 @@ MOCK_SYSBUS_DEVICES = {
Platform.SENSOR: [
{
ATTR_DEVICE_CLASS: SensorDeviceClass.TEMPERATURE,
ATTR_ENTITY_ID: "sensor.my_ds18b20_temperature",
ATTR_ENTITY_ID: "sensor.10_111111111111_temperature",
ATTR_INJECT_READS: 25.123,
ATTR_STATE: "25.1",
ATTR_STATE_CLASS: SensorStateClass.MEASUREMENT,