Skip to content

Commit

Permalink
Added support for light and blinds groups.
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanU committed Nov 25, 2023
1 parent b20d553 commit 8525430
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 12 deletions.
Binary file removed custom_components/icon.png
Binary file not shown.
Binary file removed custom_components/logo.png
Binary file not shown.
Binary file removed custom_components/[email protected]
Binary file not shown.
2 changes: 1 addition & 1 deletion custom_components/mygekko/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
MANUFACTURER = "myGEKKO | Ekon GmbH"
DOMAIN = "mygekko"
DOMAIN_DATA = f"{DOMAIN}_data"
VERSION = "0.0.36"
VERSION = "0.0.37"

ATTRIBUTION = "Data provided by http://jsonplaceholder.typicode.com/"
ISSUE_URL = "https://github.com/stephanu/mygekko/issues"
Expand Down
31 changes: 22 additions & 9 deletions custom_components/mygekko/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ def __init__(self, coordinator, blind: Blind):
supported_features = self._blind.supported_features
self._attr_supported_features = 0

if BlindFeature.OPEN_CLOSE in supported_features:
self._attr_supported_features |= (
CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE
)

if BlindFeature.OPEN_CLOSE_STOP in supported_features:
self._attr_supported_features |= (
CoverEntityFeature.OPEN
Expand All @@ -62,23 +67,31 @@ def _handle_coordinator_update(self) -> None:
@property
def is_closed(self) -> bool | None:
# myGekko blinds are closed on 100 and open on 0
return ceil(self._blind.position) == 100
return (
ceil(self._blind.position) == 100
if self._blind.position is not None
else None
)

@property
def current_cover_position(self) -> int | None:
"""Position of the cover."""
if self._blind.position is None:
return None
# myGekko blinds are closed on 100 and open on 0
return 100 - int(self._blind.position)
return (
(100 - int(self._blind.position))
if self._blind.position is not None
else None
)

@property
def current_cover_tilt_position(self) -> int | None:
"""Tilt Position of the cover."""
if self._blind.tilt_position is None:
return None
# myGekko blinds are closed on 100 and open on 0
return 100 - int(self._blind.tilt_position)
return (
(100 - int(self._blind.tilt_position))
if self._blind.tilt_position is not None
else None
)

@property
def is_closing(self) -> bool:
Expand All @@ -96,11 +109,11 @@ def is_opening(self) -> bool:

async def async_open_cover(self, **kwargs: Any):
"""Open the cover."""
await self._blind.set_position(0.0)
await self._blind.set_state(BlindState.HOLD_UP)

async def async_close_cover(self, **kwargs: Any):
"""Close cover."""
await self._blind.set_position(100.0)
await self._blind.set_state(BlindState.HOLD_DOWN)

async def async_stop_cover(self, **kwargs: Any):
"""Stop the cover."""
Expand Down
2 changes: 1 addition & 1 deletion custom_components/mygekko/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/stephanu/mygekko/issues",
"logger": ["PyMyGekko"],
"requirements": ["pymygekko==0.0.5rc6"],
"requirements": ["pymygekko==0.0.5rc8"],
"version": "1.0.0"
}
2 changes: 1 addition & 1 deletion requirements_test.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-r requirements_dev.txt
pytest-asyncio
pytest-homeassistant-custom-component==0.13.76
PyMyGekko==0.0.5rc6
PyMyGekko==0.0.5rc8

0 comments on commit 8525430

Please sign in to comment.