Config flow could not be loaded when trying to install Z-Wave integration

I’m running Homeassistant Core 2023.4.6 and trying to install the Z-wave integration. I already have Z-wave JS UI running as a docker instance.

When I tried to install the integration in HASS, I got a spinner for about 5 seconds, and then this error message:
Config flow could not be loaded: {"message":"Invalid handler specified"}

In the logs:

For further information visit https://errors.pydantic.dev/2.3/u/import-error
2023-09-04 21:15:23.925 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration zwave_js: `pydantic:create_model_from_typeddict` has been removed in V2.

For further information visit https://errors.pydantic.dev/2.3/u/import-error

FWIW, whenever I try to install again, it instantly shows the error message ( no spinner). I’m not sure how to remove the integration and try again, if that would help.

Any suggestions? Have looked around at:

Related to Pydantic v2 migration issue · Issue #99218 · home-assistant/core · GitHub .

I’m not sure what is pulling in Pydantic v2 (whether it is HA Core or some integration), but zwave-js obviously doesn’t like it. Unfortunately I don’t think I can help you directly, but this may be helpful for others coming across this post:

I fixed this locally by downgrading Pydantic. I’m not sure how to do this with HA-Core since I use Docker, but to work around this issue with Docker I built a new image with downgraded Pydantic like so:

Create a Dockerfile with these contents:

FROM homeassistant/home-assistant:latest
RUN pip install --force-reinstall --upgrade "pydantic<2"

Build this image by running docker build . -t homeassistant-pdv1

and now you have a new docker image, ‘homeassistant-pdv1’ which is “home-assistant:latest” with a downgrade to pydantic < 2.0.0 included. Run with this image instead of ‘home-assistant:latest’ to locally work around this issue with docker.