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

Add support for Yooksmart blinds with inverted reporting percentage #971

Merged
merged 1 commit into from
Aug 25, 2021

Conversation

roboteacher2
Copy link
Contributor

For some reason, they accept a standard percentage for commanding the blinds, but invert the reported percentage.

@codecov-commenter
Copy link

Codecov Report

Merging #971 (b6c4ffe) into dev (b7e6173) will decrease coverage by 0.00%.
The diff coverage is 80.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #971      +/-   ##
==========================================
- Coverage   82.55%   82.54%   -0.01%     
==========================================
  Files         189      190       +1     
  Lines        4798     4813      +15     
==========================================
+ Hits         3961     3973      +12     
- Misses        837      840       +3     
Impacted Files Coverage Δ
zhaquirks/yooksmart/D10110blinds.py 80.00% <80.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b7e6173...b6c4ffe. Read the comment docs.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 1054554217

  • 12 of 15 (80.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.008%) to 82.547%

Changes Missing Coverage Covered Lines Changed/Added Lines %
zhaquirks/yooksmart/D10110blinds.py 12 15 80.0%
Totals Coverage Status
Change from base Build 1024783287: -0.008%
Covered Lines: 3973
Relevant Lines: 4813

💛 - Coveralls

@roboteacher2
Copy link
Contributor Author

These are the motors for Yoolax and Graywinds blinds on Amazon. These are the ZF version.

@dmulcahey dmulcahey merged commit 4cf3b59 into zigpy:dev Aug 25, 2021
@rohankapoorcom
Copy link

rohankapoorcom commented Sep 2, 2021

This change appears to have completely broken my Yoolax shades (which were correctly reporting the state prior to this change). With this change, they believe they are closed when they are open (and vice-versa) leading to them not accepting commands to move from Home Assistant. I confirmed that my shades return to normal behavior when I delete the quirk added in this PR and re-configure my shades in ZHA.

I wonder if this behavior is dependent on the firmware version. My shades are Firmware: 0x11006780. @bballwiz5 what version are yours?

@roboteacher2
Copy link
Contributor Author

Hmm... my firmware is Firmware: 0x11006770 so maybe they did fix it in more recent firmware versions? As far as I know, there is no way to update the firmware on these. Both the Hubitat and SmartThings community drivers invert these percentages too.
I don't believe the quirks are setup to include Firmware version in the signature yet. Maybe we can add that as a PR?

@rohankapoorcom
Copy link

Yeah - it certainly seems firmware dependent. Mine were just manufactured (arrived ~1 week ago). I think if we could add firmware version as part of the signature that would solve this problem for sure. @dmulcahey @Adminiuga is that something that could be added?

@MattWestb
Copy link
Contributor

Post the signature string from the device (or better log from ZHA reading the basic cluster then paring the device as being added in the quirk signature and not stripped as in this PR) so the devs can looking at it if its gets difference that ZHA can using for selecting the quirk.

@rohankapoorcom
Copy link

Here's the signature for mine.

{
  "node_descriptor": "NodeDescriptor(logical_type=<LogicalType.EndDevice: 2>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress: 128>, manufacturer_code=4169, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False)",
  "endpoints": {
    "1": {
      "profile_id": 260,
      "device_type": "0x0202",
      "in_clusters": [
        "0x0000",
        "0x0001",
        "0x0003",
        "0x0004",
        "0x0005",
        "0x0020",
        "0x0102"
      ],
      "out_clusters": [
        "0x0003",
        "0x0019"
      ]
    }
  },
  "manufacturer": "yooksmart",
  "model": "D10110",
  "class": "zigpy.device.Device"
}

@roboteacher2
Copy link
Contributor Author

Mine, unfortunately, has the same signature. Seems they updated the software version without changing anything else.

It seems zigpy is getting the firmware version from an OTA update check from the device, then stores it in the HA device registry. Zigpy doesn't store it anywhere itself and does not expose it to quirks. Not sure yet how to connect the two. Probably should open a ticket for this.

