Don't add extra entities for zwave_js controller (#67209)

* Don't add extra entities for zwave_js controller

* Revert reformat of controller_state

* fix indentation issues

* fix indentation issues
This commit is contained in:
Raman Gupta 2022-02-25 01:39:30 -05:00 committed by GitHub
parent 7842d12b75
commit ad4409bcb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
49 changed files with 247 additions and 54 deletions

View file

@ -293,17 +293,19 @@ async def async_setup_entry( # noqa: C901
async def async_on_node_added(node: ZwaveNode) -> None:
"""Handle node added event."""
# Create a node status sensor for each device
await async_setup_platform(SENSOR_DOMAIN)
async_dispatcher_send(
hass, f"{DOMAIN}_{entry.entry_id}_add_node_status_sensor", node
)
# No need for a ping button or node status sensor for controller nodes
if not node.is_controller_node:
# Create a node status sensor for each device
await async_setup_platform(SENSOR_DOMAIN)
async_dispatcher_send(
hass, f"{DOMAIN}_{entry.entry_id}_add_node_status_sensor", node
)
# Create a ping button for each device
await async_setup_platform(BUTTON_DOMAIN)
async_dispatcher_send(
hass, f"{DOMAIN}_{entry.entry_id}_add_ping_button_entity", node
)
# Create a ping button for each device
await async_setup_platform(BUTTON_DOMAIN)
async_dispatcher_send(
hass, f"{DOMAIN}_{entry.entry_id}_add_ping_button_entity", node
)
# we only want to run discovery when the node has reached ready state,
# otherwise we'll have all kinds of missing info issues.