Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

work_mode change can be lost if sent with brightness #43

Open
pabigot opened this issue Oct 28, 2021 · 1 comment
Open

work_mode change can be lost if sent with brightness #43

pabigot opened this issue Oct 28, 2021 · 1 comment

Comments

@pabigot
Copy link

pabigot commented Oct 28, 2021

As documented in home-assistant/core#58569, if an RGBCCT bulb is in work_mode colour, then sending a command that has switch_led, work_mode, and temp_value_v2 will correctly transition the bulb to color temperature mode at the requested brightness. I.e.:

{
  'switch_led': True,
  'work_mode': 'white',
  'temp_value_v2': 0,
  'bright_value_v2': 1000
}

will produce a response like:

{
  'switch_led': True,
  'work_mode': 'white',
  'bright_value_v2': 1000,
  'temp_value_v2': 0,
  'colour_data_v2': '{"h":30,"s":1000,"v":39}',
  'scene_data_v2': '{"scene_num":1,"scene_units"[{"bright":200,"h":0,"s":0,"temperature":0,"unit_change_mode":"static","unit_gradient_duration":13,"unit_switch_duration":14,"v":0}]}',
  'countdown_1': 0,
  'control_data': ''
}

However, a subsequent command that tries to change it back to colour with a different brightness:

{
  'switch_led': True,
  'work_mode': 'colour',
  'bright_value_v2': 49,
  'colour_data_v2': {"h": 20, "s": 1000, "v": 39},
}

will update the brightness and the colour_data, but not change work_mode, as demonstrated in the response:

{
  'switch_led': True,
  'work_mode': 'white',    <-- should have been updated to 'colour'
  'bright_value_v2': 49,
  'temp_value_v2': 0,
  'colour_data_v2': '{"h":20,"s":1000,"v":39}',
  'scene_data_v2': '{"scene_num":1,"scene_units":[{"bright":200,"h":0,"s":0,"temperature":0,"unit_change_mode":"static","unit_gradient_duration":13,"unit_switch_duration":14,"v":0}]}',
  'countdown_1': 0,
  'control_data': ''
}

The desired final state can only be achieved by sending two commands, one for the color setting, and one for brightness.

Reproduced in Home Assistant 2021.11.0b0 which is using tuya-iot-py-sdk 0.6.3.

@frenck
Copy link
Contributor

frenck commented Oct 28, 2021

You should report this @ Tuya itself, via the developer portal, not on the client library.

The client library cannot do anything about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants