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

New device request: "Smart Color String Light" #255

Closed
Swiftnesses opened this issue Oct 27, 2022 · 18 comments
Closed

New device request: "Smart Color String Light" #255

Swiftnesses opened this issue Oct 27, 2022 · 18 comments

Comments

@Swiftnesses
Copy link

Hi, I have a new request for "Smart Color String Light" to be added.

This is the payload from the Tuya developer portal:

{
  "result": {
    "category": "dc",
    "functions": [
      {
        "code": "switch_led",
        "dp_id": 20,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "work_mode",
        "dp_id": 21,
        "type": "Enum",
        "values": "{\"range\":[\"white\",\"colour\"]}"
      },
      {
        "code": "bright_value",
        "dp_id": 22,
        "type": "Integer",
        "values": "{\"unit\":\"\",\"min\":25,\"max\":255,\"scale\":0,\"step\":1}"
      },
      {
        "code": "temp_value",
        "dp_id": 23,
        "type": "Integer",
        "values": "{\"unit\":\"\",\"min\":0,\"max\":255,\"scale\":0,\"step\":1}"
      },
      {
        "code": "colour_data",
        "dp_id": 24,
        "type": "Json",
        "values": "{\"h\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":360,\"step\":1},\"s\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1},\"v\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1}}"
      }
    ],
    "status": [
      {
        "code": "switch_led",
        "dp_id": 20,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "work_mode",
        "dp_id": 21,
        "type": "Enum",
        "values": "{\"range\":[\"white\",\"colour\"]}"
      },
      {
        "code": "bright_value",
        "dp_id": 22,
        "type": "Integer",
        "values": "{\"unit\":\"\",\"min\":25,\"max\":255,\"scale\":0,\"step\":1}"
      },
      {
        "code": "temp_value",
        "dp_id": 23,
        "type": "Integer",
        "values": "{\"unit\":\"\",\"min\":0,\"max\":255,\"scale\":0,\"step\":1}"
      },
      {
        "code": "colour_data",
        "dp_id": 24,
        "type": "Json",
        "values": "{\"h\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":360,\"step\":1},\"s\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1},\"v\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1}}"
      }
    ]
  },
  "success": true,
  "t": 1666872192924,
  "tid": "54ece6a755ef11edb3e0e68f1605df98"
}
@make-all
Copy link
Owner

Are you able to capture the local data? In particular the colour_data (24) field, as the Json type is rarely sent as Json on the local protocol.

@Swiftnesses
Copy link
Author

Hi @make-all, where can I find this info for you, in the developer portal?

@make-all
Copy link
Owner

No the developer portal is showing only the cloud data. If you attempt to add the light to the tuya-local integration, there should be a warning level log message in the home assistant log telling you that an exact match cannot be found for your device, and showing the local data received from the connection attempt.

@Swiftnesses
Copy link
Author

I see this, not sure if it's helpful?

