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

Venetian blind support for proprietary Fibaro FGRM-222 Roller Shutter devices #24405

Closed

Conversation

ChristianKuehnel
Copy link
Contributor

@ChristianKuehnel ChristianKuehnel commented Jun 8, 2019

Breaking Change:

Should not break anything

Description:

The Fibaro FGR-222/FGRM-2222 ZWave roller shutter devices have a proprietary command class to support setting the tilt angle of venetian blinds (= type of window cover). This PR adds the support to HA for this. This allows the user to set the height of the blinds and the tilt angle separately. It can be used to create nice scenes, e.g. blinds down and angle at 30% so that there is still some light coming.

⚠️ This PR depends on a change in the open-zwave library: home-assistant/open-zwave#6

Related issue (if applicable): fixes #

Pull request with documentation for home-assistant.io (if applicable): home-assistant/home-assistant.io#<home-assistant.io PR number goes here>

Example entry for configuration.yaml (if applicable):

zwave:
  device_config:
    cover.mycover:
      tilt_open_position: 60

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly. Update and include derived files by running python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

@ghost
Copy link

ghost commented Jun 8, 2019

Hey there @home-assistant/z-wave, mind taking a look at this pull request as its been labeled with a integration (zwave) you are listed as a codeowner for? Thanks!

This is a automatic comment generated by codeowners-mention to help ensure issues and pull requests are seen by the right people.

homeassistant/components/zwave/cover.py Outdated Show resolved Hide resolved
homeassistant/components/zwave/cover.py Show resolved Hide resolved
homeassistant/components/zwave/cover.py Outdated Show resolved Hide resolved
@andre-richter
Copy link
Contributor

Awesome, looking forward so much for this to land 🎉

@andre-richter
Copy link
Contributor

andre-richter commented Jun 9, 2019

I propose to make it configurable.

Hardcode to a default of 99 or 50 (49?), and let the user be able to configure an override. Somebody other than us might have a third opinion about what open means, we never know.

Even in my case I might use this feature to set "open" to around 90, because fully open allows the light to bounce off the slat and directly into my eye in some situations, which is inconvenient. Whereas a very tiny downwards angle already prevents that but still has the "open" feeling.

Because of that, I would be fine with whatever hardcoding you go for.

@ChristianKuehnel
Copy link
Contributor Author

OK, I added a parameter (see config example above).

@andre-richter
Copy link
Contributor

Thanks for the update!

For lack of pushing rights to your branch, leaving this diff here (should be better readable than text comments in this case):

