Remove Modbus legacy code (#33407)

* Modbus: remove legacy code

flexit and stiebel_el are updated to import modbus.const,
therefore legacy code can be removed.

* Flexit: update const reference from modbus

climate.py imports from modbus direct, this is legacy and will
result in errors.

update import to be modbus.const.

* Stiebel_el: update reference to modbus

__init.py references modbus directly, this is legacy and will
give errors.

Update import to be modbus.const.
This commit is contained in:
jan iversen 2020-03-30 01:35:58 +02:00 committed by GitHub
parent fe0db80fb8
commit ad8cf2d0d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 16 deletions

View File

@ -11,11 +11,7 @@ from homeassistant.components.climate.const import (
SUPPORT_FAN_MODE, SUPPORT_FAN_MODE,
SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_TEMPERATURE,
) )
from homeassistant.components.modbus import ( from homeassistant.components.modbus.const import CONF_HUB, DEFAULT_HUB, MODBUS_DOMAIN
CONF_HUB,
DEFAULT_HUB,
DOMAIN as MODBUS_DOMAIN,
)
from homeassistant.const import ( from homeassistant.const import (
ATTR_TEMPERATURE, ATTR_TEMPERATURE,
CONF_NAME, CONF_NAME,

View File

@ -25,7 +25,7 @@ from homeassistant.const import (
) )
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from .const import ( # DEFAULT_HUB, from .const import (
ATTR_ADDRESS, ATTR_ADDRESS,
ATTR_HUB, ATTR_HUB,
ATTR_UNIT, ATTR_UNIT,
@ -34,16 +34,12 @@ from .const import ( # DEFAULT_HUB,
CONF_BYTESIZE, CONF_BYTESIZE,
CONF_PARITY, CONF_PARITY,
CONF_STOPBITS, CONF_STOPBITS,
DEFAULT_HUB,
MODBUS_DOMAIN, MODBUS_DOMAIN,
SERVICE_WRITE_COIL, SERVICE_WRITE_COIL,
SERVICE_WRITE_REGISTER, SERVICE_WRITE_REGISTER,
) )
# Kept for compatibility with other integrations, TO BE REMOVED
CONF_HUB = "hub"
DEFAULT_HUB = "default"
DOMAIN = MODBUS_DOMAIN
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
BASE_SCHEMA = vol.Schema({vol.Optional(CONF_NAME, default=DEFAULT_HUB): cv.string}) BASE_SCHEMA = vol.Schema({vol.Optional(CONF_NAME, default=DEFAULT_HUB): cv.string})

View File

@ -5,11 +5,7 @@ import logging
from pystiebeleltron import pystiebeleltron from pystiebeleltron import pystiebeleltron
import voluptuous as vol import voluptuous as vol
from homeassistant.components.modbus import ( from homeassistant.components.modbus.const import CONF_HUB, DEFAULT_HUB, MODBUS_DOMAIN
CONF_HUB,
DEFAULT_HUB,
DOMAIN as MODBUS_DOMAIN,
)
from homeassistant.const import CONF_NAME, DEVICE_DEFAULT_NAME from homeassistant.const import CONF_NAME, DEVICE_DEFAULT_NAME
from homeassistant.helpers import discovery from homeassistant.helpers import discovery
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv