SecKatie / ha-wyzeapi

Home Assistant Integration for Wyze devices.
733 stars 112 forks source link

[Feature Request] Wyze Color Bulbs #126

Closed npeskoe closed 3 years ago

npeskoe commented 3 years ago

Wyze app is authenticating properly, but it is not finding bulb. Does this integration work with new color bulbs?

Logger: custom_components.wyzeapi Source: custom_components/wyzeapi/init.py:80 Integration: Wyze Bulb and Switch Api Integration (documentation) First occurred: 9:38:04 AM (1 occurrences) Last logged: 9:38:04 AM

WyzeApi authenticated but could not find any devices.


Wyze Bulb and Switch Home Assistant Integration Version: v0.5.12 This is a custom integration If you have any issues with this you need to open an issue here: https://github.com/JoshuaMulliken/ha-wyzeapi/issues

2021-03-31 09:37:57 DEBUG (MainThread) [custom_components.wyzeapi] Creating new WyzeApi component 2021-03-31 09:37:57 DEBUG (MainThread) [custom_components.wyzeapi.wyzeapi.client] Running login 2021-03-31 09:37:57 DEBUG (MainThread) [custom_components.wyzeapi.wyzeapi.client] Running __create_md5_md5 2021-03-31 09:38:01 WARNING (MainThread) [homeassistant.setup] Setup of zone is taking over 10 seconds. 2021-03-31 09:38:04 DEBUG (MainThread) [custom_components.wyzeapi] Connected to Wyze account 2021-03-31 09:38:04 DEBUG (MainThread) [custom_components.wyzeapi] Starting WyzeApi components 2021-03-31 09:38:04 DEBUG (MainThread) [custom_components.wyzeapi] Starting WyzeApi Lights 2021-03-31 09:38:04 ERROR (MainThread) [custom_components.wyzeapi] WyzeApi authenticated but could not find any devices. 2021-03-31 09:38:04 DEBUG (MainThread) [custom_components.wyzeapi.light] Creating new WyzeApi light component 2021-03-31 09:38:04 DEBUG (MainThread) [custom_components.wyzeapi.wyzeapi.client] Running list_bulbs 2021-03-31 09:38:04 DEBUG (MainThread) [custom_components.wyzeapi.wyzeapi.client] Running get_devices

SecKatie commented 3 years ago

It doesn't work with color bulbs yet. Mine are arriving soon and I will be adding support at that point

npeskoe commented 3 years ago

@JoshuaMulliken Thanks

ItsRhen commented 3 years ago

I second! 🙂 Just got mine and this would be great. Thanks a lot.

jscherry commented 3 years ago

Mine will arrive soon. Looking forward to getting color bulbs working. Thanks for writing this code guys

jscherry commented 3 years ago

There’s a remote control car coming out tomorrow that works with a v2 camera connection

SerpentDrago commented 3 years ago

There’s a remote control car coming out tomorrow that works with a v2 camera connection

you should check the date .......

SecKatie commented 3 years ago

There is a new beta out with support for the color bulbs. Please read the changelog before installing in case it breaks one of your use cases.

Please report any issues you find with the color bulb support

jscherry commented 3 years ago

Will the api for the color bulbs work with sensors and locks again soon? Just got my bulbs and would be glad to help any way I can. I'm a newb as far as burp goes but learn fast.

SecKatie commented 3 years ago

@jscherry I do not think that I will be bringing locks or sensors back. Sensors are losing support from wyze fast some information on this reasoning can be found here. For the locks, I don't have them and the only functionality currently is the binary sensor, too much effort to continue to maintain.

Mattie commented 3 years ago

It did seem to work with the first color bulb I tried. The problem I had is just having a Wyze watch in the account seemed to break it such that I didn't get a working light? Maybe I just wasn't seeing it. But I removed my watch and now I see one of my bulbs for sure.

2021-04-03 11:28:01 ERROR (MainThread) [homeassistant.components.switch] Error while setting up wyzeapi platform for switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 200, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/wyzeapi/switch.py", line 40, in setup_platform
    if DeviceTypes(device.product_type) == DeviceTypes.PLUG:
  File "/usr/local/lib/python3.8/enum.py", line 339, in __call__
    return cls.__new__(cls, value)
  File "/usr/local/lib/python3.8/enum.py", line 662, in __new__
    raise ve_exc
