sbidy / wiz_light

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

Change light definition to use names, not IP addressess. #171

Closed Dewsweeper closed 2 years ago

Dewsweeper commented 2 years ago

I have twelve WiZ lights in my configuration. Setup was difficult because associating the IP address with each bulb is complicated. After all lights were configured and working correctly with Home Assistant, by house lost power, my router rest, the dynamic addresses of all of my Wiz bulbs changed, and they became invisible to Home Assistant.

Is there a way to use static addresses, or better, to associate using the names defined in the phone app?

sjee commented 2 years ago

This has happened to me. My lights were setup in the configuration.yaml file. I've added comments to make it easier to rectify such problems (luckily it doesn't happen to often). It allows me to find the new IP-address on my service provider's modemrouter and then update the Yaml file accordingly.

Example:

  - platform: wiz_light
    name: Wiz Light 3
    host: 192.168.0.242 # wiz_777e5e --> A8:BB:50:77:7E:5E --> LED Strip (Ceiling Office)
  - platform: wiz_light
    name: Wiz Light 4
    host: 192.168.0.158 # wiz_6dac26 --> A8:BB:50:6D:AC:26 --> Ikea bottom light (Office)
  - platform: wiz_light
    name: Wiz Light 5
    host: 192.168.0.103 # wiz_7ff888 --> A8:BB:50:7F:F8:88 --> Billy Kast (Office)
  - platform: wiz_light
    name: Wiz Light 7
    host: 192.168.0.236 # wiz_6db768 --> A8:BB:50:6D:B7:68 --> Ikea top ball (Bathroom)
  - platform: wiz_light
    name: Wiz Light 8
    host: 192.168.0.145 # wiz_6dba1c --> A8:BB:50:6D:BA:1C --> Ikea top light (Office)
  - platform: wiz_light
    name: Wiz Light 9
    host: 192.168.0.117 # wiz_6f7a8e --> A8:BB:50:6F:7A:8E --> Display Case --> (Candle in living room)

Router:

A possible work around for your issue might be to assign fixed IP address to the Wiz light bulbs in your router. Unfortunately my service provider's modemrouter does not allow me to do this, so I've not been able to try that yet. I'll probably get a second router at some point which does allow for this and also put all the IoT devices on a separate Wifi SSID (just for a little extra security).

Code:

The device id (eg. wiz_777e5e) and the MAC address (eg. A8:BB:50:77:7E:5E) never changes and I wonder if it's possible to use this information to reassign the IP address in Home Assistant. Alas, I don't know Python and I do not know if that information is even available to the developer. But, my guess is that the Wiz-app does use that information, since it always finds the bulbs even when an IP-address changes.

blkrx7 commented 2 years ago

Hi folks,

Try using the DNS name for the bulb instead of the IP in HA. Some (most?) routers will attempt to resolve dns queries without a domain suffix, or with a local domain suffix (.lan .local, etc) from it's internal DHCP table. So if your bulbs get shuffled via DHCP, the router will return their new IP.

You can test your local setup my pinging the bulbs host name from a command prompt/shell (usually wiz_123456, where "123456" are the last 6 digits from the MAC address listed in the wiz app)

command prompt: ping wiz_a541b7 Pinging wix_a541b7.lan [192.168.1.150] with 32 bytes of data: Reply from 192.168.1.150: bytes=32 etc etc ad nauseum.

If that doesn't work, some routers append '.lan' or '.local' to local host names, you can try to ping your wiz light via 'ping wiz_a541b7.lan' or 'ping wiz_a541b7.local' etc to see if it'll resolve that. Mine appends '.lan' and will resolve with, or without that extension.

This works with either the Wiz integration via HACS, or a manual installation and .yaml setup.

Cheers,

On Tue, Sep 14, 2021 at 7:18 AM sjee @.***> wrote:

This has happened to me. My lights were setup in the configuration.yaml file. I've added comments to make it easier to rectify such problems (luckily it doesn't happen to often). It allows me to find the new IP-address on my service provider's modemrouter and then update the Yaml file accordingly.

Example:

  • platform: wiz_light name: Wiz Light 3 host: 192.168.0.242 # wiz_777e5e --> A8:BB:50:77:7E:5E --> LED Strip (Ceiling Office)
  • platform: wiz_light name: Wiz Light 4 host: 192.168.0.158 # wiz_6dac26 --> A8:BB:50:6D:AC:26 --> Ikea bottom light (Office)
  • platform: wiz_light name: Wiz Light 5 host: 192.168.0.103 # wiz_7ff888 --> A8:BB:50:7F:F8:88 --> Billy Kast (Office)
  • platform: wiz_light name: Wiz Light 7 host: 192.168.0.236 # wiz_6db768 --> A8:BB:50:6D:B7:68 --> Ikea top ball (Bathroom)
  • platform: wiz_light name: Wiz Light 8 host: 192.168.0.145 # wiz_6dba1c --> A8:BB:50:6D:BA:1C --> Ikea top light (Office)
  • platform: wiz_light name: Wiz Light 9 host: 192.168.0.117 # wiz_6f7a8e --> A8:BB:50:6F:7A:8E --> Display Case --> (Candle in living room)

