sbidy / wiz_light

A WiZ Light integration for Home Assistant
MIT License
341 stars 68 forks source link

Unable to add hostname through Add Integration UI #221

Closed klDen closed 2 years ago

klDen commented 2 years ago

Hi!

First thanks a lot for this project!

After upgrading to wiz_light 0.4.5 and trying to add a light using the hostname wiz_3eb6ff, I get the following error message: image

I can confirm Home Assistant OS is able to reach the device: image

rforbessr commented 2 years ago

This may or may not be the same - After installing the latest version I am unable to setup a light using the IP address or host name. I get the same error KLDEN gets - I have included what I see in the logs - It is the same when trying either method:

Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request resp = await request_handler(request) File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 504, in _handle resp = await handler(request) File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 117, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 98, in forwarded_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 181, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 137, in handle result = await result File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 157, in post return await super().post(request, flow_id) File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 62, in wrapper result = await method(view, request, *args, **kwargs) File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post result = await self._flow_mgr.async_configure(flow_id, data) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 252, in async_configure result = await self._async_handle_step(flow, cur_step["step_id"], user_input) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 325, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) File "/config/custom_components/wiz_light/config_flow.py", line 47, in async_step_user await self.async_set_unique_id(mac) UnboundLocalError: local variable 'mac' referenced before assignment

sbidy commented 2 years ago

Should be fixed with the 0.4.5b release. This was an issue with the exception handling.

klDen commented 2 years ago

Should be fixed with the 0.4.5b release. This was an issue with the exception handling.

Great! Thanks for the update!

rforbessr commented 2 years ago

Thank you - !!

rforbessr commented 2 years ago

Just downloaded the latest - I still have issues - unfortunately I cannot find anything in the logs this time - When using the hostname I get - "The bulb cannot be connected via the WIZ Light integration"

image

and when using an IP I get "Cannot connect to bulb. Maybe the bulb is offline or a wrong ip/host was entered. Please turn on the light and try again."

image

The host and ip are correct - Both are listed in Unifi and in the WIZ app - I can ping both hostname and ip from HA console.

I have model ID 7002 and Firmware 1.24.0

Thanks

FroodyHoop commented 2 years ago

I'm also having the exact same issue with 0.4.5b. Updating from 0.4.0. I'm getting identical errors as rforbessr reports when using the hostname or IP. I can both ping from the HA console and control the light from the WIZ app.

Correction: after trying a few more times the bulb did get added OK. Everything seems to be working well!

FCCMac commented 2 years ago

I'm still seeing the same issue on 0.4.5b. Ping from HA to the hostname is working just fine but I'm seeing the same message: "The bulb can not be connected via WiZ Light integration. Does anyone have any thoughts?

andrei-lazarov commented 2 years ago

Same issue on my end. Adding with IP works, but not with hostname. Pinging works: ping wiz_123456 or ping wiz_123456.local on some devices. Would love to help but not sure how.

m4ttr commented 2 years ago

I had the same issue described here. I tried to dump the traffic from my HA server using tcpdump. I was able to see the traffic leave if I used the IP of the wiz light. I see no UDP traffic 53 or 38899 if I use the hostname

I am able to ping the hostname from the HA console ping wiz_12344works. `host wiz_12344' also works.

When I check the DNS logs:

Screen Shot 2022-01-18 at 8 11 04 PM

appears that we are getting the search domain added and that might be causing dns to not work.

Instead if I a "." To the end of the name, it works!

wiz_12345. Works!

Code-Jelle commented 2 years ago

Update. Issue still present. wiz12345. doesn't work for me.

pedrohessy commented 2 years ago

also having this issue on 0.4.5b

lotablet commented 2 years ago

same issue here. cannot add anything.

EDIT. i fixed with "Enable local comunication" in wiz app (i don't know why it was disabled 🤣) i added all my bulbs with ip address and all is working fine now

petebowden commented 2 years ago

The fix suggested by @m4ttr worked for me.

sbidy commented 2 years ago

It can be possible that the DNS lookup fails from the HASS into your network. In general, this is not directly an issue from the integration itself. It is also possible that a IPv6/4 issue occurs at the DNS lookup.

If you can't add the bulb via DNS names, please make a fallback to the IP of the bulb.

petebowden commented 2 years ago

Just to clarify, I was able to resolve the hostnames via the shell on my HASS. It would not resolve in the ui without the additional . (dot) added to the hostname.

e.g. wiz_aabbcc did not work, but wiz_aabbcc. did properly resolve.