jasonacox / tinytuya

Python API for Tuya WiFi smart devices using a direct local area network (LAN) connection or the cloud (TuyaCloud API).
MIT License
867 stars 157 forks source link

color change on led strip #481

Open Dadzzio opened 3 months ago

Dadzzio commented 3 months ago

hey i have no idea how to send a cloud command to my bulb device (led strip) to change a color via rgb. i tried many ways, hsv to hex, dec to hex idk really i nueed help to create a command. properties:

{
  'result': {
    'category': 'dd',
    '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': 'colour_data',
        'desc': '{"maxlen":255}',
        'name': '彩光',
        'type': 'String',
        'values': '{"maxlen":255}'
      },
      {
        'code': 'scene_data',
        'desc': '{"maxlen":255}',
        'name': '场景',
        'type': 'String',
        'values': '{"maxlen":255}'
      },
      {
        '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': 'colour_data',
        'name': '彩光',
        'type': 'String',
        'values': '{"maxlen":255}'
      },
      {
        'code': 'scene_data',
        'name': '场景',
        'type': 'String',
        'values': '{"maxlen":255}'
      },
      {
        'code': 'countdown',
        'name': '倒计时剩余时间',
        'type': 'Integer',
        'values': '{"min":0,"max":86400,"scale":0,"step":1}'
      }
    ]
  },
  'success': True,
  't': 1711995496458,
  'tid': ''
}
jasonacox commented 3 months ago

Hi @Dadzzio - did you happen to try/adapt the bulb.py script? https://github.com/jasonacox/tinytuya/blob/master/examples/bulb.py

Dadzzio commented 3 months ago

@jasonacox hey i wat to send a cloud command because my led strips aren't on my lan.

Dadzzio commented 3 months ago

@jasonacox nvm, i looked at BulbDevice.py and there is an converter. In 5h i'll post an update.