2024-02-15 14:27:11 +00:00
|
|
|
"""Constants for Hunter Douglas Powerview tests."""
|
|
|
|
|
|
|
|
from ipaddress import IPv4Address
|
|
|
|
|
|
|
|
from homeassistant import config_entries
|
|
|
|
from homeassistant.components import dhcp, zeroconf
|
|
|
|
|
|
|
|
MOCK_MAC = "AA::BB::CC::DD::EE::FF"
|
|
|
|
|
|
|
|
HOMEKIT_DISCOVERY_GEN2 = zeroconf.ZeroconfServiceInfo(
|
|
|
|
ip_address="1.2.3.4",
|
|
|
|
ip_addresses=[IPv4Address("1.2.3.4")],
|
|
|
|
hostname="mock_hostname",
|
|
|
|
name="Powerview Generation 2._hap._tcp.local.",
|
|
|
|
port=None,
|
|
|
|
properties={zeroconf.ATTR_PROPERTIES_ID: MOCK_MAC},
|
|
|
|
type="mock_type",
|
|
|
|
)
|
|
|
|
|
|
|
|
HOMEKIT_DISCOVERY_GEN3 = zeroconf.ZeroconfServiceInfo(
|
|
|
|
ip_address="1.2.3.4",
|
|
|
|
ip_addresses=[IPv4Address("1.2.3.4")],
|
|
|
|
hostname="mock_hostname",
|
|
|
|
name="Powerview Generation 3._hap._tcp.local.",
|
|
|
|
port=None,
|
|
|
|
properties={zeroconf.ATTR_PROPERTIES_ID: MOCK_MAC},
|
|
|
|
type="mock_type",
|
|
|
|
)
|
|
|
|
|
|
|
|
ZEROCONF_DISCOVERY_GEN2 = zeroconf.ZeroconfServiceInfo(
|
|
|
|
ip_address="1.2.3.4",
|
|
|
|
ip_addresses=[IPv4Address("1.2.3.4")],
|
|
|
|
hostname="mock_hostname",
|
|
|
|
name="Powerview Generation 2._powerview._tcp.local.",
|
|
|
|
port=None,
|
|
|
|
properties={},
|
|
|
|
type="mock_type",
|
|
|
|
)
|
|
|
|
|
|
|
|
ZEROCONF_DISCOVERY_GEN3 = zeroconf.ZeroconfServiceInfo(
|
|
|
|
ip_address="1.2.3.4",
|
|
|
|
ip_addresses=[IPv4Address("1.2.3.4")],
|
|
|
|
hostname="mock_hostname",
|
|
|
|
name="Powerview Generation 3._powerview-g3._tcp.local.",
|
|
|
|
port=None,
|
|
|
|
properties={},
|
|
|
|
type="mock_type",
|
|
|
|
)
|
|
|
|
|
|
|
|
DHCP_DISCOVERY_GEN2 = dhcp.DhcpServiceInfo(
|
|
|
|
hostname="Powerview Generation 2",
|
|
|
|
ip="1.2.3.4",
|
|
|
|
macaddress="aabbccddeeff",
|
|
|
|
)
|
|
|
|
|
Handle empty name in powerview config flow (#110969)
fixes
```
2024-02-19 13:51:58.128 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved: File "/Users/bdraco/home-assistant/venv/bin/hass", line 8, in <module>
sys.exit(main())
File "/Users/bdraco/home-assistant/homeassistant/__main__.py", line 209, in main
exit_code = runner.run(runtime_conf)
File "/Users/bdraco/home-assistant/homeassistant/runner.py", line 188, in run
return loop.run_until_complete(setup_and_run_hass(runtime_config))
File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py", line 673, in run_until_complete
self.run_forever()
File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py", line 640, in run_forever
self._run_once()
File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py", line 1965, in _run_once
handle._run()
File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/events.py", line 84, in _run
self._context.run(self._callback, *self._args)
File "/Users/bdraco/home-assistant/homeassistant/helpers/entity_platform.py", line 610, in async_add_entities
await add_func(coros, entities, timeout)
File "/Users/bdraco/home-assistant/homeassistant/helpers/entity_platform.py", line 561, in _async_add_entities
await coro
File "/Users/bdraco/home-assistant/homeassistant/helpers/entity_platform.py", line 652, in _async_add_entity
entity.add_to_platform_start(
File "/Users/bdraco/home-assistant/homeassistant/components/device_tracker/config_entry.py", line 356, in add_to_platform_start
_async_connected_device_registered(
File "/Users/bdraco/home-assistant/homeassistant/components/device_tracker/config_entry.py", line 94, in _async_connected_device_registered
async_dispatcher_send(
File "/Users/bdraco/home-assistant/homeassistant/helpers/dispatcher.py", line 227, in async_dispatcher_send
hass.async_run_hass_job(job, *args)
File "/Users/bdraco/home-assistant/homeassistant/core.py", line 701, in async_run_hass_job
hassjob.target(*args)
File "/Users/bdraco/home-assistant/homeassistant/util/logging.py", line 133, in _callback_wrapper
func(*args)
File "/Users/bdraco/home-assistant/homeassistant/components/dhcp/__init__.py", line 392, in _async_process_device_data
self.async_process_client(ip_address, hostname, mac_address)
File "/Users/bdraco/home-assistant/homeassistant/components/dhcp/__init__.py", line 268, in async_process_client
discovery_flow.async_create_flow(
File "/Users/bdraco/home-assistant/homeassistant/helpers/discovery_flow.py", line 32, in async_create_flow
hass.async_create_task(init_coro, f"discovery flow {domain} {context}")
File "/Users/bdraco/home-assistant/homeassistant/core.py", line 634, in async_create_task
task = self.loop.create_task(target, name=name)
Traceback (most recent call last):
File "/Users/bdraco/home-assistant/homeassistant/config_entries.py", line 1017, in async_init
flow, result = await self._async_init(flow_id, handler, context, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/bdraco/home-assistant/homeassistant/config_entries.py", line 1047, in _async_init
result = await self._async_handle_step(flow, flow.init_step, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/bdraco/home-assistant/homeassistant/data_entry_flow.py", line 501, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/bdraco/home-assistant/homeassistant/components/hunterdouglas_powerview/config_flow.py", line 127, in async_step_dhcp
return await self.async_step_discovery_confirm()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/bdraco/home-assistant/homeassistant/components/hunterdouglas_powerview/config_flow.py", line 152, in async_step_discovery_confirm
assert self.discovered_ip and self.discovered_name
AssertionError
```
2024-02-20 09:41:38 +00:00
|
|
|
DHCP_DISCOVERY_GEN2_NO_NAME = dhcp.DhcpServiceInfo(
|
|
|
|
hostname="",
|
|
|
|
ip="1.2.3.4",
|
|
|
|
macaddress="aabbccddeeff",
|
|
|
|
)
|
|
|
|
|
2024-02-15 14:27:11 +00:00
|
|
|
DHCP_DISCOVERY_GEN3 = dhcp.DhcpServiceInfo(
|
|
|
|
hostname="Powerview Generation 3",
|
|
|
|
ip="1.2.3.4",
|
|
|
|
macaddress="aabbccddeeff",
|
|
|
|
)
|
|
|
|
|
|
|
|
HOMEKIT_DATA = [
|
|
|
|
(
|
|
|
|
config_entries.SOURCE_HOMEKIT,
|
|
|
|
HOMEKIT_DISCOVERY_GEN2,
|
|
|
|
2,
|
|
|
|
),
|
|
|
|
(
|
|
|
|
config_entries.SOURCE_HOMEKIT,
|
|
|
|
HOMEKIT_DISCOVERY_GEN3,
|
|
|
|
3,
|
|
|
|
),
|
|
|
|
]
|
|
|
|
DHCP_DATA = [
|
|
|
|
(
|
|
|
|
config_entries.SOURCE_DHCP,
|
|
|
|
DHCP_DISCOVERY_GEN2,
|
|
|
|
2,
|
|
|
|
),
|
|
|
|
(
|
|
|
|
config_entries.SOURCE_DHCP,
|
|
|
|
DHCP_DISCOVERY_GEN3,
|
|
|
|
3,
|
|
|
|
),
|
Handle empty name in powerview config flow (#110969)
fixes
```
2024-02-19 13:51:58.128 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved: File "/Users/bdraco/home-assistant/venv/bin/hass", line 8, in <module>
sys.exit(main())
File "/Users/bdraco/home-assistant/homeassistant/__main__.py", line 209, in main
exit_code = runner.run(runtime_conf)
File "/Users/bdraco/home-assistant/homeassistant/runner.py", line 188, in run
return loop.run_until_complete(setup_and_run_hass(runtime_config))
File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py", line 673, in run_until_complete
self.run_forever()
File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py", line 640, in run_forever
self._run_once()
File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py", line 1965, in _run_once
handle._run()
File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/events.py", line 84, in _run
self._context.run(self._callback, *self._args)
File "/Users/bdraco/home-assistant/homeassistant/helpers/entity_platform.py", line 610, in async_add_entities
await add_func(coros, entities, timeout)
File "/Users/bdraco/home-assistant/homeassistant/helpers/entity_platform.py", line 561, in _async_add_entities
await coro
File "/Users/bdraco/home-assistant/homeassistant/helpers/entity_platform.py", line 652, in _async_add_entity
entity.add_to_platform_start(
File "/Users/bdraco/home-assistant/homeassistant/components/device_tracker/config_entry.py", line 356, in add_to_platform_start
_async_connected_device_registered(
File "/Users/bdraco/home-assistant/homeassistant/components/device_tracker/config_entry.py", line 94, in _async_connected_device_registered
async_dispatcher_send(
File "/Users/bdraco/home-assistant/homeassistant/helpers/dispatcher.py", line 227, in async_dispatcher_send
hass.async_run_hass_job(job, *args)
File "/Users/bdraco/home-assistant/homeassistant/core.py", line 701, in async_run_hass_job
hassjob.target(*args)
File "/Users/bdraco/home-assistant/homeassistant/util/logging.py", line 133, in _callback_wrapper
func(*args)
File "/Users/bdraco/home-assistant/homeassistant/components/dhcp/__init__.py", line 392, in _async_process_device_data
self.async_process_client(ip_address, hostname, mac_address)
File "/Users/bdraco/home-assistant/homeassistant/components/dhcp/__init__.py", line 268, in async_process_client
discovery_flow.async_create_flow(
File "/Users/bdraco/home-assistant/homeassistant/helpers/discovery_flow.py", line 32, in async_create_flow
hass.async_create_task(init_coro, f"discovery flow {domain} {context}")
File "/Users/bdraco/home-assistant/homeassistant/core.py", line 634, in async_create_task
task = self.loop.create_task(target, name=name)
Traceback (most recent call last):
File "/Users/bdraco/home-assistant/homeassistant/config_entries.py", line 1017, in async_init
flow, result = await self._async_init(flow_id, handler, context, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/bdraco/home-assistant/homeassistant/config_entries.py", line 1047, in _async_init
result = await self._async_handle_step(flow, flow.init_step, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/bdraco/home-assistant/homeassistant/data_entry_flow.py", line 501, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/bdraco/home-assistant/homeassistant/components/hunterdouglas_powerview/config_flow.py", line 127, in async_step_dhcp
return await self.async_step_discovery_confirm()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/bdraco/home-assistant/homeassistant/components/hunterdouglas_powerview/config_flow.py", line 152, in async_step_discovery_confirm
assert self.discovered_ip and self.discovered_name
AssertionError
```
2024-02-20 09:41:38 +00:00
|
|
|
(
|
|
|
|
config_entries.SOURCE_DHCP,
|
|
|
|
DHCP_DISCOVERY_GEN2_NO_NAME,
|
|
|
|
2,
|
|
|
|
),
|
2024-02-15 14:27:11 +00:00
|
|
|
]
|
|
|
|
ZEROCONF_DATA = [
|
|
|
|
(
|
|
|
|
config_entries.SOURCE_ZEROCONF,
|
|
|
|
ZEROCONF_DISCOVERY_GEN2,
|
|
|
|
2,
|
|
|
|
),
|
|
|
|
(
|
|
|
|
config_entries.SOURCE_ZEROCONF,
|
|
|
|
ZEROCONF_DISCOVERY_GEN3,
|
|
|
|
3,
|
|
|
|
),
|
|
|
|
]
|
|
|
|
DISCOVERY_DATA = HOMEKIT_DATA + DHCP_DATA + ZEROCONF_DATA
|