Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make zwave_js discovery log message more descriptive #55432

Merged
merged 1 commit into from
Aug 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/zwave_js/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ async def async_on_node_ready(node: ZwaveNode) -> None:
value_updates_disc_info: dict[str, ZwaveDiscoveryInfo] = {}

# run discovery on all node values and create/update entities
for disc_info in async_discover_values(node):
for disc_info in async_discover_values(node, device):
platform = disc_info.platform

# This migration logic was added in 2021.3 to handle a breaking change to
Expand Down
11 changes: 9 additions & 2 deletions homeassistant/components/zwave_js/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from zwave_js_server.model.value import Value as ZwaveValue

from homeassistant.core import callback
from homeassistant.helpers.device_registry import DeviceEntry

from .const import LOGGER
from .discovery_data_template import (
Expand Down Expand Up @@ -667,7 +668,9 @@ def get_config_parameter_discovery_schema(


@callback
def async_discover_values(node: ZwaveNode) -> Generator[ZwaveDiscoveryInfo, None, None]:
def async_discover_values(
node: ZwaveNode, device: DeviceEntry
) -> Generator[ZwaveDiscoveryInfo, None, None]:
"""Run discovery on ZWave node and return matching (primary) values."""
for value in node.values.values():
for schema in DISCOVERY_SCHEMAS:
Expand Down Expand Up @@ -758,7 +761,11 @@ def async_discover_values(node: ZwaveNode) -> Generator[ZwaveDiscoveryInfo, None
resolved_data = schema.data_template.resolve_data(value)
except UnknownValueData as err:
LOGGER.error(
"Discovery for value %s will be skipped: %s", value, err
"Discovery for value %s on device '%s' (%s) will be skipped: %s",
value,
device.name_by_user or device.name,
node,
err,
)
continue
additional_value_ids_to_watch = schema.data_template.value_ids_to_watch(
Expand Down