diff --git a/homeassistant/components/zwave/cover.py b/homeassistant/components/zwave/cover.py
index 3542df9..b1fe772 100644
--- a/homeassistant/components/zwave/cover.py
+++ b/homeassistant/components/zwave/cover.py
@@ -2,7 +2,7 @@
 import logging
 from homeassistant.core import callback
 from homeassistant.components.cover import (
-    DOMAIN, SUPPORT_OPEN, SUPPORT_CLOSE, ATTR_POSITION)
+    DOMAIN, SUPPORT_OPEN, SUPPORT_CLOSE, ATTR_POSITION, ATTR_TILT_POSITION)
 from homeassistant.components.cover import CoverDevice
 from homeassistant.helpers.dispatcher import async_dispatcher_connect
 from . import (
@@ -252,17 +252,17 @@ class FibaroFGRM222(ZwaveRollershutter):
         else:
             # Limit the range to [0-99], as this what that the ZWave command
             # accepts.
-            tilt_position = max(0, min(99, kwargs.get(ATTR_POSITION)))
+            tilt_position = max(0, min(99, kwargs.get(ATTR_TILT_POSITION)))
             _LOGGER.debug("setting tilt to %d", tilt_position)
             self._value_tilt.data = tilt_position
 
     def open_cover_tilt(self, **kwargs):
         """Set slats to horizontal position."""
-        self.set_cover_tilt_position(position=self._open_tilt_position)
+        self.set_cover_tilt_position(tilt_position=self._open_tilt_position)
 
     def close_cover_tilt(self, **kwargs):
         """Close the slats."""
-        self.set_cover_tilt_position(position=0)
+        self.set_cover_tilt_position(tilt_position=0)
 
     def set_cover_position(self, **kwargs):
         """Move the roller shutter to a specific position.

My tests:

  • Slider working.
  • Open/Close buttons working.
  • tilt_open_position config parameter working.

@ChristianKuehnel
Copy link
Contributor Author

I applied the patch @andre-richter supplied. I can't test this right now...

@andre-richter
Copy link
Contributor

@home-assistant/z-wave, I have independently verified the functionality of this PR on my Fibaro controllers. The code works for @ChristianKuehnel as well, hence two real-life tests in total.

Feel free to start your review :)

BR,
Andre

@andre-richter
Copy link
Contributor

@balloob, sorry to bother you on this one. It's not visible to us who is in the @home-assitant/z-wave group. Since it seems like this PR is getting little attention, wanted ask you if you could ping/delegate somebody for review or tell us who to talk to?

Thanks,
Andre

@andre-richter
Copy link
Contributor

Pinging again since this is now over two weeks old.

@dmulcahey @Adminiuga please let us know how we can help you to drive this to closure.

Thanks,
Andre

@Adminiuga
Copy link
Contributor

@a-andre hrm, I really have 0 exposure to the ZWave component, more on the ZHA/Zigbee side. From my perspective nothing jumps out, but again, have no zwave exposure.

@cgarwood any chance you could take a look at this PR?

@Adminiuga
Copy link
Contributor

@ChristianKuehnel can you please rebase it? showing conflicts with the current dev.

@ChristianKuehnel
Copy link
Contributor Author

@ChristianKuehnel can you please rebase it? showing conflicts with the current dev.

I just squashed the changes and rebased them on dev.

@cgarwood
Copy link
Member

I don't have a lot of experience in the zwave quirks/workarounds or covers, but the python looks fine to me. I can't speak for the required openzwave patch though.

@andre-richter
Copy link
Contributor

I can't speak for the required openzwave patch though

I would argue that QA/review on this one has already been done by the openzwave guys themselves, since the respective patch is already upstream in openzwave master.

@andre-richter
Copy link
Contributor

Ping =/

Guys believe me I am not comfortable nagging here all the time. But we still got no idea who would be responsible for zwave code in the homeassistant team at the moment.

I tried to ping @pvizeli on the corresponding zwave patch but he seems busy.

Best,
Andre

self._open_tilt_position = 50 # type: int
if open_tilt_position is not None:
self._open_tilt_position = open_tilt_position
_LOGGER.debug('open_tilt_position: %s', open_tilt_position)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want side effects, eg logging, in init method.

@ChristianKuehnel
Copy link
Contributor Author

@MartinHjelmare I just removed the init statement.

So the rest is fine and can be merged?
Can you also do the review for the related change home-assistant/open-zwave#6 to the Z-Wave library?

@MartinHjelmare
Copy link
Member

Someone that knows the zwave integration should review here.

@andre-richter
Copy link
Contributor

andre-richter commented Jul 9, 2019

@MartinHjelmare Could you do us a big favor and reach out in your internal channels who currently owns this?

We tried to ping all people that, from the outside, looked responsible, but no luck so far in finding someone who wants to own this.

Thanks a lot,
Andre

@MartinHjelmare MartinHjelmare added this to Needs review in Dev Jul 23, 2019
@andre-richter
Copy link
Contributor

@MartinHjelmare MartinHjelmare added the second-opinion-wanted Add this label when a reviewer needs a second opinion from another member. label Sep 7, 2019
@project-bot project-bot bot moved this from Needs review to Second opinion wanted in Dev Sep 7, 2019
@MartinHjelmare
Copy link
Member

I think we should close this PR, since it depends on another PR that hasn't been merged yet. If the dependency is merged a new PR can be opened.

@andre-richter
Copy link
Contributor

andre-richter commented Sep 7, 2019

Any chance to get more traction on the other PR? Its been ignored for 3 months straight now :(

And it's not even a complicated patch that needs much review, because it is just a cherry-pick from the master open-zwave repo where the code has been reviewed by open-zwave maintainers and is merged already.

@cgarwood
Copy link
Member

cgarwood commented Sep 7, 2019

Still can't speak for the HA ozw1.4 fork, but I'm in the process of updating the HA zwave component for OZW1.6 which should re-align HA with the OZW master. Downside is I'm still a few weeks out most likely from having the updated component ready to go.

@MartinHjelmare
Copy link
Member

Let's close this for now. As soon as the library is ready we can accept this again.

@andre-richter
Copy link
Contributor

1.6 sounds good. Let's wait for that 👍

Dev automation moved this from Second opinion wanted to Cancelled Sep 7, 2019
@MartinHjelmare MartinHjelmare removed the second-opinion-wanted Add this label when a reviewer needs a second opinion from another member. label Sep 7, 2019
@ChristianKuehnel
Copy link
Contributor Author

The library changes was just merged: home-assistant/open-zwave#6

Not sure if we need to wait for a release or if the master branch is being used...

Adminiuga pushed a commit that referenced this pull request Dec 17, 2019
The Fibaro FGR-222/FGRM-2222 ZWave roller shutter devices have a proprietary
command class to support setting the tilt angle of venetian blinds (= type of
window cover). This PR adds the support to HA for this. This allows the user to
set the height of the blinds and the tilt angle separately.

Original patch by @ChristianKuehnel #24405.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Dev
  
Cancelled
Development

Successfully merging this pull request may close these issues.

None yet

6 participants