Tuya: how to turn off LED stripes

running OH5.0.2 on docker.

Installed tuya, added my LED stripes (productID v5gj0wxxfueqggvy and pkm8wzcxbefg6vv6).

The scan brought those channels for the RGB-LEG v5gj0wxxfueqggvy:

UID: tuya:tuyaDevice:TeamsLED
label: Teams-LED
thingTypeUID: tuya:tuyaDevice
configuration:
  pollingInterval: 0
  productId: v5gj0wxxfueqggvy
  deviceId: xxx
  localKey: yyy
channels:
  - id: control_data
    channelTypeUID: tuya:string
    label: ""
    configuration:
      dp: 28
  - id: colour_data
    channelTypeUID: tuya:color
    label: ""
    configuration:
      dp: 24
      dp2: 20
  - id: countdown
    channelTypeUID: tuya:number
    label: ""
    configuration:
      dp: 26
      max: 86400
      min: 0
  - id: scene_data
    channelTypeUID: tuya:string
    label: ""
    configuration:
      dp: 25
  - id: work_mode
    channelTypeUID: tuya:string
    label: ""
    configuration:
      dp: 21
      range: white,colour,scene,music

in the App I can change:

  1. color which should be colour_data
  2. timer which should be countdown
  3. scene which should be scene_data
    (if I can first make a mapping from the namings to the long codes)
  4. "actions in App" kinda work_mode
  5. brightness ?
  6. turn off/on ?
  7. time control ?

I really don’t need a time control, but I’d like to change brightness and turn on/off the LED. how can i do this?

A Color Item can receive commands the same as a Dimmer or a Switch. Sending an ON/OFF command will turn the light on or off. Sending a PercentType (integer between 0 and 100) will set the brightness.

If you are using a sitemap, put the Color Item on the sitemap using a Switch or Setpoint element.

If you are using MainUI, there are several color light widgets on the marketplace that includes all these functions in one widget. Or you can link the color Channel to a Switch and Dimmer Item separately and use those. Or put the one Color Item on a page using three different widgets.

hmmm. Seems kinda strange to send this to a colour item… :wink: But I tried using the API-Explorer:

  • Sending “OFF” to my colour-item => 202 response, but nothing happens
  • Sendinng “20” to my colour-item => 202 response, but nothing happens
  • Sending “gibberish” to my colour-item => 400-error “State could not be parsed: gibberish”

seems, that specific LED at least won’t accept those commands…

but if I send “120.0,90.0,0.0”, I also get an 202 response, but nothing happens. have to try more.

It’s always worked this way. If you look at the code, you’ll see that a ColorItem inherits from DimmerItem which means in all ways it will behave as a Dimmer. In turn, DimmerItem inherits from SwitchItem which means in all ways a Dimmer will behave as a Switch also.

More details in the docs here and here. Notice the commands color accept are listed as

OnOff, IncreaseDecrease, Percent, HSB, Refresh

A few bindings will split the three out into separate Channels, but it’s not required because Color can receive all three.

I can’t say much about that. It’s the binding that actually interprets the commands and sends them out to the device. 202 means the request was received and accepted but not processed yet. I’m not sure under what circumstances that happens. Maybe it’s not even getting to the binding.

Should be “120.0, 90, 0”. The saturation and brightness fields must be PercentTypes (i.e. integers between 0 and 100). I don’t think that’s the cause of the 202 though.

1 Like

ah. Now I see, thanks for that!

I played around a bit and it is still strange:

  • if I use the sliders in MainUI it works:
    Item 'TeamsLED_Farbe' changed from 289.0,100,100 to 309,100,100
  • if I use API-explorer the value changes:
    Item 'TeamsLED_Farbe' changed from 309.0,100,100 to 175.0,100,100 but nothing happens
  • if I use items.getItem("TeamsLED_Farbe").sendCommand("30.0,100,100") in a rule, it works. and at least THAT’S all I need to do! :wink:

thanks, Rich!

Just one more note, how ON/OFF is handled is managed by the binding. Most of the time it will just set the brightness to 0 and leave the color and saturation alone. But other bindings may do something different. I don’t know how Tuya does it. You’ll have to experiment.

oh, that works with sendCommand also - but not with the API-Explorer. Perhaps that one only does postUpdate?

There is a separate REST API endpioint for updates and commands. Are you using the PUT or the POST endpoint? A PUT to /items/{item name}/state updates the Item. A POST to /items/{item name}/ sends a command.

I only have the PUT-version in the list? which would explain the behaviour, of course.

Look at the fifth row. “POST /item/{itemname} Sends a command to an item”

1 Like