@HEAT16
Copy link

HEAT16 commented Oct 7, 2021

My shade also stopped working correctly after this change was made. I noticed that it was reporting backwards but would set to the correct position if I sent a command (if i told it to open to 70% it would do so, but then would display at 30%). I removed and re-added the shade and now not only is it reporting backwards, it only ever reports 0 or 100 when fully open or closed. Is there an easy way for me to get rid of this quirk in my HA installation so that my shade will go back to working as it used to?

@MattWestb
Copy link
Contributor

You can using local quirks that is overriding the quirk that is in HA #693 (comment).

Download the quirk and do the change in the local quirk folder.
The local quirks is not being updated with HA and you need "manager" your self.

@HEAT16
Copy link

HEAT16 commented Oct 7, 2021

You can using local quirks that is overriding the quirk that is in HA #693 (comment).

Download the quirk and do the change in the local quirk folder. The local quirks is not being updated with HA and you need "manager" your self.

The whole yooksmart directory and custom quirk in /zhaquirks didn't exist prior to the August 25th commit, how would I handle removing that file entirely via the custom_zha_quirks directory?

@MattWestb
Copy link
Contributor

Copy the quirk file (its ending with .py from the commit and doing the changes in it.
Then you is installing it in the local quirk folder is ZHA using it from the local folder and you dont need doing any changes in the HA container.

You cant deleting quirk in HA with one local quirk only overriding the installed ones so do one local quirk without the changes that is braking your device.

@MattWestb
Copy link
Contributor

Line 82

                    InvertedWindowCoveringCluster,

is making the change so put the original cluster in that line

                    WindowCovering.cluster_id,

then the quirk is doing nothing to your device.

@MattWestb
Copy link
Contributor

The interesting is witch firmware the device that working OK and not is having then its very likely one firmware bug that is fixed in newer device.

@HEAT16
Copy link

HEAT16 commented Oct 7, 2021

I'll give that a shot, thanks.

As far as firmware, mine is listed as 0x11006780 and was delivered to me on August 9th of this year.

I only noticed it started to working strangely maybe 3 or 4 weeks ago.

@rohankapoorcom
Copy link

@HEAT16 - looks like we have the same firmware version. So it definitely seems like Yooksmart fixed this silently. I haven't had a chance yet to file an issue to work with the devs to use the firmware version as part of the quirk selection process. If you have time to start one, that's probably the next step forward.

@HEAT16
Copy link

HEAT16 commented Oct 7, 2021

Interestingly enough, I made the suggested change and the the directions are back to working normally BUT I still only ever get 0 or 100 out of the position. Now its at 0 when closed, but immediately jumps to 100 as soon as you start to open it. Additionally, if you send a command for it to open/close to a certain percentage, it just closes all the way and goes to 0.

There is definitely still something weird going on.

@rohankapoorcom
Copy link

@HEAT16 - try running a ZHA reconfigure on the device. That's what I had to do to get the position sorted out after swapping out the quirk.

@HEAT16
Copy link

HEAT16 commented Oct 21, 2021

@HEAT16 - try running a ZHA reconfigure on the device. That's what I had to do to get the position sorted out after swapping out the quirk.

@rohankapoorcom I tried this and the position reporting is still all messed up. What exactly did you put in your custom quirks folder to override the default?

@rohankapoorcom
Copy link

@HEAT16

What exactly did you put in your custom quirks folder to override the default?

Nothing, I don't use a custom quirks folder. Instead, I deleted the entire quirk folder from the zha-device-handlers package installed in my Home Assistant system. This has to be done every time I upgrade Home Assistant, but that's infrequently enough that I don't mind.

I'm running a Home Assistant venv environment (directions will likely be different if you run supervised or Home Assistant OS) located at /srv/homeassistant/, so I deleted the folder yooksmart located at /srv/homeassistant/lib64/python-3.9/site-packages/zhaquirks/yooksmart.

I then ran a reconfigure and my shade started operating normally again.

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

Successfully merging this pull request may close these issues.

7 participants