mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 01:37:08 +00:00
Bump eight sleep dependency to fix bug (#52408)
This commit is contained in:
parent
ad20b5ced0
commit
9d04ba2804
@ -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(
|
||||
{
|
||||
vol.Required(CONF_USERNAME): cv.string,
|
||||
vol.Required(CONF_PASSWORD): cv.string,
|
||||
vol.Optional(CONF_PARTNER, default=DEFAULT_PARTNER): cv.boolean,
|
||||
}
|
||||
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): 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
|
||||
|
||||
|
||||
|
@ -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."""
|
||||
|
@ -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"
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user