Add configuration url to Tasmota (#57957)

This commit is contained in:
Erik Montnemery 2021-10-18 14:53:47 +02:00 committed by GitHub
parent 1e98761f30
commit 786e1f9b6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import asyncio
import logging
from hatasmota.const import (
CONF_IP,
CONF_MAC,
CONF_MANUFACTURER,
CONF_MODEL,
@ -165,12 +166,13 @@ def _update_device(
"""Add or update device registry."""
_LOGGER.debug("Adding or updating tasmota device %s", config[CONF_MAC])
device_registry.async_get_or_create(
config_entry_id=config_entry.entry_id,
configuration_url=f"http://{config[CONF_IP]}/",
connections={(CONNECTION_NETWORK_MAC, config[CONF_MAC])},
manufacturer=config[CONF_MANUFACTURER],
model=config[CONF_MODEL],
name=config[CONF_NAME],
sw_version=config[CONF_SW_VERSION],
config_entry_id=config_entry.entry_id,
)

View File

@ -150,6 +150,7 @@ async def test_device_discover(
set(), {(dr.CONNECTION_NETWORK_MAC, mac)}
)
assert device_entry is not None
assert device_entry.configuration_url == f"http://{config['ip']}/"
assert device_entry.manufacturer == "Tasmota"
assert device_entry.model == config["md"]
assert device_entry.name == config["dn"]