SecKatie / ha-wyzeapi

Home Assistant Integration for Wyze devices.
746 stars 114 forks source link

[Bug] Scene.create not working with Wyze bulbs #257

Closed drguitarum2005 closed 1 year ago

drguitarum2005 commented 3 years ago

Is there any reason to believe this integration would make the light entities act any different than other bulbs? I'm using a scene.create in a script to snapshot initial state before changing colors and brightness and then reverting to that initial scene. The scene.create doesn't seem to be writing anything. This exact code works fine with my Singled color bulbs. Thoughts?

sequence:
  - service: scene.create
    data:
      scene_id: entry_before
      snapshot_entities: light.entry_lamp
  - service: light.turn_on
    data:
      color_name: red
      flash: long
      brightness_pct: 25
    target:
      entity_id: light.entry_lamp
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 500
  - service: light.turn_on
    data:
      color_name: red
      brightness_pct: 25
      flash: long
    target:
      entity_id: light.entry_lamp
  - delay:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
  - service: scene.turn_on
    target:
      entity_id: scene.entry_before
mode: single
alias: Flash Entry Light Red
drguitarum2005 commented 3 years ago

Just speculation, since I don't have bulbs...

But I would suspect that it's related to the turn_on property being not implemented.

https://github.com/JoshuaMulliken/ha-wyzeapi/blob/525fd22866899539aee27e6d65ae649cd4c10bd5/custom_components/wyzeapi/light.py#L75

I think you may have to call async_turn_on as the service.

Thanks for the input. Do you mean call async_turn_on as the service instead of scene.turn_on? If so, I'm not sure that'll solve the problem of the scene not being created?

JoeSchubert commented 2 years ago

Were you able to figure this out? Or have any extra info?

bobloadmire commented 2 years ago

my issue may be related, but I can't control brightness on my bulbs either, so maybe related? only on/off

danielzrob commented 2 years ago

I have this exact issue, in fact I'm going to close my issue I just posted.. derp.

SecKatie commented 2 years ago

@danielzrob @bobloadmire @drguitarum2005 can someone test the latest beta and see if it is working for you? I made some changes that might fix this.

drguitarum2005 commented 2 years ago

@danielzrob @bobloadmire @drguitarum2005 can someone test the latest beta and see if it is working for you? I made some changes that might fix this.

No dice. Updated to the latest beta listed and tried a brand new script (same structure). It turns the light red but then it just stays red forever.

sequence:
  - service: scene.create
    data:
      scene_id: entry_before
      snapshot_entities: light.entry_lamp
  - service: light.turn_on
    data:
      color_name: red
    target:
      entity_id: light.entry_lamp
  - delay:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
  - scene: scene.entry_before
mode: single
danielzrob commented 2 years ago

I gave it a shot too, no joy.

SecKatie commented 2 years ago

Ok, I made a new change that seems to make my scenes in the UI more reliable. Sorry to keep asking yall to test, but I greatly appreciate the help in resolving this.

drguitarum2005 commented 2 years ago

Ok, I made a new change that seems to make my scenes in the UI more reliable. Sorry to keep asking yall to test, but I greatly appreciate the help in resolving this.

Unfortunately no dice.

JoeSchubert commented 2 years ago

Just curious... I don't have bulbs to test with, or I'd do it.

Has anyone changed their Home Assistant's logging to debug (globally, not just for this integration) and tried this to see what the logs show? I know it's going to be A LOT of log output, but grepping for "scene" I would imagine should get you in the ballpark of the relevant part, if you don't have a ton of scenes firing.

Edit: Technically, as long as you have something in a logging block in your config you can call the logger service before and after testing to minimize the extra noise as well.

service: logger.set_default_level data: level: debug

Then do the same thing back to warning or error.

gdreelin commented 2 years ago

Same here no ability for scenes

brg468 commented 2 years ago

sequence:

  • service: scene.create data: scene_id: entry_before snapshot_entities: light.entry_lamp
  • service: light.turn_on data: color_name: red target: entity_id: light.entry_lamp
  • delay: hours: 0 minutes: 0 seconds: 5 milliseconds: 0
  • scene: scene.entry_before mode: single

I just tried this exact script with a bulb and a light strip and it seemed to work as expected: two different starting colors, both went red for 5 seconds then back to the original colors.

Occasionally the color shown in the frontend went back to red for a bit (until the next update cycle) but the light itself was the correct color. Maybe something in the recent updates fixed it?

JoeSchubert commented 2 years ago

Maybe something in the recent updates fixed it?

I would guess maybe this fixed it wherever it got merged in?

https://github.com/JoshuaMulliken/ha-wyzeapi/commit/618210c4b5d50a8148b2b9c864c970129314f1bc

JoeSchubert commented 1 year ago

Closing as stale.

Please reopen if this is still ongoing.