-
-
Notifications
You must be signed in to change notification settings - Fork 8
Add a workaround for low speed open/close #112
Conversation
Hi, thx for this contribution. May I ask how you plan to use this for HA? The integration does not support yet the silent mode (can be done globally through an integration option or through a switch within each device). |
pymfy/api/devices/roller_shutter.py
Outdated
def close(self) -> None: | ||
self.send_command(Command("close")) | ||
def close(self, low_speed: Optional[int] = False) -> None: | ||
command = Command("position_low_speed", Parameter("position", 0) if low_speed else "close") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0 means opened for Somfy and 100 closed:
return self.get_position() == 100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, fixed.
Yes, I checked the code and saw there was no support in HA for this yet. I figured I would first PR this and then attempt to add a contribution to Home Assistant's code in order to make it usable. Eventually it would need to pass the option to this code. :) My personal preference would be a low-speed switch per device. But a global option makes sense too. But might be tricky to implement this considering houses can come with different roller shutters which do not support position_low_speed (like mine). Need to figure out the capabilities and present a switch if there is support. |
pymfy/api/devices/roller_shutter.py
Outdated
def open(self) -> None: | ||
self.send_command(Command("open")) | ||
def open(self, low_speed: Optional[int] = False) -> None: | ||
command = Command("position_low_speed", Parameter("position", 0) if low_speed else "open") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please call set_position if low_speed is True else open?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's what the code does now? Do I need to change anything else?
Yes, that's much more readable! :) |
Is there anything else I can do to get this merged? |
I didn't see the reviens request. Thx for your PR 🙏 |
One last thing, you need to rebase your branch:
|
This (re)uses position_low_speed for low speed close and open because the Somfy API currently does not provide this parameter.
Co-authored-by: Thibaut <[email protected]>
Co-authored-by: Thibaut <[email protected]>
Code Climate has analyzed commit ea79054 and detected 0 issues on this pull request. View more on Code Climate. |
Thanks. Done |
This (re)uses position_low_speed for low speed close and open because the Somfy API currently does not provide this parameter on the rs100 on open/close commands and I would very much like to open/close them quietly via Home Assistant.
I tested the payload using the Somfy web API. Hopefully this workaround makes it possible with your library :)
Please let me know if this could be made prettier!