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

Setting a specific scene on an LED Strip #584

Open
dan00ile opened this issue Jan 24, 2025 · 3 comments
Open

Setting a specific scene on an LED Strip #584

dan00ile opened this issue Jan 24, 2025 · 3 comments
Labels
tuya_device Support for specific Tuya Devices

Comments

@dan00ile
Copy link

dan00ile commented Jan 24, 2025

Hi.
I have an LED lamp running on version 3.5, which has multiple operating modes. As I understand it, DP25 stores information about the current configuration of the enabled scene. I wanted to know how I can read and change this information.
Right now, when I request status(), I only get this response:
{'dps': {'20': True, '21': 'scene', '24': '002803e803e8', '26': 0, '47': 50, '53': 18, '101': 'RGB'}}.
Is there any way to expand the number of dps I get it from?

Sorry for the stupid questions(

"product_name": "Desktop atmosphere light",
        "product_id": "tc96vn32pheav8dg",
        "biz_type": 18,
        "model": "\u9879\u76ee12-PCB_320P1-V1.1",
        "sub": false,
        "icon": "https://images.tuyaeu.com/smart/icon/ay1572836370796htGWH/0c8aa01a17a8f52e0ecfe3d4e6a840f6.png",
        "mapping": {
            "20": {
                "code": "switch_led",
                "type": "Boolean",
                "values": {}
            },
            "21": {
                "code": "work_mode",
                "type": "Enum",
                "values": {
                    "range": [
                        "white",
                        "colour",
                        "scene",
                        "music"
                    ]
                }
            },
            "24": {
                "code": "colour_data",
                "type": "Json",
                "raw_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}}",
                "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
                    }
                }
            },
            "26": {
                "code": "countdown",
                "type": "Integer",
                "values": {
                    "unit": "s",
                    "min": 0,
                    "max": 86400,
                    "scale": 0,
                    "step": 1
                }
            },
            "27": {
                "code": "music_data",
                "type": "Json",
                "raw_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}}",
                "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
                    }
                }
            },
            "28": {
                "code": "control_data",
                "type": "Json",
                "raw_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}}",
                "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
                    }
                }
            }
        },
        "ip": "192.168.0.149",
        "version": "3.5"
@dan00ile dan00ile changed the title Setting a specific scene on an LED lamp Setting a specific scene on an LED Strip Jan 24, 2025
@uzlonewolf
Copy link
Collaborator

If you start a monitor loop https://github.com/jasonacox/tinytuya/blob/master/examples/monitor.py and change the scene using the SmartLife app, what does it say?

@uzlonewolf uzlonewolf added the tuya_device Support for specific Tuya Devices label Jan 24, 2025
@dan00ile
Copy link
Author

dan00ile commented Jan 25, 2025

 > Send Request for Status < 
Initial Status: {'dps': {'20': True, '21': 'scene', '24': '002803e803e8', '26': 0, '47': 50, '53': 18, '101': 'RGB'}}
 > Begin Monitor Loop <
Received Payload: None
Received Payload: None
Received Payload: None
Received Payload: {'protocol': 4, 't': 1737802775, 'data': {'dps': {'51': 'ARcDXl5gAABkADgvAB5cANVFARpk'}}, 'dps': {'51': 'ARcDXl5gAABkADgvAB5cANVFARpk'}}
Received Payload: None
Received Payload: {'protocol': 4, 't': 1737802783, 'data': {'dps': {'51': 'ARYKZGRgAABkAJJfAMZg'}}, 'dps': {'51': 'ARYKZGRgAABkAJJfAMZg'}}
Received Payload: {'protocol': 4, 't': 1737802787, 'data': {'dps': {'51': 'ARkKVFRgAABkALEsAMBk'}}, 'dps': {'51': 'ARkKVFRgAABkALEsAMBk'}}
Received Payload: {'protocol': 4, 't': 1737802790, 'data': {'dps': {'51': 'ARsDX19gAABkAK45AMRdAPlk'}}, 'dps': {'51': 'ARsDX19gAABkAK45AMRdAPlk'}}

@jasonacox
Copy link
Owner

Interesting to see payload duplicate the same dps (51):

{
	'dps': {
		'51': 'ARcDXl5gAABkADgvAB5cANVFARpk'
	}
}, 
	'dps': {
		'51': 'ARcDXl5gAABkADgvAB5cANVFARpk'
	}
}

@dan00ile Did you try sending back those values of 51 to see if it replicated what you did in the app?

import tinytuya

d = tinytuya.BulbDevice('DEVICE_ID_HERE', 'IP_ADDRESS_HERE', 'LOCAL_KEY_HERE', version=3.5)
d.set_socketPersistent(True)  

# Set 51
d.set_value(51, 'ARcDXl5gAABkADgvAB5cANVFARpk')

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

No branches or pull requests

3 participants