ValueError: 'Wrist' is not a valid DeviceTypes
2021-04-03 11:28:01 ERROR (MainThread) [homeassistant.components.light] Error while setting up wyzeapi platform for light
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 200, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/wyzeapi/light.py", line 48, in setup_platform
    if DeviceTypes(device.product_type) == DeviceTypes.LIGHT:
  File "/usr/local/lib/python3.8/enum.py", line 339, in __call__
    return cls.__new__(cls, value)
  File "/usr/local/lib/python3.8/enum.py", line 662, in __new__
    raise ve_exc
ValueError: 'Wrist' is not a valid DeviceTypes

Though as I removed that from my Wyze account (don't use it much), my first bulb appeared just fine. Time to add more of them. :) Thanks so much for working on this!

aasquith94 commented 3 years ago

With the new update the colors bulbs do not show but also my normal bulbs no longer show as well.

aasquith94 commented 3 years ago

Error while setting up wyzeapi platform for light Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 200, in _async_setup_platform await asyncio.shield(task) File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/wyzeapi/light.py", line 48, in setup_platform if DeviceTypes(device.product_type) == DeviceTypes.LIGHT: File "/usr/local/lib/python3.8/enum.py", line 339, in call return cls.new(cls, value) File "/usr/local/lib/python3.8/enum.py", line 662, in new raise ve_exc ValueError: 'BaseStation' is not a valid DeviceTypes

SecKatie commented 3 years ago

Hey @aasquith94 can you update to the latest beta and let me know if it is working?

aasquith94 commented 3 years ago

Same issue. Latest being Beta.4 correct? heres the logs incase theyre slightly different:

Logger: homeassistant.components.light Source: custom_components/wyzeapi/light.py:48 Integration: Light (documentation, issues) First occurred: 7:16:20 PM (1 occurrences) Last logged: 7:16:20 PM

Error while setting up wyzeapi platform for light Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 200, in _async_setup_platform await asyncio.shield(task) File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/wyzeapi/light.py", line 48, in setup_platform if DeviceTypes(device.product_type) == DeviceTypes.LIGHT: File "/usr/local/lib/python3.8/enum.py", line 339, in call return cls.new(cls, value) File "/usr/local/lib/python3.8/enum.py", line 662, in new raise ve_exc ValueError: 'BaseStation' is not a valid DeviceTypes

Logger: homeassistant.components.switch Source: custom_components/wyzeapi/switch.py:40 Integration: Switch (documentation, issues) First occurred: 7:16:20 PM (1 occurrences) Last logged: 7:16:20 PM

Error while setting up wyzeapi platform for switch Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 200, in _async_setup_platform await asyncio.shield(task) File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/wyzeapi/switch.py", line 40, in setup_platform if DeviceTypes(device.product_type) == DeviceTypes.PLUG: File "/usr/local/lib/python3.8/enum.py", line 339, in call return cls.new(cls, value) File "/usr/local/lib/python3.8/enum.py", line 662, in new raise ve_exc ValueError: 'BaseStation' is not a valid DeviceTypes

SecKatie commented 3 years ago

Ok. Can you try beta.5?

WBETHERI commented 3 years ago

Mine will also not start -- looks like having the Wyze Scale on my account is bricking the DeviceTypes() check from wyzeapy. I'd try and do a PR (just for an error handling stub so it doesn't brick-- I know there's a separate issue for scale support) but that repo's not public! Haha.

My trace:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 200, in _async_setup_platform await asyncio.shield(task) File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/wyzeapi/light.py", line 48, in setup_platform if DeviceTypes(device.product_type) == DeviceTypes.LIGHT: File "/usr/local/lib/python3.8/enum.py", line 339, in call return cls.new(cls, value) File "/usr/local/lib/python3.8/enum.py", line 662, in new raise ve_exc ValueError: 'WyzeScale' is not a valid DeviceTypes

SecKatie commented 3 years ago

Awesome. I have added WyzeScale!

New beta is available. I know that this is a painful process, but it is helping me build an understanding of all the different devices that exist in the ecosystem.

aasquith94 commented 3 years ago

Beta 5 worked for me, thanks so much. ill update to beta 6 and test as well

WBETHERI commented 3 years ago

Beta 6 and the color bulbs work now (not getting hung up on WyzeScale).

SecKatie commented 3 years ago

That is great! @aasquith94 @WBETHERI

Thank you for your help with testing!

amitvaria commented 3 years ago

In my testing, I am having issues getting automation working. The scene is created, the lights brightness is set, but the rgb_color isn't set. I can change the color from developer tools

Here's the automation:

alias: DoorDashArriving
description: ''
trigger:
  - platform: event
    event_type: ifttt_webhook_received
    event_data:
      action: "doordash_arriving"
condition: []
action:
  - service: scene.create
    data:
      scene_id: dd_before
      snapshot_entities: 
        - light.amit_office_1
        - light.amit_office_2
        - light.amit_office_3
  - service: light.turn_on
    data:
      rgb_color:
        - 255
        - 0
        - 0
      brightness: 5
    target:
      entity_id:
        - light.amit_office_1
        - light.amit_office_2
        - light.amit_office_3
  - delay: 00:00:04
  - service: scene.turn_on
    data:
      entity_id: scene.dd_before

Here's the developer tools service:

service: light.turn_on
data:
  color_name: darkmagenta
target:
  entity_id:
    - light.amit_office_1
    - light.amit_office_2
    - light.amit_office_3
drguitarum2005 commented 3 years ago

Beta 7 still having issues. What is the "common" device type? I have cameras, headphones, and color bulbs on my Wyze account.

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 200, in _async_setup_platform await asyncio.shield(task) File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/wyzeapi/light.py", line 48, in setup_platform if DeviceTypes(device.product_type) == DeviceTypes.LIGHT: File "/usr/local/lib/python3.8/enum.py", line 339, in call return cls.new(cls, value) File "/usr/local/lib/python3.8/enum.py", line 662, in new raise ve_exc ValueError: 'Common' is not a valid DeviceTypes

amitvaria commented 3 years ago

When I turn on debugging, I see that activating the scene is trying to set both brightness and hs_color:

2021-04-05 21:32:35 DEBUG (SyncWorker_10) [custom_components.wyzeapi.light] {'brightness': 1, 'hs_color': (33.333, 14.118)}
2021-04-05 21:32:35 DEBUG (SyncWorker_10) [custom_components.wyzeapi.light] Setting brightness

I think my issue comes from this. Preference is given to brightness and color is skipped.

SecKatie commented 3 years ago

Ok, fixes for both of those issues is in beta 8.1.

Please let me know if it is working now. I working to get this release pulled into master as a new stable release.

amitvaria commented 3 years ago

Tested my issue and it's resolved. Thanks!

SecKatie commented 3 years ago

Great!

drguitarum2005 commented 3 years ago

My issue about 'common' is resolved and I have my 4 bulbs loaded in.

Another small bug: in Wyze app, you can group 2+ bulbs together and they all change colors together. I have 2 of mine paired that way. Through HA, neither one will change colors until I move the slider on BOTH entities.

etchings13 commented 3 years ago

I am also getting an error trying to set these up:

Error while setting up wyzeapi platform for light Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 200, in _async_setup_platform await asyncio.shield(task) File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/wyzeapi/light.py", line 48, in setup_platform if DeviceTypes(device.product_type) == DeviceTypes.LIGHT: File "/usr/local/lib/python3.8/enum.py", line 339, in call return cls.new(cls, value) File "/usr/local/lib/python3.8/enum.py", line 662, in new raise ve_exc ValueError: 'JA_RO2' is not a valid DeviceTypes

If it helps, the Devices I have in my account are the Wyze Vacuum, Wyze Doorbell, two Cam v2s and one Cam v3. That is in addition to the new 4-pack of color bulbs obviously.

amitvaria commented 3 years ago

My issue about 'common' is resolved and I have my 4 bulbs loaded in.

Another small bug: in Wyze app, you can group 2+ bulbs together and they all change colors together. I have 2 of mine paired that way. Through HA, neither one will change colors until I move the slider on BOTH entities.

I'm not sure I understand exactly the issue you're seeing, but I manually created similar light_groups in HA like this:

light:
  - platform: group
    name: Amit Office Lights
    entities:
      - light.amit_office_1
      - light.amit_office_2
      - light.amit_office_3
  - platform: group
    name: Gym Lights
    entities:
      - light.gym_1
      - light.gym_2
      - light.gym_3

Then you can adjust the bulbs like you can in the Wyze app: image

mullethunter324 commented 3 years ago

Getting the following errors. I have removed my Wyze app bulb grouping to reduce complexity.

Switch: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 200, in _async_setup_platform await asyncio.shield(task) File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/wyzeapi/switch.py", line 40, in setup_platform if DeviceTypes(device.product_type) == DeviceTypes.PLUG: File "/usr/local/lib/python3.8/enum.py", line 339, in call return cls.new(cls, value) File "/usr/local/lib/python3.8/enum.py", line 662, in new raise ve_exc ValueError: 'JA_RO2' is not a valid DeviceTypes

Light: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 200, in _async_setup_platform await asyncio.shield(task) File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/wyzeapi/light.py", line 48, in setup_platform if DeviceTypes(device.product_type) == DeviceTypes.LIGHT: File "/usr/local/lib/python3.8/enum.py", line 339, in call return cls.new(cls, value) File "/usr/local/lib/python3.8/enum.py", line 662, in new raise ve_exc ValueError: 'JA_RO2' is not a valid DeviceTypes

drguitarum2005 commented 3 years ago

My issue about 'common' is resolved and I have my 4 bulbs loaded in. Another small bug: in Wyze app, you can group 2+ bulbs together and they all change colors together. I have 2 of mine paired that way. Through HA, neither one will change colors until I move the slider on BOTH entities.

I'm not sure I understand exactly the issue you're seeing, but I manually created similar light_groups in HA like this:

light:
  - platform: group
    name: Amit Office Lights
    entities:
      - light.amit_office_1
      - light.amit_office_2
      - light.amit_office_3
  - platform: group
    name: Gym Lights
    entities:
      - light.gym_1
      - light.gym_2
      - light.gym_3

Then you can adjust the bulbs like you can in the Wyze app: image

Thats not a bad way to do it. I'll revert to that if I need to. The issue comes up if you do the grouping within the Wyze app, the grouping doesn't automatically load into HA so you try to adjust one light in HA but nothing responds until you've adjusted all the lights in that group in HA to the same settings.

aasquith94 commented 3 years ago

My main issue is in scenes. If i select a color temp for the bulb for a normal non color light and run the scene it sets the bulb to the last selected color. so if the circle has purple selected for example, and in the scene i move the color temp slider to warm white and hit save its saving as purple.

SecKatie commented 3 years ago

Working on adding "JA_RO2" as a recognized device

SecKatie commented 3 years ago

@mullethunter324 can you test the latest beta.9?

mullethunter324 commented 3 years ago

@mullethunter324 can you test the latest beta.9?

Looking good for me now. Switch and bulbs came in. No errors. Going to test with wyze app bulb grouping later.

etchings13 commented 3 years ago

I am also getting an error trying to set these up:

Error while setting up wyzeapi platform for light Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 200, in _async_setup_platform await asyncio.shield(task) File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, self.kwargs) File "/config/custom_components/wyzeapi/light.py", line 48, in setup_platform if DeviceTypes(device.product_type) == DeviceTypes.LIGHT: File "/usr/local/lib/python3.8/enum.py", line 339, in call return cls.new(cls, value) File "/usr/local/lib/python3.8/enum.py", line 662, in new** raise ve_exc ValueError: 'JA_RO2' is not a valid DeviceTypes