Logger: custom_components.tuya_local.config_flow
Source: custom_components/tuya_local/config_flow.py:35
Integration: Tuya Local ([documentation](https://github.com/make-all/tuya-local), [issues](https://github.com/make-all/tuya-local/issues))
First occurred: 8:41:22 AM (2 occurrences)
Last logged: 8:41:22 AM

Device matches None with quality of 0%. DPS: {'20': False, '21': 'scene9', '22': 255, '23': 0, '24': 'c9ff4d004eb2ff', '101': 'ffff0502ff0000ffff00', 'updated_at': 1666942882.6700206}
Report this to https://github.com/make-all/tuya-local/issues/

@Swiftnesses
Copy link
Author

Unrelated, but I also see this, do you need a bug report?

Logger: homeassistant.util.yaml.loader
Source: util/yaml/loader.py:155
First occurred: 8:41:22 AM (1 occurrences)
Last logged: 8:41:22 AM

YAML file /config/custom_components/tuya_local/devices/sendo_airconditioner_c.yaml contains duplicate key "category". Check lines 91 and 93

@make-all
Copy link
Owner

On the config error, thanks, that was not flagged up by the tests for some reason. No need for a separate report.

The local info above is enough thanks. There are already a couple of bulbs supported, so I will compare the format with those, I think one will match the colour data format (the scene data I do not try to support, as it is not directly supported by Home Assistant, so scenes will just switch to the existing config, with no way to change that scene config from HA).

@make-all
Copy link
Owner

Since the range given for work mode is white, colour, probably scenes won't be supported at all, although I see in the local data log the work mode is set to "scene9" and there is an additional dp 101, which I think is the scene data.

@make-all make-all added the new device Unsupported device label Oct 28, 2022
@Swiftnesses
Copy link
Author

Anything else I can provide to help get working scenes? Really appreciate the help.

@make-all
Copy link
Owner

If you can capture all the possible values of dp 21 somehow it will help. Tuya devices generally only support one local connection at a time, so you might need to switch off WiFi on your phone so the app is controlling the light through the cloud. On the Home Assistant side, you can either turn on debug logging for custom_components.tuya_local.device by adding the following to config/configuration.yaml:

logger:
  default: warning
  logs;
    custom_components.tuya_local.device: debug

or, keep adding the device to the tuya_local integration each time you change the mode from the app and cancel out before finishing the setup, to get the warning level message that is only emitted when the device is added.

@Swiftnesses
Copy link
Author

@make-all as I cannot currently add this device in HA, I assumed that HA is no use to capture this?

I can certainly change the scene and then try and re-add each time (sounds painful!)...?

@Swiftnesses
Copy link
Author

For now, I think the device can be added without these scenes, would rather have something sooner. I'll work to find the scene data :)

make-all added a commit that referenced this issue Oct 30, 2022
category: diagnostic was in there twice fro the sleep switch.

Mentioned in comment on issue #255
@make-all
Copy link
Owner

If I search for "smart color string light", I get a lot of hits for Atomi branded lights - is it this one?
That light seems to support 9 different fixed scenes (Strobe, Fade, Pulse, Blink, Chase, Christmas, America, Pick 2, Multi) maybe some or all of those are customizable in some way, but I don't think it will be easy to figure out how. For a start, I'll map scene1...scene9 to those as presets - you can feed back later on whether they need to be reordered, or if the names are just not correct.

make-all added a commit that referenced this issue Oct 30, 2022
@make-all make-all added awaiting confirmation Wating for confirmation the issue is solved unreleased Will be in next release and removed new device Unsupported device unreleased Will be in next release labels Oct 30, 2022
@Swiftnesses
Copy link
Author

Swiftnesses commented Oct 30, 2022

Hi @make-all,

Initial tests are not successful, although some things work:

  1. there appears to be no RGB colour selection, RGB saturation, RGB brightness, just white temperature / brightness.
  2. brightness commands often fail (update, likely this happens when setting a value below 10, see update below)
  3. the light becomes unavailable now and again when performing actions (could be related to above)...
  4. scenes do not work (I know we kind of expected that

What can I do to help resolve this? Thank you for integrating this so quickly, really appreciate it.

@Swiftnesses
Copy link
Author

Update: It appears like the lowest brightness possible is 10. To test this I set 1% in the Tuya app, this corresponds to 10% HA. Setting it below 10 in HA has no effect.

@make-all make-all added partially working Needs more work to complete and removed awaiting confirmation Wating for confirmation the issue is solved labels Oct 30, 2022
@make-all
Copy link
Owner

The range for brightness is 25 to 255 (10% to 100%), which is as documented in the portal info you sent. Maybe it will work better if I allow it to be set below 25, since there doesn't seem to be any adaptation in the UI to the minimum limit. But it may cause the light to go haywire again.
Scenes I did expect to work, based on the video they are all fixed patterns except for the "pick 2" one, so I expect that just selecting them should be enough. But they might not be in the right order, so some matching between the Tuya app and Home Assistant may be needed.

make-all added a commit that referenced this issue Oct 31, 2022
make-all added a commit that referenced this issue Oct 31, 2022
This should avoid the popup message in HA rejecting settings below 10% if the
light can handle it.

Issue #255
@Swiftnesses
Copy link
Author

Swiftnesses commented Oct 31, 2022 via email

@make-all
Copy link
Owner

I just made some changes that should fix the colour mode. If you want to test them, open Tuya Local in HACS, and select "Redownload" from the top right menu. Then for version, select "main".

@make-all make-all added awaiting confirmation Wating for confirmation the issue is solved unreleased Will be in next release labels Oct 31, 2022
@make-all make-all added awaiting confirmation Wating for confirmation the issue is solved and removed awaiting confirmation Wating for confirmation the issue is solved unreleased Will be in next release labels Nov 20, 2022
@make-all make-all removed partially working Needs more work to complete awaiting confirmation Wating for confirmation the issue is solved labels Dec 11, 2022
@make-all
Copy link
Owner

A fixed version of the config was released a couple of versions back, and I think all the above issues have been addressed.

If there are still issues, please open a new issue, as this thread has become very long so difficult to work out what is not done yet.

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