Skip to content
This repository has been archived by the owner on Jun 16, 2024. It is now read-only.

new cover options #79

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

philklei
Copy link

Added Cover Position to haaska

@@ -0,0 +1,3 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove this file

Copy link
Author

Choose a reason for hiding this comment

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

done ;)

haaska.py Outdated
@@ -452,6 +452,14 @@ def turn_on(self):
def turn_off(self):
self._call_service('cover/close_cover')

def set_percentage(self, val):
self._call_service('cover/set_cover_position', {'position':val})
Copy link
Contributor

Choose a reason for hiding this comment

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

haaska.py:456:67: E231 missing whitespace after ':'

Copy link
Author

Choose a reason for hiding this comment

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

done

haaska.py Outdated
@@ -452,6 +452,14 @@ def turn_on(self):
def turn_off(self):
self._call_service('cover/close_cover')

def set_percentage(self, val):
self._call_service('cover/set_cover_position', {'position':val})

Copy link
Contributor

Choose a reason for hiding this comment

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

haaska.py:457:1: W293 blank line contains whitespace

Copy link
Author

Choose a reason for hiding this comment

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

fixed

@philklei
Copy link
Author

now, everything is fine ;)


def get_percentage(self):
state = self.ha.get('states/' + self.entity_id)
value = int(state['current_position'])
Copy link

Choose a reason for hiding this comment

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

Not all covers report their current_position (specifically Somfy zwave blinds). I'm doing a terrible hack to make this work on my system:

    def get_percentage(self):
        return 50

    def set_percentage(self, val):
        if val > 50:
            self._call_service('cover/open_cover')
        if val < 50:
            self._call_service('cover/close_cover')

Definitely not saying to do that but you need to check if current_position is None to be safe here.

@Redferne
Copy link

Any ideas on how to implement stop cover? My patio awning never need to extend fully, needs a stop command badly.

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

Successfully merging this pull request may close these issues.

4 participants