If it helps, the Devices I have in my account are the Wyze Vacuum, Wyze Doorbell, two Cam v2s and one Cam v3. That is in addition to the new 4-pack of color bulbs obviously.

beta.9 seems to have fixed the issue for me!

drguitarum2005 commented 3 years ago

If I accidentally do a couple of rapid state changes (off and on), the switch and icon get out of sync and it’ll update after maybe 15 seconds (HA says light is off but it’s really on). Does that have anything to do with this integration?

SecKatie commented 3 years ago

The Wyze service does not reflect the valid state of the device immediately. It takes about 15 seconds for it to be correct.

tggman commented 3 years ago

Just added two color bulbs via the Wyze app, updated HAC to 2021.4 and switched to HA-WyzeAPI to 2021.4-beta.10.1.

Unfortunately 2021.4-beta.10.1 is not working for me. From the error log:

Logger: homeassistant.components.light Source: custom_components/wyzeapi/light.py:48 Integration: Light (documentation, issues) First occurred: 4:44:48 PM (1 occurrences) Last logged: 4:44:48 PM

Error while setting up wyzeapi platform for light Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 205, in _async_setup_platform await asyncio.shield(task) File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/wyzeapi/light.py", line 48, in setup_platform if DeviceTypes(device.product_type) == DeviceTypes.LIGHT: File "/usr/local/lib/python3.8/enum.py", line 339, in call return cls.new(cls, value) File "/usr/local/lib/python3.8/enum.py", line 662, in new raise ve_exc ValueError: 'JA.SC' is not a valid DeviceTypes

Switching back to the stable release brings my non-color lights back. Devices in my account: (1) Wyze Doorbell (1) Wyze Vacuum (1) Scale (1) Cam Pan (2) Cam v3 (2) Color bulbs (7) white bulbs (1) Wyze Headphone