Skip to content

Commit

Permalink
Removed 'stop' support, and add 'closing' and 'opening' status.
Browse files Browse the repository at this point in the history
  • Loading branch information
corporategoth committed May 10, 2023
1 parent 899eae7 commit 14306fe
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
3 changes: 0 additions & 3 deletions custom_components/powerpetdoor/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
CONF_PORT,
CONF_TIMEOUT,
ATTR_ENTITY_ID,
SERVICE_TOGGLE,
SERVICE_OPEN,
SERVICE_CLOSE,
)

DOMAIN = "powerpetdoor"
Expand Down
17 changes: 12 additions & 5 deletions custom_components/powerpetdoor/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, CoordinatorEntity
from homeassistant.config_entries import ConfigEntry, SOURCE_IMPORT
from homeassistant.components.cover import CoverEntity, CoverDeviceClass
from homeassistant.helpers import entity_platform
from homeassistant.components.cover import CoverEntity, CoverDeviceClass, SUPPORT_CLOSE, SUPPORT_OPEN
from .client import PowerPetDoorClient

from .const import (
Expand All @@ -31,9 +30,6 @@
CMD_CLOSE,
STATE_LAST_CHANGE,
FIELD_DOOR_STATUS,
SERVICE_OPEN,
SERVICE_CLOSE,
SERVICE_TOGGLE,
)

import logging
Expand All @@ -42,6 +38,7 @@

class PetDoor(CoordinatorEntity, CoverEntity):
_attr_device_class = CoverDeviceClass.SHUTTER
_attr_supported_features = (SUPPORT_CLOSE | SUPPORT_OPEN)
_attr_position = None

last_change = None
Expand Down Expand Up @@ -100,6 +97,16 @@ def current_cover_position(self) -> int | None:
elif self.coordinator.data in (DOOR_STATE_RISING, DOOR_STATE_CLOSING_MID_OPEN):
return 33

@property
def is_opening(self) -> bool | None:
"""Return True if entity is on."""
return (self.coordinator.data in (DOOR_STATE_RISING, DOOR_STATE_SLOWING))

@property
def is_closing(self) -> bool | None:
"""Return True if entity is on."""
return (self.coordinator.data in (DOOR_STATE_CLOSING_TOP_OPEN, DOOR_STATE_CLOSING_MID_OPEN))

@property
def is_closed(self) -> bool | None:
"""Return True if entity is on."""
Expand Down
2 changes: 1 addition & 1 deletion custom_components/powerpetdoor/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"issue_tracker": "https://github.com/corporategoth/ha-powerpetdoor/issues",
"quality_scale": "gold",
"requirements": [],
"version": "0.3.0"
"version": "0.3.1"
}
3 changes: 0 additions & 3 deletions custom_components/powerpetdoor/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
FIELD_OUTSIDE,
FIELD_POWER,
FIELD_AUTO,
SERVICE_OPEN,
SERVICE_CLOSE,
SERVICE_TOGGLE,
)

import logging
Expand Down

0 comments on commit 14306fe

Please sign in to comment.