Bump eight sleep dependency to fix bug (#52408)

This commit is contained in:
Raman Gupta 2021-07-02 01:36:48 -04:00 committed by GitHub
parent ad20b5ced0
commit 9d04ba2804
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 25 deletions

View File

@ -11,10 +11,10 @@ from homeassistant.const import (
CONF_PASSWORD,
CONF_SENSORS,
CONF_USERNAME,
EVENT_HOMEASSISTANT_STOP,
)
from homeassistant.core import callback
from homeassistant.helpers import discovery
from homeassistant.helpers.aiohttp_client import async_get_clientsession
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.dispatcher import (
async_dispatcher_connect,
@ -29,7 +29,6 @@ _LOGGER = logging.getLogger(__name__)
CONF_PARTNER = "partner"
DATA_EIGHT = "eight_sleep"
DEFAULT_PARTNER = False
DOMAIN = "eight_sleep"
HEAT_ENTITY = "heat"
@ -86,12 +85,15 @@ SERVICE_EIGHT_SCHEMA = vol.Schema(
CONFIG_SCHEMA = vol.Schema(
{
DOMAIN: vol.Schema(
DOMAIN: vol.All(
cv.deprecated(CONF_PARTNER),
vol.Schema(
{
vol.Required(CONF_USERNAME): cv.string,
vol.Required(CONF_PASSWORD): cv.string,
vol.Optional(CONF_PARTNER, default=DEFAULT_PARTNER): cv.boolean,
vol.Optional(CONF_PARTNER): cv.boolean,
}
),
)
},
extra=vol.ALLOW_EXTRA,
@ -104,7 +106,6 @@ async def async_setup(hass, config):
conf = config.get(DOMAIN)
user = conf.get(CONF_USERNAME)
password = conf.get(CONF_PASSWORD)
partner = conf.get(CONF_PARTNER)
if hass.config.time_zone is None:
_LOGGER.error("Timezone is not set in Home Assistant")
@ -112,7 +113,7 @@ async def async_setup(hass, config):
timezone = str(hass.config.time_zone)
eight = EightSleep(user, password, timezone, partner, None, hass.loop)
eight = EightSleep(user, password, timezone, async_get_clientsession(hass))
hass.data[DATA_EIGHT] = eight
@ -190,12 +191,6 @@ async def async_setup(hass, config):
DOMAIN, SERVICE_HEAT_SET, async_service_handler, schema=SERVICE_EIGHT_SCHEMA
)
async def stop_eight(event):
"""Handle stopping eight api session."""
await eight.stop()
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, stop_eight)
return True

View File

@ -1,7 +1,10 @@
"""Support for Eight Sleep binary sensors."""
import logging
from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_OCCUPANCY,
BinarySensorEntity,
)
from . import CONF_BINARY_SENSORS, DATA_EIGHT, NAME_MAP, EightSleepHeatEntity
@ -34,13 +37,15 @@ class EightHeatSensor(EightSleepHeatEntity, BinarySensorEntity):
self._sensor = sensor
self._mapped_name = NAME_MAP.get(self._sensor, self._sensor)
self._name = f"{name} {self._mapped_name}"
self._state = None
self._side = self._sensor.split("_")[0]
self._userid = self._eight.fetch_userid(self._side)
self._usrobj = self._eight.users[self._userid]
self._attr_name = f"{name} {self._mapped_name}"
self._attr_device_class = DEVICE_CLASS_OCCUPANCY
_LOGGER.debug(
"Presence Sensor: %s, Side: %s, User: %s",
self._sensor,
@ -48,11 +53,6 @@ class EightHeatSensor(EightSleepHeatEntity, BinarySensorEntity):
self._userid,
)
@property
def name(self):
"""Return the name of the sensor, if any."""
return self._name
@property
def is_on(self):
"""Return true if the binary sensor is on."""

View File

@ -2,7 +2,7 @@
"domain": "eight_sleep",
"name": "Eight Sleep",
"documentation": "https://www.home-assistant.io/integrations/eight_sleep",
"requirements": ["pyeight==0.1.5"],
"requirements": ["pyeight==0.1.8"],
"codeowners": ["@mezz64"],
"iot_class": "cloud_polling"
}

View File

@ -1409,7 +1409,7 @@ pyeconet==0.1.14
pyedimax==0.2.1
# homeassistant.components.eight_sleep
pyeight==0.1.5
pyeight==0.1.8
# homeassistant.components.emby
pyemby==1.7