mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
commit
cfa36f3546
@ -200,6 +200,7 @@ class PlexClient(MediaPlayerDevice):
|
|||||||
self.update_devices = update_devices
|
self.update_devices = update_devices
|
||||||
self.update_sessions = update_sessions
|
self.update_sessions = update_sessions
|
||||||
self.set_device(device)
|
self.set_device(device)
|
||||||
|
self._season = None
|
||||||
|
|
||||||
def set_device(self, device):
|
def set_device(self, device):
|
||||||
"""Set the device property."""
|
"""Set the device property."""
|
||||||
@ -240,9 +241,15 @@ class PlexClient(MediaPlayerDevice):
|
|||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Get the latest details."""
|
"""Get the latest details."""
|
||||||
|
from plexapi.video import Show
|
||||||
|
|
||||||
self.update_devices(no_throttle=True)
|
self.update_devices(no_throttle=True)
|
||||||
self.update_sessions(no_throttle=True)
|
self.update_sessions(no_throttle=True)
|
||||||
|
|
||||||
|
if isinstance(self.session, Show):
|
||||||
|
self._season = self._convert_na_to_none(
|
||||||
|
self.session.seasons()[0].index)
|
||||||
|
|
||||||
# pylint: disable=no-self-use, singleton-comparison
|
# pylint: disable=no-self-use, singleton-comparison
|
||||||
def _convert_na_to_none(self, value):
|
def _convert_na_to_none(self, value):
|
||||||
"""Convert PlexAPI _NA() instances to None."""
|
"""Convert PlexAPI _NA() instances to None."""
|
||||||
@ -310,9 +317,7 @@ class PlexClient(MediaPlayerDevice):
|
|||||||
@property
|
@property
|
||||||
def media_season(self):
|
def media_season(self):
|
||||||
"""Season of curent playing media (TV Show only)."""
|
"""Season of curent playing media (TV Show only)."""
|
||||||
from plexapi.video import Show
|
return self._season
|
||||||
if isinstance(self.session, Show):
|
|
||||||
return self._convert_na_to_none(self.session.seasons()[0].index)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def media_series_title(self):
|
def media_series_title(self):
|
||||||
|
@ -19,8 +19,8 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
|
|
||||||
REQUIREMENTS = [
|
REQUIREMENTS = [
|
||||||
'http://github.com/technicalpickles/python-nest'
|
'http://github.com/technicalpickles/python-nest'
|
||||||
'/archive/dd628f90772d170b9602f262d5d2e7d61bdd3cf5.zip' # nest-cam branch
|
'/archive/b8391d2b3cb8682f8b0c2bdff477179983609f39.zip' # nest-cam branch
|
||||||
'#python-nest==3.0.0']
|
'#python-nest==3.0.2']
|
||||||
|
|
||||||
DOMAIN = 'nest'
|
DOMAIN = 'nest'
|
||||||
|
|
||||||
|
@ -128,13 +128,20 @@ class NestSensor(Entity):
|
|||||||
|
|
||||||
# device specific
|
# device specific
|
||||||
self._location = self.device.where
|
self._location = self.device.where
|
||||||
self._name = self.device.name_long
|
self._name = "{} {}".format(self.device.name_long,
|
||||||
|
self.variable.replace("_", " "))
|
||||||
self._state = None
|
self._state = None
|
||||||
|
self._unit = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
"""Return the name of the nest, if any."""
|
"""Return the name of the nest, if any."""
|
||||||
return "{} {}".format(self._name, self.variable.replace("_", " "))
|
return self._name
|
||||||
|
|
||||||
|
@property
|
||||||
|
def unit_of_measurement(self):
|
||||||
|
"""Return the unit the value is expressed in."""
|
||||||
|
return self._unit
|
||||||
|
|
||||||
|
|
||||||
class NestBasicSensor(NestSensor):
|
class NestBasicSensor(NestSensor):
|
||||||
@ -145,13 +152,10 @@ class NestBasicSensor(NestSensor):
|
|||||||
"""Return the state of the sensor."""
|
"""Return the state of the sensor."""
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
@property
|
|
||||||
def unit_of_measurement(self):
|
|
||||||
"""Return the unit the value is expressed in."""
|
|
||||||
return SENSOR_UNITS.get(self.variable, None)
|
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Retrieve latest state."""
|
"""Retrieve latest state."""
|
||||||
|
self._unit = SENSOR_UNITS.get(self.variable, None)
|
||||||
|
|
||||||
if self.variable == 'operation_mode':
|
if self.variable == 'operation_mode':
|
||||||
self._state = getattr(self.device, "mode")
|
self._state = getattr(self.device, "mode")
|
||||||
else:
|
else:
|
||||||
@ -161,14 +165,6 @@ class NestBasicSensor(NestSensor):
|
|||||||
class NestTempSensor(NestSensor):
|
class NestTempSensor(NestSensor):
|
||||||
"""Representation of a Nest Temperature sensor."""
|
"""Representation of a Nest Temperature sensor."""
|
||||||
|
|
||||||
@property
|
|
||||||
def unit_of_measurement(self):
|
|
||||||
"""Return the unit the value is expressed in."""
|
|
||||||
if self.device.temperature_scale == 'C':
|
|
||||||
return TEMP_CELSIUS
|
|
||||||
else:
|
|
||||||
return TEMP_FAHRENHEIT
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
"""Return the state of the sensor."""
|
"""Return the state of the sensor."""
|
||||||
@ -176,6 +172,11 @@ class NestTempSensor(NestSensor):
|
|||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Retrieve latest state."""
|
"""Retrieve latest state."""
|
||||||
|
if self.device.temperature_scale == 'C':
|
||||||
|
self._unit = TEMP_CELSIUS
|
||||||
|
else:
|
||||||
|
self._unit = TEMP_FAHRENHEIT
|
||||||
|
|
||||||
temp = getattr(self.device, self.variable)
|
temp = getattr(self.device, self.variable)
|
||||||
if temp is None:
|
if temp is None:
|
||||||
self._state = None
|
self._state = None
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"""Constants used by Home Assistant components."""
|
"""Constants used by Home Assistant components."""
|
||||||
MAJOR_VERSION = 0
|
MAJOR_VERSION = 0
|
||||||
MINOR_VERSION = 34
|
MINOR_VERSION = 34
|
||||||
PATCH_VERSION = '4'
|
PATCH_VERSION = '5'
|
||||||
__short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION)
|
__short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION)
|
||||||
__version__ = '{}.{}'.format(__short_version__, PATCH_VERSION)
|
__version__ = '{}.{}'.format(__short_version__, PATCH_VERSION)
|
||||||
REQUIRED_PYTHON_VER = (3, 4, 2)
|
REQUIRED_PYTHON_VER = (3, 4, 2)
|
||||||
|
@ -164,7 +164,7 @@ hikvision==0.4
|
|||||||
# http://github.com/adafruit/Adafruit_Python_DHT/archive/310c59b0293354d07d94375f1365f7b9b9110c7d.zip#Adafruit_DHT==1.3.0
|
# http://github.com/adafruit/Adafruit_Python_DHT/archive/310c59b0293354d07d94375f1365f7b9b9110c7d.zip#Adafruit_DHT==1.3.0
|
||||||
|
|
||||||
# homeassistant.components.nest
|
# homeassistant.components.nest
|
||||||
http://github.com/technicalpickles/python-nest/archive/dd628f90772d170b9602f262d5d2e7d61bdd3cf5.zip#python-nest==3.0.0
|
http://github.com/technicalpickles/python-nest/archive/b8391d2b3cb8682f8b0c2bdff477179983609f39.zip#python-nest==3.0.2
|
||||||
|
|
||||||
# homeassistant.components.light.flux_led
|
# homeassistant.components.light.flux_led
|
||||||
https://github.com/Danielhiversen/flux_led/archive/0.9.zip#flux_led==0.9
|
https://github.com/Danielhiversen/flux_led/archive/0.9.zip#flux_led==0.9
|
||||||
|
Loading…
x
Reference in New Issue
Block a user