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

Smartwings WM25/L-Z Roller shade open/close commands reversed in 2.1.0 #26133

Closed
brettmiller opened this issue Feb 2, 2025 · 20 comments
Closed
Labels
problem Something isn't working

Comments

@brettmiller
Copy link

brettmiller commented Feb 2, 2025

What happened?

After the 2.1.0 my Smartwings WM25/L-Z Roller shades no longer respond to open and close commands as expected. Sending close opens the shades and open closes the shades. They still report the correct open/close state and percentages. Changing the "Invert cover" setting from false to true doesn't change the behavior.

EDIT:
This seems related to Koenkk/zigbee-herdsman-converters#8681. After originally submitting this issues I remembered when I first installed the shades I had to reverse the motor direction, so I changed it back. Now open and close work as expected, but the state of the shades is reversed (open is 0%, closed is 100%). So depending on if the shades have the motor reversed or not they either have the open/closed state reversed or the open/close buttons have the opposite functions.

What did you expect to happen?

Sending "open" opens the shades and sending "close" closes the shades.

How to reproduce it (minimal and precise)

No response

Zigbee2MQTT version

2.1.0

Adapter firmware version

20221226

Adapter

SONOFF Zigbee 3.0 USB Dongle Plus-P

Setup

Add-on on Home Assistant OS on Proxmox VM

Debug log

No response

@quadcom
Copy link

quadcom commented Feb 3, 2025

Yup, here too.

From the factory, the 'app' direction is reversed and requires you to switch the direction for app control using a button press pattern on the remote. It appears that somewhere in the Z2M code, this flip has been made compared to previous versions. But now everyone that has made this 'app' direction change had to go flip it again.

Was this a conscious decision or will this be reverted? If it will stay as it is now, new adopters of smartwing shades will not have to go through the 'app' direction flip and current users will have to revert the settings on the share directly. I don't want to have to go flip all my shades if it getting fixed and force be to flip then back again.

But it can't stay like this for long WAF will go down the tubes.!

@ThrashinVictim
Copy link

I saw this as well.
I have another problem.
I have 4 WM25/L-Z Roller shades

Before this change, 1 blind worked fine but for the other 3, I had to do the invert for Alexa and set it as inverted in Z2M in the other settings tab.
More info here #22847 (comment)
But in HA it would say the blinds are open but the slider shows as closed.

Now with this change, the 3 that didn't work do, and the 1 that did work now doesn't show the correct state.

I think it is due to me buying the blinds at different times and they have different firmware. The first one I bought was in March and the rest 3 was in May. But I am speculating.

@amaisano
Copy link

amaisano commented Feb 3, 2025

One of my cellular shades' lift strings snapped this morning because of this update. That's an $80 USD replacement.

@brettmiller
Copy link
Author

brettmiller commented Feb 3, 2025

For now I took the file from the PR and corrected it to have coverInverted: false in the "meta" section like what's in the external converter in #22847 (comment). I also flipped the motor direction back to what the factor default, but now the buttons on the remote are backwards and they can't be fixed without factory reseting the shades since the buttons on the remote can't be flipped after the shade limits have been set. I happed to have factory reset one of my shades while debugging and the remote buttons for that shade are correct.

The fact that this change caused someone physical damage seems like a good reason for it to be reverted quickly.

@denmoses1
Copy link

Same issue here. Though I don’t mind flipping the app direction back to the factory setting…the mismatch between the state and open/close is a more significant problem.
Has anyone figured out a combination of app flip + mqtt settings that can resolve the issue?

@amaisano
Copy link

amaisano commented Feb 4, 2025

With the current build, set so up on remote is up on the shade (using the remote programming). Set invert in z2m to TRUE.

That's what got it working for me which is fine... for my remaining shades.

@denmoses1
Copy link

With the current build, set so up on remote is up on the shade (using the remote programming). Set invert in z2m to TRUE.

That's what got it working for me which is fine... for my remaining shades.

Thanks
I might be missing something here. When I set it up that way, the open and close work perfectly. But the state doesn’t. Meaning if I open it to 5% it will physically open the window 95%.

@denmoses1
Copy link

Here is a practical use case where things get confusing.
The setup here is with the factory default on the blinds. (Ie no app flip). On z2m the invert flag is set.

The OPEN/CLOSE work correctly as expected.

However when I move and display a position inbetween the following behavior is exhibited in the mushroom card and default cover card respectively.

Physically the window is 87% open. (Or can be interpreted as the cover is 13% open I guess)…either way the default cover card doesn’t match anymore.

Image
Image

@henryjarend
Copy link

I'm having the same problem where my open and closed are reversed in the Z2M UI but in Home Assistant things seem to understand what's going on. However I can't perform any actions using the "open" or "close" buttons and instead have to set the percent open using the slider or setting "100%" in an automation. It appears that Z2M understands the percentage but has some issues understanding "open" and "close"
From the logs after setting position to 100%, Note that the state says open
[2025-02-04 14:13:52] info: z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/middle_loft_blind', payload '{"battery":27,"linkquality":104,"position":100,"state":"OPEN"}'
after I hit the "open" button in Z2M
[2025-02-04 14:14:18] info: z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/middle_loft_blind', payload '{"battery":27,"linkquality":104,"position":0,"state":"CLOSE"}'

