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

Add zwave to zwave_js migration #56159

Merged
merged 22 commits into from
Sep 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
7e78cef
Add zwave to zwave_js migration
MartinHjelmare Aug 12, 2021
1ed039a
Remove ozw import flow
MartinHjelmare Sep 12, 2021
7fd32f4
Register zwave start zwave_js import flow
MartinHjelmare Sep 12, 2021
16992a0
Clean up zwave stale migration function
MartinHjelmare Sep 12, 2021
ff724f9
Test zwave zwave_js websocket import flow command
MartinHjelmare Sep 12, 2021
88cb092
Remove zwave ozw migration websocket import flow test
MartinHjelmare Sep 12, 2021
3d615a5
Remove ozw migration
MartinHjelmare Sep 12, 2021
84b66ec
Remove ozw migration websocket command
MartinHjelmare Sep 12, 2021
6705ef6
Update hassfest deps ignore list
MartinHjelmare Sep 12, 2021
2e151ec
Remove zwave after deps
MartinHjelmare Sep 12, 2021
e880660
Check if zwave_js migration has been done in zwave
MartinHjelmare Sep 12, 2021
9f6b4a8
Make get_legacy_zwave_migration a coroutine function
MartinHjelmare Sep 13, 2021
5eaba77
Remove not needed error log
MartinHjelmare Sep 13, 2021
2185156
Guard for any number of non resolvable entry duplicates
MartinHjelmare Sep 13, 2021
7aada75
Use walrus for unit
MartinHjelmare Sep 13, 2021
d84ae88
Use walrus for unit
MartinHjelmare Sep 13, 2021
f3d3a5d
Remove zwave refresh entity test
MartinHjelmare Sep 15, 2021
1f2395f
Fix missing await
MartinHjelmare Sep 28, 2021
4e589cd
Fix saving data after load
MartinHjelmare Sep 28, 2021
5654a97
Add node ready websocket command
MartinHjelmare Sep 28, 2021
15ba6b3
Register node ready command
MartinHjelmare Sep 28, 2021
d6e701a
Test node ready command
MartinHjelmare Sep 28, 2021
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
9 changes: 0 additions & 9 deletions homeassistant/components/ozw/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,6 @@ def __init__(self):
self.integration_created_addon = False
self.install_task = None

async def async_step_import(self, data):
MartinHjelmare marked this conversation as resolved.
Show resolved Hide resolved
"""Handle imported data.

This step will be used when importing data during zwave to ozw migration.
"""
self.network_key = data.get(CONF_NETWORK_KEY)
self.usb_path = data.get(CONF_USB_PATH)
return await self.async_step_user()

async def async_step_user(self, user_input=None):
"""Handle the initial step."""
if self._async_current_entries():
Expand Down
171 changes: 0 additions & 171 deletions homeassistant/components/ozw/migration.py

This file was deleted.

59 changes: 0 additions & 59 deletions homeassistant/components/ozw/websocket_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

from .const import ATTR_CONFIG_PARAMETER, ATTR_CONFIG_VALUE, DOMAIN, MANAGER
from .lock import ATTR_USERCODE
from .migration import async_get_migration_data, async_migrate, map_node_values

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -58,7 +57,6 @@
@callback
def async_register_api(hass):
"""Register all of our api endpoints."""
websocket_api.async_register_command(hass, websocket_migrate_zwave)
websocket_api.async_register_command(hass, websocket_get_instances)
websocket_api.async_register_command(hass, websocket_get_nodes)
websocket_api.async_register_command(hass, websocket_network_status)
Expand Down Expand Up @@ -168,63 +166,6 @@ def _get_config_params(node, *args):
return config_params


@websocket_api.require_admin
@websocket_api.async_response
@websocket_api.websocket_command(
{
vol.Required(TYPE): "ozw/migrate_zwave",
vol.Optional(DRY_RUN, default=True): bool,
}
)
async def websocket_migrate_zwave(hass, connection, msg):
"""Migrate the zwave integration device and entity data to ozw integration."""
if "zwave" not in hass.config.components:
_LOGGER.error("Can not migrate, zwave integration is not loaded")
connection.send_message(
websocket_api.error_message(
msg["id"], "zwave_not_loaded", "Integration zwave is not loaded"
)
)
return

zwave = hass.components.zwave
zwave_data = await zwave.async_get_ozw_migration_data(hass)
_LOGGER.debug("Migration zwave data: %s", zwave_data)

ozw_data = await async_get_migration_data(hass)
_LOGGER.debug("Migration ozw data: %s", ozw_data)

can_migrate = map_node_values(zwave_data, ozw_data)

zwave_entity_ids = [
entry["entity_entry"].entity_id for entry in zwave_data.values()
]
ozw_entity_ids = [entry["entity_entry"].entity_id for entry in ozw_data.values()]
migration_device_map = {
zwave_device_id: ozw_device_id
for ozw_device_id, zwave_device_id in can_migrate["device_entries"].items()
}
migration_entity_map = {
zwave_entry["entity_entry"].entity_id: ozw_entity_id
for ozw_entity_id, zwave_entry in can_migrate["entity_entries"].items()
}
_LOGGER.debug("Migration entity map: %s", migration_entity_map)

if not msg[DRY_RUN]:
await async_migrate(hass, can_migrate)

connection.send_result(
msg[ID],
{
"migration_device_map": migration_device_map,
"zwave_entity_ids": zwave_entity_ids,
"ozw_entity_ids": ozw_entity_ids,
"migration_entity_map": migration_entity_map,
"migrated": not msg[DRY_RUN],
},
)


@websocket_api.websocket_command({vol.Required(TYPE): "ozw/get_instances"})
def websocket_get_instances(hass, connection, msg):
"""Get a list of OZW instances."""
Expand Down
Loading