How to reverse open and close for Window Shades... so close

So I setup the Smartthings IDE and was able to modify the code here so that when I click “Open” it actually opens the blinds and when I click “Close” it actually closes them - the problem is everything else is wrong. Basically, when the shades are at 0% they should say “open” instead of closed and vice versa.

All I did was to swap these two lines with 0 and 100-

local yoolax_window_shade = {
  NAME = "yoolax window shade",
  capability_handlers = {
    [capabilities.windowShade.ID] = {
      [capabilities.windowShade.commands.open.NAME] = set_window_shade_level(0),
      [capabilities.windowShade.commands.close.NAME] = set_window_shade_level(100),
    }
  },
  can_handle = is_yoolax_window_shade
}

It seems that the st.zigbee.zcl.clusters.WindowCovering assumes that 0 = closed and 100 = open. So, I think I either need to trick it so that the inputs are converted to the opposite (25 = 75, 60=40, etc.) or somehow override st.zigbee.zcl.clusters.WindowCovering.

If someone would be so kind as to share an example of how this is done, it would be awesome.

Thanks!

Hi @Cyberfreak

Look at the ikea subdriver of the stock zigbee window treatment.

These blinds work inverted with respect to the default libraries.

You have inverted the command sent and you still need to invert the response handler to emit event of the status of the shutter.

if there is no attribute handler defined in template, the handler of the default libraries is executed.

You have to put an attribute handler, like in the ikea subdriver, to invert the received value, local level = 100 - value, which has to be emitted afterwards

https://github.com/SmartThingsCommunity/SmartThingsEdgeDrivers/blob/main/drivers/SmartThings/zigbee-window-treatment/src/IKEA/init.lua

Awesome, thanks for taking the time to respond!

Kluge it may be, but with your help I was able to cobble together a functioning driver that solved my issue!

Thank you so much!

https://github.com/CyberFreek/SmartThingsEdgeDrivers

1 Like

Thanks for the driver @Cyberfreak! My Yoolax shades finally show the correct state.

1 Like

@ Cyberfreak

Kudos! Solved my Yoolax shade issues also! Thanks!

1 Like

There’s a change moving through the test stages to update the official zigbee curtain driver to reverse Yoolax too.

1 Like

My Yoolax shades have just reversed on their own. I’ve only had them a month so wasn’t sure if they reverse on their own at random, but sounds like this is a permanent fix?

Yea, the change to the default driver went through to reverse Yoolax to work correctly