Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions homeassistant/components/surepetcare/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging
from typing import Any, Dict, List


from surepy import (
SurePetcare,
SurePetcareAuthenticationError,
Expand All @@ -14,6 +15,7 @@
CONF_ID,
CONF_PASSWORD,
CONF_SCAN_INTERVAL,
CONF_TIMEOUT,
CONF_TYPE,
CONF_USERNAME,
)
Expand All @@ -35,6 +37,7 @@
TOPIC_UPDATE,
)


_LOGGER = logging.getLogger(__name__)


Expand All @@ -51,6 +54,7 @@
cv.ensure_list, [cv.positive_int]
),
vol.Optional(CONF_PETS): vol.All(cv.ensure_list, [cv.positive_int]),
vol.Optional(CONF_TIMEOUT, default=15): cv.positive_int,
Comment thread
benleb marked this conversation as resolved.
Outdated
vol.Optional(
CONF_SCAN_INTERVAL, default=DEFAULT_SCAN_INTERVAL
): cv.time_period,
Expand Down Expand Up @@ -78,6 +82,7 @@ async def async_setup(hass, config) -> bool:
conf[CONF_PASSWORD],
hass.loop,
async_get_clientsession(hass),
api_timeout=conf[CONF_TIMEOUT],
)
await surepy.get_data()
except SurePetcareAuthenticationError:
Expand Down
9 changes: 5 additions & 4 deletions homeassistant/components/surepetcare/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY,
DEVICE_CLASS_PRESENCE,
BinarySensorEntity,
BinarySensorDevice,
Comment thread
benleb marked this conversation as resolved.
Outdated
)
from homeassistant.const import CONF_ID, CONF_TYPE
from homeassistant.core import callback
Expand All @@ -17,6 +17,7 @@
from . import SurePetcareAPI
from .const import DATA_SURE_PETCARE, SPC, TOPIC_UPDATE


_LOGGER = logging.getLogger(__name__)


Expand Down Expand Up @@ -55,7 +56,7 @@ async def async_setup_platform(
async_add_entities(entities, True)


class SurePetcareBinarySensor(BinarySensorEntity):
class SurePetcareBinarySensor(BinarySensorDevice):
"""A binary sensor implementation for Sure Petcare Entities."""

def __init__(
Expand Down Expand Up @@ -105,7 +106,7 @@ def device_class(self) -> str:
return None if not self._device_class else self._device_class

@property
def unique_id(self: BinarySensorEntity) -> str:
def unique_id(self) -> str:
"""Return an unique ID."""
return f"{self._spc_data['household_id']}-{self._id}"

Expand Down Expand Up @@ -214,7 +215,7 @@ def name(self) -> str:
return f"{self._name}_connectivity"

@property
def unique_id(self: BinarySensorEntity) -> str:
def unique_id(self) -> str:
"""Return an unique ID."""
return f"{self._spc_data['household_id']}-{self._id}-connectivity"

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/surepetcare/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"name": "Sure Petcare",
"documentation": "https://www.home-assistant.io/integrations/surepetcare",
"codeowners": ["@benleb"],
"requirements": ["surepy==0.2.3"]
"requirements": ["surepy==0.2.5"]
}
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1993,7 +1993,7 @@ sucks==0.9.4
sunwatcher==0.2.1

# homeassistant.components.surepetcare
surepy==0.2.3
surepy==0.2.5

# homeassistant.components.swiss_hydrological_data
swisshydrodata==0.0.3
Expand Down