mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Use DhcpServiceInfo in flux_led (#59967)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
a51f2a433f
commit
cb306236f2
@ -13,11 +13,7 @@ from flux_led.const import (
|
||||
)
|
||||
from flux_led.protocol import LEDENETRawState
|
||||
|
||||
from homeassistant.components.dhcp import (
|
||||
HOSTNAME as DHCP_HOSTNAME,
|
||||
IP_ADDRESS as DHCP_IP_ADDRESS,
|
||||
MAC_ADDRESS as DHCP_MAC_ADDRESS,
|
||||
)
|
||||
from homeassistant.components import dhcp
|
||||
from homeassistant.components.flux_led.const import FLUX_HOST, FLUX_MAC, FLUX_MODEL
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
@ -30,11 +26,11 @@ FLUX_MAC_ADDRESS = "aabbccddeeff"
|
||||
|
||||
DEFAULT_ENTRY_TITLE = f"{MODEL} {FLUX_MAC_ADDRESS}"
|
||||
|
||||
DHCP_DISCOVERY = {
|
||||
DHCP_HOSTNAME: MODEL,
|
||||
DHCP_IP_ADDRESS: IP_ADDRESS,
|
||||
DHCP_MAC_ADDRESS: MAC_ADDRESS,
|
||||
}
|
||||
DHCP_DISCOVERY = dhcp.DhcpServiceInfo(
|
||||
hostname=MODEL,
|
||||
ip=IP_ADDRESS,
|
||||
macaddress=MAC_ADDRESS,
|
||||
)
|
||||
FLUX_DISCOVERY = {FLUX_HOST: IP_ADDRESS, FLUX_MODEL: MODEL, FLUX_MAC: FLUX_MAC_ADDRESS}
|
||||
|
||||
|
||||
|
@ -6,6 +6,7 @@ from unittest.mock import patch
|
||||
import pytest
|
||||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components import dhcp
|
||||
from homeassistant.components.flux_led.const import (
|
||||
CONF_CUSTOM_EFFECT_COLORS,
|
||||
CONF_CUSTOM_EFFECT_SPEED_PCT,
|
||||
@ -29,9 +30,6 @@ from homeassistant.data_entry_flow import RESULT_TYPE_ABORT, RESULT_TYPE_FORM
|
||||
from . import (
|
||||
DEFAULT_ENTRY_TITLE,
|
||||
DHCP_DISCOVERY,
|
||||
DHCP_HOSTNAME,
|
||||
DHCP_IP_ADDRESS,
|
||||
DHCP_MAC_ADDRESS,
|
||||
FLUX_DISCOVERY,
|
||||
IP_ADDRESS,
|
||||
MAC_ADDRESS,
|
||||
@ -341,11 +339,11 @@ async def test_discovered_by_discovery_and_dhcp(hass):
|
||||
result3 = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_DHCP},
|
||||
data={
|
||||
DHCP_HOSTNAME: "any",
|
||||
DHCP_IP_ADDRESS: IP_ADDRESS,
|
||||
DHCP_MAC_ADDRESS: "00:00:00:00:00:00",
|
||||
},
|
||||
data=dhcp.DhcpServiceInfo(
|
||||
hostname="any",
|
||||
ip=IP_ADDRESS,
|
||||
macaddress="00:00:00:00:00:00",
|
||||
),
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result3["type"] == RESULT_TYPE_ABORT
|
||||
|
Loading…
x
Reference in New Issue
Block a user