Router:

A possible work around for your issue might be to assign fixed IP address to the Wiz light bulbs in your router. Unfortunately my server provider's modemrouter does not allow me to do this, so I've not been able to try that yet. I'll probably get a second router at some point which does allow for this and also put all the IoT devices on a separate Wifi SSID (just for a little extra security).

Code:

The device id (eg. wiz_777e5e) and the MAC address (eg. A8:BB:50:77:7E:5E) never changes and I wonder if it's possible to use this information to reassign the IP address in Home Assistant. Alas, I don't know Python and I do not know if that information is even available to the developer. But, my guess is that the Wiz-app does use that information, since it always finds the bulbs even when an IP-address changes.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sbidy/wiz_light/issues/171#issuecomment-919055839, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOYDER65J6T3N5JRWX2F34TUB4VPZANCNFSM5D6YG2GA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

RaptorPR443 commented 2 years ago

Change the ip of the light bulbs to static in routers config and if the router turns off, if there's a power outage and when it comes back online it assigns the static ip to the bulbs using its mac address.

Dewsweeper commented 2 years ago

Thank you all for your prompt responses. Since I lost power again last night and my lights did not recover as expected, I was inspired to revisit the issue.

I have three TP-Link Deco devices in my network, which offer "address reservation" (DNS static addressing) through a phone app. The Deco app Address Reservation is shown in the advanced tab displaying a list of all clients. The WiZ lights are clearly labelled by 'wiz_xxxxxx', where xxxxxx are the last six characters of the MAC address. I selected all of the WiZ lights and Done with the existing addresses being reserved.

This should resolve the issue. Thanks again.

On Tue, Sep 14, 2021 at 7:18 AM sjee @.***> wrote:

This has happened to me. My lights were setup in the configuration.yaml file. I've added comments to make it easier to rectify such problems (luckily it doesn't happen to often). It allows me to find the new IP-address on my service provider's modemrouter and then update the Yaml file accordingly.

Example:

  • platform: wiz_light name: Wiz Light 3 host: 192.168.0.242 # wiz_777e5e --> A8:BB:50:77:7E:5E --> LED Strip (Ceiling Office)
  • platform: wiz_light name: Wiz Light 4 host: 192.168.0.158 # wiz_6dac26 --> A8:BB:50:6D:AC:26 --> Ikea bottom light (Office)
  • platform: wiz_light name: Wiz Light 5 host: 192.168.0.103 # wiz_7ff888 --> A8:BB:50:7F:F8:88 --> Billy Kast (Office)
  • platform: wiz_light name: Wiz Light 7 host: 192.168.0.236 # wiz_6db768 --> A8:BB:50:6D:B7:68 --> Ikea top ball (Bathroom)
  • platform: wiz_light name: Wiz Light 8 host: 192.168.0.145 # wiz_6dba1c --> A8:BB:50:6D:BA:1C --> Ikea top light (Office)
  • platform: wiz_light name: Wiz Light 9 host: 192.168.0.117 # wiz_6f7a8e --> A8:BB:50:6F:7A:8E --> Display Case --> (Candle in living room)

Router:

A possible work around for your issue might be to assign fixed IP address to the Wiz light bulbs in your router. Unfortunately my server provider's modemrouter does not allow me to do this, so I've not been able to try that yet. I'll probably get a second router at some point which does allow for this and also put all the IoT devices on a separate Wifi SSID (just for a little extra security).

Code:

The device id (eg. wiz_777e5e) and the MAC address (eg. A8:BB:50:77:7E:5E) never changes and I wonder if it's possible to use this information to reassign the IP address in Home Assistant. Alas, I don't know Python and I do not know if that information is even available to the developer. But, my guess is that the Wiz-app does use that information, since it always finds the bulbs even when an IP-address changes.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sbidy/wiz_light/issues/171#issuecomment-919055839, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKEVVYJJJTKSTPZ4L4IGECTUB4VPVANCNFSM5D6YG2GA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

sbidy commented 2 years ago

@all Thank you for helping her!

The best practice (as mentioned) is to use DNS names of the bulbs (wiz_<last part of the MAC>) in the configuration. Or you use IP address reservations.