Secure ATTR_ and CONF_ use identical texts in Modbus (#66901)

This commit is contained in:
jan iversen 2022-02-25 17:05:19 +01:00 committed by GitHub
parent 5c4b149f50
commit adc4c1e33f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 7 deletions

View file

@ -11,6 +11,7 @@ from homeassistant.components.climate.const import (
SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_TEMPERATURE,
) )
from homeassistant.const import ( from homeassistant.const import (
ATTR_TEMPERATURE,
CONF_NAME, CONF_NAME,
CONF_TEMPERATURE_UNIT, CONF_TEMPERATURE_UNIT,
PRECISION_TENTHS, PRECISION_TENTHS,
@ -26,7 +27,6 @@ from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from . import get_hub from . import get_hub
from .base_platform import BaseStructPlatform from .base_platform import BaseStructPlatform
from .const import ( from .const import (
ATTR_TEMPERATURE,
CALL_TYPE_REGISTER_HOLDING, CALL_TYPE_REGISTER_HOLDING,
CALL_TYPE_WRITE_REGISTERS, CALL_TYPE_WRITE_REGISTERS,
CONF_CLIMATES, CONF_CLIMATES,

View file

@ -2,6 +2,7 @@
from enum import Enum from enum import Enum
from homeassistant.const import ( from homeassistant.const import (
CONF_ADDRESS,
CONF_BINARY_SENSORS, CONF_BINARY_SENSORS,
CONF_COVERS, CONF_COVERS,
CONF_LIGHTS, CONF_LIGHTS,
@ -64,13 +65,11 @@ UDP = "udp"
# service call attributes # service call attributes
ATTR_ADDRESS = "address" ATTR_ADDRESS = CONF_ADDRESS
ATTR_HUB = "hub" ATTR_HUB = CONF_HUB
ATTR_UNIT = "unit" ATTR_UNIT = "unit"
ATTR_SLAVE = "slave" ATTR_SLAVE = "slave"
ATTR_VALUE = "value" ATTR_VALUE = "value"
ATTR_STATE = "state"
ATTR_TEMPERATURE = "temperature"
class DataType(str, Enum): class DataType(str, Enum):

View file

@ -20,6 +20,7 @@ from pymodbus.transaction import ModbusRtuFramer
import voluptuous as vol import voluptuous as vol
from homeassistant.const import ( from homeassistant.const import (
ATTR_STATE,
CONF_DELAY, CONF_DELAY,
CONF_HOST, CONF_HOST,
CONF_METHOD, CONF_METHOD,
@ -40,7 +41,6 @@ from .const import (
ATTR_ADDRESS, ATTR_ADDRESS,
ATTR_HUB, ATTR_HUB,
ATTR_SLAVE, ATTR_SLAVE,
ATTR_STATE,
ATTR_UNIT, ATTR_UNIT,
ATTR_VALUE, ATTR_VALUE,
CALL_TYPE_COIL, CALL_TYPE_COIL,

View file

@ -26,7 +26,6 @@ from homeassistant.components.modbus.const import (
ATTR_ADDRESS, ATTR_ADDRESS,
ATTR_HUB, ATTR_HUB,
ATTR_SLAVE, ATTR_SLAVE,
ATTR_STATE,
ATTR_UNIT, ATTR_UNIT,
ATTR_VALUE, ATTR_VALUE,
CALL_TYPE_COIL, CALL_TYPE_COIL,
@ -67,6 +66,7 @@ from homeassistant.components.modbus.validators import (
) )
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
from homeassistant.const import ( from homeassistant.const import (
ATTR_STATE,
CONF_ADDRESS, CONF_ADDRESS,
CONF_BINARY_SENSORS, CONF_BINARY_SENSORS,
CONF_COUNT, CONF_COUNT,