Implement local discovery of Smappee series-2 devices and improvements (#38728)
* prepare local api support for Smappee2-series * Series-2 devices are now supported * remove switch scan_interval
This commit is contained in:
parent
c87e03ee6f
commit
11f121b008
7 changed files with 18 additions and 9 deletions
|
@ -8,7 +8,14 @@ from homeassistant.const import CONF_HOST, CONF_IP_ADDRESS
|
|||
from homeassistant.helpers import config_entry_oauth2_flow
|
||||
|
||||
from . import api
|
||||
from .const import CONF_HOSTNAME, CONF_SERIALNUMBER, DOMAIN, ENV_CLOUD, ENV_LOCAL
|
||||
from .const import (
|
||||
CONF_HOSTNAME,
|
||||
CONF_SERIALNUMBER,
|
||||
DOMAIN,
|
||||
ENV_CLOUD,
|
||||
ENV_LOCAL,
|
||||
SUPPORTED_LOCAL_DEVICES,
|
||||
)
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -35,7 +42,7 @@ class SmappeeFlowHandler(
|
|||
async def async_step_zeroconf(self, discovery_info):
|
||||
"""Handle zeroconf discovery."""
|
||||
|
||||
if not discovery_info[CONF_HOSTNAME].startswith("Smappee1"):
|
||||
if not discovery_info[CONF_HOSTNAME].startswith(SUPPORTED_LOCAL_DEVICES):
|
||||
# We currently only support Energy and Solar models (legacy)
|
||||
return self.async_abort(reason="invalid_mdns")
|
||||
|
||||
|
@ -152,7 +159,9 @@ class SmappeeFlowHandler(
|
|||
if config_item["key"] == "mdnsHostName":
|
||||
serial_number = config_item["value"]
|
||||
|
||||
if serial_number is None or not serial_number.startswith("Smappee1"):
|
||||
if serial_number is None or not serial_number.startswith(
|
||||
SUPPORTED_LOCAL_DEVICES
|
||||
):
|
||||
# We currently only support Energy and Solar models (legacy)
|
||||
return self.async_abort(reason="invalid_mdns")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue