diff --git a/homeassistant/components/modbus/__init__.py b/homeassistant/components/modbus/__init__.py index 77e9b6f7ca9..c2a1a76840c 100644 --- a/homeassistant/components/modbus/__init__.py +++ b/homeassistant/components/modbus/__init__.py @@ -17,6 +17,7 @@ from homeassistant.const import ( CONF_HOST, CONF_METHOD, CONF_NAME, + CONF_OFFSET, CONF_PORT, CONF_SCAN_INTERVAL, CONF_SLAVE, @@ -46,7 +47,6 @@ from .const import ( CONF_INPUT_TYPE, CONF_MAX_TEMP, CONF_MIN_TEMP, - CONF_OFFSET, CONF_PARITY, CONF_PRECISION, CONF_REGISTER, @@ -257,7 +257,6 @@ class ModbusHub: def __init__(self, client_config): """Initialize the Modbus hub.""" - # generic configuration self._client = None self._lock = threading.Lock() diff --git a/homeassistant/components/modbus/binary_sensor.py b/homeassistant/components/modbus/binary_sensor.py index c9e9cc4196a..8e91945d073 100644 --- a/homeassistant/components/modbus/binary_sensor.py +++ b/homeassistant/components/modbus/binary_sensor.py @@ -10,13 +10,12 @@ from homeassistant.components.binary_sensor import ( PLATFORM_SCHEMA, BinarySensorEntity, ) -from homeassistant.const import CONF_DEVICE_CLASS, CONF_NAME, CONF_SLAVE +from homeassistant.const import CONF_ADDRESS, CONF_DEVICE_CLASS, CONF_NAME, CONF_SLAVE from homeassistant.helpers import config_validation as cv from .const import ( CALL_TYPE_COIL, CALL_TYPE_DISCRETE, - CONF_ADDRESS, CONF_COILS, CONF_HUB, CONF_INPUT_TYPE, diff --git a/homeassistant/components/modbus/climate.py b/homeassistant/components/modbus/climate.py index b09a38f082e..c1b7b2e6bf4 100644 --- a/homeassistant/components/modbus/climate.py +++ b/homeassistant/components/modbus/climate.py @@ -15,6 +15,7 @@ from homeassistant.components.climate.const import ( from homeassistant.const import ( ATTR_TEMPERATURE, CONF_NAME, + CONF_OFFSET, CONF_SCAN_INTERVAL, CONF_SLAVE, CONF_STRUCTURE, @@ -39,7 +40,6 @@ from .const import ( CONF_DATA_TYPE, CONF_MAX_TEMP, CONF_MIN_TEMP, - CONF_OFFSET, CONF_PRECISION, CONF_SCALE, CONF_STEP, @@ -146,7 +146,6 @@ class ModbusThermostat(ClimateEntity): False if entity pushes its state to HA. """ - # Handle polling directly in this entity return False diff --git a/homeassistant/components/modbus/const.py b/homeassistant/components/modbus/const.py index e79b69bbb87..5e304165e42 100644 --- a/homeassistant/components/modbus/const.py +++ b/homeassistant/components/modbus/const.py @@ -13,7 +13,6 @@ CONF_REVERSE_ORDER = "reverse_order" CONF_SCALE = "scale" CONF_COUNT = "count" CONF_PRECISION = "precision" -CONF_OFFSET = "offset" CONF_COILS = "coils" # integration names @@ -51,7 +50,6 @@ DEFAULT_SCAN_INTERVAL = 15 # seconds # binary_sensor.py CONF_INPUTS = "inputs" CONF_INPUT_TYPE = "input_type" -CONF_ADDRESS = "address" # sensor.py # CONF_DATA_TYPE = "data_type" diff --git a/homeassistant/components/modbus/cover.py b/homeassistant/components/modbus/cover.py index ab16e5306f1..709c772564a 100644 --- a/homeassistant/components/modbus/cover.py +++ b/homeassistant/components/modbus/cover.py @@ -148,7 +148,6 @@ class ModbusCover(CoverEntity, RestoreEntity): False if entity pushes its state to HA. """ - # Handle polling directly in this entity return False diff --git a/homeassistant/components/modbus/switch.py b/homeassistant/components/modbus/switch.py index 8fe1f886c3e..b1b07fb5a55 100644 --- a/homeassistant/components/modbus/switch.py +++ b/homeassistant/components/modbus/switch.py @@ -200,7 +200,6 @@ class ModbusRegisterSwitch(ModbusBaseSwitch, SwitchEntity): def turn_on(self, **kwargs): """Set switch on.""" - # Only holding register is writable if self._register_type == CALL_TYPE_REGISTER_HOLDING: self._write_register(self._command_on) @@ -209,7 +208,6 @@ class ModbusRegisterSwitch(ModbusBaseSwitch, SwitchEntity): def turn_off(self, **kwargs): """Set switch off.""" - # Only holding register is writable if self._register_type == CALL_TYPE_REGISTER_HOLDING: self._write_register(self._command_off) diff --git a/tests/components/modbus/conftest.py b/tests/components/modbus/conftest.py index e3a707b7fc9..a3e6078ea09 100644 --- a/tests/components/modbus/conftest.py +++ b/tests/components/modbus/conftest.py @@ -46,7 +46,6 @@ async def setup_base_test( scan_interval, ): """Run setup device for given config.""" - # Full sensor configuration config = { entity_domain: { @@ -79,7 +78,6 @@ async def run_base_read_test( now, ): """Run test for given config.""" - # Setup inputs for the sensor read_result = ReadResult(register_words) if register_type == CALL_TYPE_COIL: diff --git a/tests/components/modbus/test_modbus_binary_sensor.py b/tests/components/modbus/test_modbus_binary_sensor.py index 91374cde22d..3bc7223c865 100644 --- a/tests/components/modbus/test_modbus_binary_sensor.py +++ b/tests/components/modbus/test_modbus_binary_sensor.py @@ -7,11 +7,10 @@ from homeassistant.components.binary_sensor import DOMAIN as SENSOR_DOMAIN from homeassistant.components.modbus.const import ( CALL_TYPE_COIL, CALL_TYPE_DISCRETE, - CONF_ADDRESS, CONF_INPUT_TYPE, CONF_INPUTS, ) -from homeassistant.const import CONF_NAME, STATE_OFF, STATE_ON +from homeassistant.const import CONF_ADDRESS, CONF_NAME, STATE_OFF, STATE_ON from .conftest import run_base_read_test, setup_base_test diff --git a/tests/components/modbus/test_modbus_sensor.py b/tests/components/modbus/test_modbus_sensor.py index 68cdbffa462..3f7c0fc60df 100644 --- a/tests/components/modbus/test_modbus_sensor.py +++ b/tests/components/modbus/test_modbus_sensor.py @@ -8,7 +8,6 @@ from homeassistant.components.modbus.const import ( CALL_TYPE_REGISTER_INPUT, CONF_COUNT, CONF_DATA_TYPE, - CONF_OFFSET, CONF_PRECISION, CONF_REGISTER, CONF_REGISTER_TYPE, @@ -21,7 +20,7 @@ from homeassistant.components.modbus.const import ( DATA_TYPE_UINT, ) from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN -from homeassistant.const import CONF_NAME +from homeassistant.const import CONF_NAME, CONF_OFFSET from .conftest import run_base_read_test, setup_base_test