mirror of
https://github.com/home-assistant/core.git
synced 2025-11-12 20:40:18 +00:00
Fix modbus typing (#49938)
Add changes needed to please mypy and follow the coding rules of the project.
This commit is contained in:
@@ -58,7 +58,6 @@ from .const import (
|
||||
DEFAULT_STRUCT_FORMAT,
|
||||
MODBUS_DOMAIN,
|
||||
)
|
||||
from .modbus import ModbusHub
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@@ -120,7 +119,6 @@ async def async_setup_platform(
|
||||
entry[CONF_INPUT_TYPE] = entry[CONF_REGISTER_TYPE]
|
||||
del entry[CONF_REGISTER]
|
||||
del entry[CONF_REGISTER_TYPE]
|
||||
config = None
|
||||
|
||||
for entry in discovery_info[CONF_SENSORS]:
|
||||
if entry[CONF_DATA_TYPE] == DATA_TYPE_STRING:
|
||||
@@ -175,9 +173,9 @@ async def async_setup_platform(
|
||||
continue
|
||||
if CONF_HUB in entry:
|
||||
# from old config!
|
||||
hub: ModbusHub = hass.data[MODBUS_DOMAIN][entry[CONF_HUB]]
|
||||
hub = hass.data[MODBUS_DOMAIN][entry[CONF_HUB]]
|
||||
else:
|
||||
hub: ModbusHub = hass.data[MODBUS_DOMAIN][discovery_info[CONF_NAME]]
|
||||
hub = hass.data[MODBUS_DOMAIN][discovery_info[CONF_NAME]]
|
||||
if CONF_SCAN_INTERVAL not in entry:
|
||||
entry[CONF_SCAN_INTERVAL] = DEFAULT_SCAN_INTERVAL
|
||||
sensors.append(
|
||||
|
||||
Reference in New Issue
Block a user