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

Configuring String Lights #211

Open
memphisraynz opened this issue Dec 2, 2020 · 45 comments
Open

Configuring String Lights #211

memphisraynz opened this issue Dec 2, 2020 · 45 comments

Comments

@memphisraynz
Copy link

I have just purchased a set of strings lights (https://www.bunnings.com.au/arlec-rgb-colour-changing-grid-connect-smart-160-led-ball-lights_p0180228)
I have gone through the process and started trying to set them up in HA.
I am struggling to work out how to set them up, hoping you may be able to point me in the right direction.

Through the Smart Life app they can;
-Change colour
-Change brightness
-Change mode ( single colour, multiple colours, flashing.... 7 modes in total)

I couldn't work out how to do anything other than power on and off.
I performed a DP dump and worked out what the DP's do;
DPS [1] VALUE [False] (Power)
DPS [101] VALUE [1] (Mode 1-7)
DPS [107] VALUE [64] (Brightness 10-64)
DPS [108] VALUE [10] (Doesn't change)

any direction woul be great, thank you

@ultratoto14
Copy link
Collaborator

Hi @memphisraynz, the behavior of your light is completely different than other lights.
Can you list the different modes available in the tuya app ?
Can you tell me if the Brightness can be changed in all modes ?

@memphisraynz
Copy link
Author

Thanks,
In the Tuya app I have;
On/Off
Dimmer (brightness)
Transition speed (speed between changing colours in some modes)
Colour picker
Modes 1-7 ( they aren't named just numbers)

Brightness isn't available in all modes. There's one for example, rainbow multi colour that it doesn't affect.
I set brightness to 107 and set the min max to 10-64. When I change it in HA the brightness doesn't change but it reflects exactly in the Tuya app. So if in HA I set it at 50% when I open Tuya it changes to 50%

@ultratoto14
Copy link
Collaborator

@rospogrigio, @postlund it could be great to give access to set DP via an HA service. This may help users using that as workaround for non standard implementation.
Thoughts ?

@memphisraynz
Copy link
Author

memphisraynz commented Dec 3, 2020

I don't know if it would be of any help.
I had come across this article of similar lights, it looks like it just doesn't have the colour changing function.
https://www.madebymikal.com/hacking-on-arlec-christmas-lights-with-tasmota/

@ultratoto14
Copy link
Collaborator

The goal is to give you the ability to choose the mode.

@postlund
Copy link
Collaborator

postlund commented Dec 3, 2020

@ultratoto14 Yes, we should have a set-service of some sort. That was part of my "debug"-PR a while back, but I decided to scrap that and aimed for a set-service instead. Unless you want to give it try to implement, I can try to do it when I have some time. Should be fairly simple.

@ultratoto14
Copy link
Collaborator

@postlund great, at the moment, i just have time to write messages, no real time to dev, but it's great to ear you.

@memphisraynz
Copy link
Author

Hi, hopefully not pushing anyone here, appreciate the replies.
In regards to being able to set color, brightness or modes. Do I need to wait until someone has the chance to implement the service calls or is there someone I could try?

Say if I left it in Mode 1, which is just a single colour. Is there I could alter the brightness and colour from HA?
I've played with the values for brightness but changing from HA has no effect, I've altered the values, but it looks like they need to be min10, max 64. if I change to say 0 and 255. Putting the brightness to max in the Tuya app moves the slides to 64 in HA.

I set colour to 107 as well as a test, but HA logs keep asking to set color_mode, ever value i put in there either makes the light unavailable or results in an error of unknown DPS.

If I need to wait or its not possible thats fine.

@ultratoto14
Copy link
Collaborator

@memphisraynz what is your HA config for the light ?
Can you test with the Tuya app, setting min and max values for brightness and dump the values using HOWTO-get-a-DPs-dump?

@memphisraynz
Copy link
Author

Hi,
I have already done the DP dump;
DPS [1] VALUE [False] (Power)
DPS [101] VALUE [1] (Mode 1-7)
DPS [107] VALUE [64] (Brightness 10-64)
DPS [108] VALUE [10] (Doesn't change)

  • host: 192.168.1.119
    device_id: xxx
    local_key: xxx
    friendly_name: "Kids Lights"
    protocol_version: "3.3"
    entities:
    • platform: light
      friendly_name: Fairy Lights
      id: 1
      brightness: 107
      brightness_lower: 10
      brightness_upper: 64
      #color: 108
      #color_mode: 108

I had been playing with the colour and mode, but disabled with because they throw errors

@ultratoto14
Copy link
Collaborator

When you put in single color mode, you can change the color with the tuya app ? What are the changing DP, did you give the full dump ?

We need more data, we think about putting in place a device database to implement different devices like yours but at the moment, it may not be possible to support yours as it is so different.

@memphisraynz
Copy link
Author

memphisraynz commented Dec 6, 2020

Hi,
I changed the colour, but none of the DPs changed.
In regards to a ful ldump, I ran ./test.py . Unless there is a switch I could add, the above was the full dump.

###########
INFO:localtuya:localtuya version 1.0.0
INFO:localtuya:Python 3.8.6 (default, Sep 25 2020, 09:36:53)
[GCC 10.2.0] on linux
INFO:localtuya:Using pytuya version '8.1.0'
INFO:localtuya:Detecting list of available DPS of device xxx [192.168.1.119], protocol 3.3.
DEBUG:localtuya.pytuya:Sending command status (device type: type_0a)
DEBUG:localtuya.pytuya:paylod=b'{"gwId":"xxx","devId":"xxx"}'
DEBUG:localtuya.pytuya:DATA RECEIVED!
DEBUG:localtuya.pytuya:decode payload=b"\xb1e\\x85\xdf\xec#\xeak\x04\x9dPk\xeaO\xf2\x88\xe1\xe6\xc0N\xeb=\xaf4\x80z'\xda\x10\x9b\xce\x89 \x9c?\x8bfS\x01\xd3e\xa5\x94\xaa\xf7\x8d\xc8"
DEBUG:localtuya.pytuya:decrypted result='{"dps":{"1":true,"101":"1","107":64,"108":28}}'
AVAILABLE DPS ARE [{'1': True, '101': '1', '107': 64, '108': 28}]
INFO:localtuya:COMPLETE response from device xxx [192.168.1.119].

**** deviceInfo returned OK ****

TuyaDebug (Tuya DPs dump) [1.0.0]

Device xxx at 192.168.1.119 key xxx protocol 3.3 dev_type type_0a:
DPS [1] VALUE [True]
DPS [101] VALUE [1]
DPS [107] VALUE [64]
DPS [108] VALUE [28]
###########

I figured that the colour must be a subset of one of the other DPs.

Thanks for your time so far.

@memphisraynz
Copy link
Author

Out of curisosity I changed;
color: 101
color_mode: 2
101, is the DP that changes when when I change scene/modes. I get the colour wheel in HA, but when I chane the colours they are mixed up. IE, green in blue, blue is red... In your exmaples you say 2 or 21, both result in mixed colours.
Whlie changing colours I run the DP dump and value 101 doesnt change.
Using Scene as 101, looks like it results in incorrect commands being sent to the device. So it might just flash randomly. Whlie it's doing that, when I run the DP dump, the scene DP hasn't changed.

@memphisraynz
Copy link
Author

Sorry for spamming.
I was playing with https://github.com/sjthespian/addon-tuyagateway
Going through the logs I noticed a new DPS 109, this would change with the colour. example DPS "7gD"
I manually added 109 to the yaml in localtuya but it tells me its an invalid DPS.

@ultratoto14
Copy link
Collaborator

This integration does not support your kind of device, i know it's frustrating but do not try to change DP ids to whatever, it will not work. What we need is completely picture of the data to understand how it works and then change the necessary code.

For the moment, the supported tuya lights uses:

        id: 4 # This is usually true/false value indicating a switch
        color_mode: 21 # this contains the hardcoded values "white","colour","scene" or "music"
        brightness: 22 # this contains a value to control the brightness of the white color, two kind are managed "25-255" and "10-1000"
        color_temp: 23 # this is the white color temp, this uses the same range as brightness
        color: 24 # this is the color value, two kind of encoding supported, 12 char length pure HSV, 14 char length RGB and HSV 
        brightness_lower: 29 # this is setting up the min value for brigthness
        brightness_upper: 1000 # this is setting up the max value for brigthness, and should respect DP 22 range
        color_temp_min_kelvin: 2700 # this values are used to map the min and max mired for the color temp
        color_temp_max_kelvin: 6500 # 
        scene: 25 # this is work in progress, i do not recommend to use them.

So your device cannot be mapped, somewhere, you should have a DP with the chosen color stored.

I do not know how you got your device key but if you have tuya-cli, you can try also with it :

 tuya-cli get --ip 192.168.1.10 --id bf9421e1849ecc224nfqw --key 2cddf4113ee52a01 -a --protocol-version 3.3

Check if you have the same results as with test.py.

@memphisraynz
Copy link
Author

Hi,
As a coincidence I did run that roday as I came across it, seeing if there were any difference.
the tuya-cli gave me the same results as above.

@memphisraynz
Copy link
Author

So from what i've manage to establish.

DPS [1] - Power
DPS [101] - Scene 1-7 as an int
DPS [107] - Brightness min 10, max 64
DPS [108] - Doesn't change
DPS [109] - Isn't addressable, but stores the colour code in 3 char '7gD'

For the scene, is it possible to allow for custom entries?

@ultratoto14
Copy link
Collaborator

For the scene, is it possible to allow for custom entries?

Not for the moment, we plan to build a db with known devices data and scenes will be there to enhance the integration, but it will take time.

@ultratoto14
Copy link
Collaborator

ultratoto14 commented Dec 15, 2020

Hello @memphisraynz, @postlund just merged a PR with a service to set the dp #236.
You can then set a light like:

        id: 1
        brightness: 107
        brightness_lower: 10
        brightness_upper: 64

Then, define an input select with the scene numbers or scene names, and add an automation that use the service to set the DPS 101 based on that input select.
As the DPS 109 is not addressable we cannot change it but you may still try with the service.
It's not a common behavior but perhaps this 109 is only visible when the 101 is in a specific scene ?

@memphisraynz
Copy link
Author

Hey thanks so much.
I removed localtuya but have added it back into HA. I've set the device up again like above.
Am I right when you say to create a "Helper" in HA, probable a dropdown with all the scene numbers and to use an automation to set the service based off that Helper?
What service do I use to set the DPS, is ther an example somewhere?

@memphisraynz
Copy link
Author

memphisraynz commented Dec 15, 2020

I read the PR and replaced the init file wiht the new one and have the service available. My sons asleep now so I probably shouldn't play with it right now.
But thank you again

@memphisraynz
Copy link
Author

Sorry to be a pain, I can't work out what needs to be added to the service call from reading the .py file.
Do you mind putting an example together?
Thanks

@ultratoto14
Copy link
Collaborator

You can check here

@memphisraynz
Copy link
Author

memphisraynz commented Dec 15, 2020

So really good results.

I am able to change mode/scene using set_dp (101)
I am not able to change brightness using set_dp (107)
I am able to change the colour using set_dp (109), though I don't understand the colour codes. Using '7gD' as the value sets the colour, which seems to be some sort of purple. Have you come across this?

@ultratoto14
Copy link
Collaborator

Try to set your device to known colour with the app and get the DP values for let say red blue green. We can try decoding then

@ultratoto14
Copy link
Collaborator

Do you know how to use postman ?

@memphisraynz
Copy link
Author

Funnily the colour 109, doesn't show when running test-py or tuya cli. It only showed when viewing the logs when using tuyagateway. The app only has a slider for colour, i'll see if I can get close to raw colours like reb blue green.

Im familiar with postman, not the greatest but i use it occasionally.

@ultratoto14
Copy link
Collaborator

Hi @memphisraynz you can then try that if you have an iot.tuya trial account : Postman

There is a postman collection which can let you call cloud APIs. You need to setup these environment variables:
image
Depending on your location, url may be different, in europe, it's https://openapi.tuyaeu.com
You should first get an access_token, then the interesting one is:

  • {{url}}/v1.0/devices/{{device_id}}/status that will give you a name and value but also kind of data you'll find in your DPs (without knowing which one 😄 ) in the form of:
        {
            "code": "colour_data_v2",
            "value": "{\"h\":329,\"s\":1000,\"v\":1000}"
        }

It may help

@memphisraynz
Copy link
Author

Cheers,
I have it setup on my work computer, ill give it a go

@ultratoto14
Copy link
Collaborator

Or maybe do you have also the color displayed in tuya app ? In that case, can you do a screenshot and get the RGB value of the 7gD using whatever picture editor ?

@memphisraynz
Copy link
Author

Used your idea.
These are rough;
Colour - Hex - Tuya Colour
Red - #ba553e - GgAA
Green - #73c66c - ABoC
Blue - #3e4bc1 - BAAa

To show you what Im working with: https://photos.app.goo.gl/MXHdXhVbyfd5W7hR9
I used a image editor and chose the colour from the center of the slider icon.

@memphisraynz
Copy link
Author

While trying to set brightness at the moment, using the latest commits give an error.
Failed to call service light/turn_on object type 'NoneType has no len()

@ultratoto14
Copy link
Collaborator

About

Colour - Hex - Tuya Colour
Red - #ba553e - GgAA
Green - #73c66c - ABoC
Blue - #3e4bc1 - BAAa
If you can try to get data from postman too, i do not find an easy to decode that...

About the brightness issue. It's weird, do you have a stack trace in your logs. In the light the len is only used when the device supports color (meaning color dp have been set).

@memphisraynz
Copy link
Author

The config at the moment is only
id: 1
brightness: 107
brightness_lower: 10
brightness_upper: 64

Is this what your want?

`Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/localtuya/light.py:267
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 17:49:12 (8 occurrences)
Last logged: 20:20:53

[140490302897264] object of type 'NoneType' has no len()
[140490298272112] object of type 'NoneType' has no len()
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 135, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1445, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1480, in _execute_service
await handler.job.target(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 593, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 664, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 630, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/light/init.py", line 230, in async_handle_light_on_service
await light.async_turn_on(**params)
File "/config/custom_components/localtuya/light.py", line 303, in async_turn_on
if self.__is_color_rgb_encoded():
File "/config/custom_components/localtuya/light.py", line 267, in __is_color_rgb_encoded
return len(self.dps_conf(CONF_COLOR)) > 12
TypeError: object of type 'NoneType' has no len()`

@ultratoto14
Copy link
Collaborator

Are you sure you're on the last master version, line 303 is not the same as your stack

@memphisraynz
Copy link
Author

I've just re downloaded the master branch and copied it over the existing install. I'll test in the morning once my boy is awake

@memphisraynz
Copy link
Author

After a bit of stuffing around in postman I managed to get the device info.
It doesn't give any useful info though.

{
"result": {
"active_time": 1606892393,
"biz_type": 18,
"category": "dj",
"create_time": 1606892393,
"icon": "smart/icon/ay1536534747810ekKBj/7aa3df00a3ac1857c62d83269a72807e.png",
"id": "xxx",
"ip": "167.179.168.108",
"local_key": "xxx",
"name": "Ollie's Lights",
"online": true,
"owner_id": "xxx",
"product_id": "xxx",
"product_name": "LVE160HA",
"status": [
{
"code": "switch_led",
"value": true
}
],
"sub": false,
"time_zone": "+10:00",
"uid": "xxx",
"update_time": 1608005594,
"uuid": "xxx"
},
"success": true,
"t": 1608154759827
}

From above the only things I've changed are what looks to be private info to xxx.

The query {{url}}/v1.0/devices/{{device_id}}/status give just as little
{
"result": [
{
"code": "switch_led",
"value": true
}
],
"success": true,
"t": 1608155082238
}
i refreshed after changing all settings from the app and it returns nothing useful

@memphisraynz
Copy link
Author

When I force dps 109 as colour_mode in the config I end up with the following error.
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 135, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1445, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1480, in _execute_service
await handler.job.target(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 593, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 664, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 630, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/light/init.py", line 230, in async_handle_light_on_service
await light.async_turn_on(**params)
File "/config/custom_components/localtuya/light.py", line 342, in async_turn_on
if self.__is_color_rgb_encoded():
File "/config/custom_components/localtuya/light.py", line 269, in __is_color_rgb_encoded
return len(self.dps_conf(CONF_COLOR)) > 12
TypeError: object of type 'NoneType' has no len()

@ultratoto14
Copy link
Collaborator

@memphisraynz thanks for the tests. Do not try to force the color_mode or color config as your device is working differently and you will only get exception and even unavailable device.
We need to understand the color coding to be able to support it.

@memphisraynz
Copy link
Author

Cheers, I've removed the colour settings from the config.

@ultratoto14
Copy link
Collaborator

@memphisraynz did you try to change the DP 109 using the new service with a known value ?

@memphisraynz
Copy link
Author

I did try and set the value using set_dp but nothing happened.

@jantoney
Copy link

jantoney commented Jan 4, 2022

Hi all,
I know this is well over a year old - but did anyone get any further with this or could we pick it back up?
I have several ARLEC 'string lights' that I'm not sure anyone has decoded yet given I can't find much information on them.

Please let me know what you need. I know Postman, etc but certainly don't know much about the TUYA API or how it works given I only installed this a few hours ago.

Maybe there is a site/page I haven't found to explain how to decode it?

I note that @memphisraynz is getting a category of dj and I'm getting dc which explains the additional commands I'm seeing on my string lights. (listed at the end)

My lights are both ARLEC from BUNNINGS (in Australia).
Both lights have been discontinued as they were Christmas 2020 only ranges (I got them 1/2 price!).

  • ARLEC RGB 50 LED Bud Lights - Model: LVE1021HA
  • ARLEC RGB 120 LED Icicle Light - Model: LVE1018HA

Random one while I'm here - Is there a site like the Tasmota Blakaddar Templates that lists device entities that you could copy and place into HA configs for localtuya... If not, maybe that can be a project for me after we get this working 😆
IE: https://templates.blakadder.com/search.html
I can't see it being amazingly hard. It seems that controls for all of the same category of product are the same, so would just have to match on that (?... maybe)

Device Information

GET "https://openapi.tuyaeu.com/v1.1/iot-03/devices/{DEVICE_ID}"

{
  "result": {
    "active_time": 1641298195,
    "category": "dc",
    "category_name": "String Lights",
    "create_time": 1641298195,
    "gateway_id": "",
    "icon": "smart/icon/ay1536534747810ekKBj/d0e71c1dec28c97d0d068504258efde5.png",
    "id": "{ID_REMOVED}",
    "ip": "159.196.159.232",
    "lat": "-33.8834",
    "local_key": "{KEY_REMOVED}",
    "lon": "151.2027",
    "model": "LVE1021HA VY",
    "name": "RGB Bud Lights",
    "online": true,
    "owner_id": "{OWNER_REMOVED}",
    "product_id": "lrkijachzdqxszbl",
    "product_name": "LVE1021HA",
    "sub": false,
    "time_zone": "+11:00",
    "update_time": 1641298209,
    "uuid": "{UUID_REMOVED}"
  },
  "success": true,
  "t": 1641302072361
}

Specification of the Device

GET "https://openapi.tuyaeu.com/v1.0/iot-03/devices/{DEVICE_ID}/specification"

{
  "result": {
    "category": "dc",
    "functions": [
      {
        "code": "switch_led",
        "desc": "{}",
        "name": "开关",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "work_mode",
        "desc": "{\"range\":[\"white\",\"colour\",\"scene\",\"music\"]}",
        "name": "模式",
        "type": "Enum",
        "values": "{\"range\":[\"white\",\"colour\",\"scene\",\"music\"]}"
      },
      {
        "code": "bright_value",
        "desc": "{\"min\":10,\"max\":1000,\"scale\":0,\"step\":1}",
        "name": "亮度值",
        "type": "Integer",
        "values": "{\"min\":10,\"max\":1000,\"scale\":0,\"step\":1}"
      },
      {
        "code": "temp_value",
        "desc": "{\"min\":0,\"max\":1000,\"scale\":0,\"step\":1}",
        "name": "冷暖值",
        "type": "Integer",
        "values": "{\"min\":0,\"max\":1000,\"scale\":0,\"step\":1}"
      },
      {
        "code": "colour_data",
        "desc": "{\"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}}",
        "name": "彩光",
        "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}}"
      },
      {
        "code": "countdown",
        "desc": "{\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}",
        "name": "倒计时剩余时间",
        "type": "Integer",
        "values": "{\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}"
      },
      {
        "code": "music_data",
        "desc": "{\"maxlen\":255}",
        "name": "音乐灯",
        "type": "String",
        "values": "{\"maxlen\":255}"
      },
      {
        "code": "control_data",
        "desc": "{\"maxlen\":255}",
        "name": "调节",
        "type": "String",
        "values": "{\"maxlen\":255}"
      }
    ],
    "status": [
      {
        "code": "switch_led",
        "name": "开关",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "work_mode",
        "name": "模式",
        "type": "Enum",
        "values": "{\"range\":[\"white\",\"colour\",\"scene\",\"music\"]}"
      },
      {
        "code": "bright_value",
        "name": "亮度值",
        "type": "Integer",
        "values": "{\"min\":10,\"max\":1000,\"scale\":0,\"step\":1}"
      },
      {
        "code": "temp_value",
        "name": "冷暖值",
        "type": "Integer",
        "values": "{\"min\":0,\"max\":1000,\"scale\":0,\"step\":1}"
      },
      {
        "code": "colour_data",
        "name": "彩光",
        "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}}"
      },
      {
        "code": "countdown",
        "name": "倒计时剩余时间",
        "type": "Integer",
        "values": "{\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}"
      }
    ]
  },
  "success": true,
  "t": 1641302341906
}

Instruction Set of the Device

GET "https://openapi.tuyaeu.com/v1.0/iot-03/devices/{DEVICE_ID}/functions"

{
  "result": {
    "category": "dc",
    "functions": [
      {
        "code": "switch_led",
        "desc": "switch led",
        "name": "switch led",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "work_mode",
        "desc": "work mode",
        "name": "work mode",
        "type": "Enum",
        "values": "{\"range\":[\"white\",\"colour\",\"scene\",\"music\"]}"
      },
      {
        "code": "bright_value",
        "desc": "bright value",
        "name": "bright value",
        "type": "Integer",
        "values": "{\"min\":10,\"max\":1000,\"scale\":0,\"step\":1}"
      },
      {
        "code": "temp_value",
        "desc": "temp value",
        "name": "temp value",
        "type": "Integer",
        "values": "{\"min\":0,\"max\":1000,\"scale\":0,\"step\":1}"
      },
      {
        "code": "colour_data",
        "desc": "colour data",
        "name": "colour data",
        "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}}"
      },
      {
        "code": "countdown",
        "desc": "countdown",
        "name": "countdown",
        "type": "Integer",
        "values": "{\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}"
      },
      {
        "code": "music_data",
        "desc": "music data",
        "name": "music data",
        "type": "String",
        "values": "{\"maxlen\":255}"
      },
      {
        "code": "control_data",
        "desc": "control data",
        "name": "control data",
        "type": "String",
        "values": "{\"maxlen\":255}"
      }
    ]
  },
  "success": true,
  "t": 1641302298455
}

@MHillyer
Copy link

MHillyer commented Jan 18, 2022

I too would like to find out if this has gone anywhere. I have a set of Cafe Lights that I'd like to get working beyond on/off.

Product: https://byjasco.com/enbrighten-wifi-seasons-color-changing-classic-led-cafe-lights-48ft-black-cord

Also a DJ device:

{
  "result": {
    "active_time": 1642527160,
    "category": "dj",
    "category_name": "Light Source",
    "create_time": 1642527160,
    "gateway_id": "",
    "icon": "smart/icon/ay1576699160189ujKIW/81985b0d42fee82da1337013b4ba50d7.png",
    "id": "eb004856a558d3c1320a9e",
    "ip": "73.137.241.1",
    "lat": "34.0122",
    "local_key": "REDACTED",
    "lon": "-84.2054",
    "model": "57046",
    "name": "String Lights 2",
    "online": true,
    "owner_id": "61623405",
    "product_id": "hfabiyk24af5yvcb",
    "product_name": "Café Lights",
    "sub": false,
    "time_zone": "-05:00",
    "update_time": 1642533715,
    "uuid": "57985f469750e411"
  },
  "success": true,
  "t": 1642534510222
}

Specifications:

{
  "result": {
    "category": "dj",
    "functions": [
      {
        "code": "switch_led",
        "lang_config": {
          "false": "OFF",
          "true": "ON"
        },
        "name": "ON/OFF",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "countdown_1",
        "lang_config": {
          "unit": "s"
        },
        "name": "Timer",
        "type": "Integer",
        "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}"
      },
      {
        "code": "control_data",
        "lang_config": {
          "unit": ""
        },
        "name": "Adjust",
        "type": "Json",
        "values": "{\"change_mode\":{\"range\":[\"direct\",\"gradient\"]}, \"bright\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1}, \"temperature\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1}, \"h\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":360,\"step\":1},\"s\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1},\"v\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1}}"
      }
    ],
    "status": [
      {
        "code": "switch_led",
        "lang_config": {
          "false": "OFF",
          "true": "ON"
        },
        "name": "ON/OFF",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "countdown_1",
        "lang_config": {
          "unit": "s"
        },
        "name": "Timer",
        "type": "Integer",
        "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}"
      },
      {
        "code": "control_data",
        "lang_config": {
          "unit": ""
        },
        "name": "Adjust",
        "type": "Json",
        "values": "{\"change_mode\":{\"range\":[\"direct\",\"gradient\"]}, \"bright\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1}, \"temperature\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1}, \"h\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":360,\"step\":1},\"s\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1},\"v\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1}}"
      }
    ]
  },
  "success": true,
  "t": 1642534570239
}

Functions:

{
  "result": {
    "category": "dj",
    "functions": [
      {
        "code": "switch_led",
        "desc": "switch led",
        "name": "switch led",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "countdown_1",
        "desc": "countdown 1",
        "name": "countdown 1",
        "type": "Integer",
        "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}"
      },
      {
        "code": "control_data",
        "desc": "control data",
        "name": "control data",
        "type": "Json",
        "values": "{\"change_mode\":{\"range\":[\"direct\",\"gradient\"]}, \"bright\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1}, \"temperature\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1}, \"h\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":360,\"step\":1},\"s\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1},\"v\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1}}"
      }
    ]
  },
  "success": true,
  "t": 1642534697398
}

I'm new to all this but happy to provide any additional requested information.

@MHillyer
Copy link

Is there any kind of bounty program for this project? I'll happily support getting this fixed.

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

5 participants