@brettmiller
Copy link
Author

Because of an inconsistence introduced in the code there are no settings changes or shade configuration changes that will make things work correctly. Until the code is fixed or the change is reverted the only solution is to use an external converter. I created and external converter based on the file from the PR that caused this and modified line 30 to have coverInverted: false instead of coverInverted: true.

import fz from '../converters/fromZigbee';
import tz from '../converters/toZigbee';
import * as exposes from '../lib/exposes';
import * as reporting from '../lib/reporting';
import {DefinitionWithExtend, Tz, Zh} from '../lib/types';
import {assertString, getFromLookup, getOptions} from '../lib/utils';

const tzLocal = {
    backwards_cover_state: {
        key: ['state'],
        convertSet: async (entity: Zh.Endpoint, key: string, value: number | string, meta: Tz.Meta) => {
            const lookup = {open: 'downClose', close: 'upOpen', stop: 'stop', on: 'downClose', off: 'upOpen'};
            assertString(value, key);
            value = value.toLowerCase();
            await entity.command('closuresWindowCovering', getFromLookup(value, lookup), {}, getOptions(meta.mapped, entity));
        },
    },
};

const e = exposes.presets;

const definitions: DefinitionWithExtend[] = [
    {
        zigbeeModel: ['WM25/L-Z'],
        model: 'WM25L-Z',
        vendor: 'Smartwings',
        description: 'Roller shade',
        fromZigbee: [fz.cover_position_tilt, fz.battery],
        toZigbee: [tzLocal.backwards_cover_state, tz.cover_position_tilt],
        meta: {battery: {dontDividePercentage: true}, coverInverted: false},
        configure: async (device, coordinatorEndpoint) => {
            const endpoint = device.getEndpoint(1);
            await reporting.bind(endpoint, coordinatorEndpoint, ['genPowerCfg', 'closuresWindowCovering']);
            device.powerSource = 'Mains (single phase)';
            device.save();
        },
        exposes: [e.cover_position(), e.battery()],
    },
];

To do this in Home Assistant (at least on HAOS) create the directory /homeassistant/zigbee2mqtt/external_converters if it doesn't exist. Then in that directory create a smartwings.js file with the code above and restart zigbee2mqtt. If you had originally reversed the motor direction of your shade you will probably need to reverse it back. It's possible that you may be able to instead set the invert toggle to true in z2m under the devices "Settings (specific)" tab, but I have not tested that.

@amaisano
Copy link

amaisano commented Feb 4, 2025

IMO, because it was working with documented programming instructions (see the Z2M notes I actually contributed a while back), I vote this gets reverted, at least until we have a solid fix with no inconsistencies.

@ThrashinVictim
Copy link

I think this is dependent on what firmware your blinds have. I have 3 that didn't work and 1 that did work correctly and now with the change I have 3 that work and 1 that doesn't.
I purchased the first set of blinds 4 months before the other 3 so I am sure they are different firmware. (Is there a way to find out?)

@denmoses1
Copy link

IMO, because it was working with documented programming instructions (see the Z2M notes I actually contributed a while back), I vote this gets reverted, at least until we have a solid fix with no inconsistencies.

+1
Totally agree.

@brettmiller
Copy link
Author

brettmiller commented Feb 4, 2025

The change has been reverted, Koenkk/zigbee-herdsman-converters#8681 (comment), but won't be a released until the normal z2m release cycle the first of next month. So, it get it fixed you'll either need to switch to the dev branch (instruction link in that comment) or use the external converter above.

@Koenkk Koenkk closed this as completed Feb 5, 2025
@brettmiller
Copy link
Author

For those following along. The fix for this, reverting the change, is in z2m 2.1.1 that was just release.

@amaisano
Copy link

amaisano commented Feb 6, 2025

Heh, time to go around and re-hack the shades and flip the zigbee settings 🙃

@ThrashinVictim
Copy link

This fixed the old shades I had and broke the 3 that the other revision fixed. So I have a choice to stick with the 2.1.0 and have three that work correctly with Alexa and HA (showing correct state) and have one that doesn't Or go with 2.1.1 and have 3 that show incorrect state and 1 that does.

Is there a way to use a converter for just one set of blinds or is it an all or nothing?

@amaisano
Copy link

amaisano commented Feb 6, 2025

@ThrashinVictim yes - see #26133 (comment) above

@ThrashinVictim
Copy link

@amaisano Those instructions would affect all 4 sets of shades which would still put me in the situation I am in. I just want to point the converter to 1 set of shades while leaving the others with the default settings.

@amaisano
Copy link

amaisano commented Feb 7, 2025

Apologies - I misread the question 😬 - I'm personally not sure how to do that, unless you have two zigbee/z2m instances.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
problem Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants