Skip to content

Commit

Permalink
Merge pull request home-assistant#4862 from home-assistant/release-0-…
Browse files Browse the repository at this point in the history
…34-5

0.34.5
  • Loading branch information
balloob authored Dec 12, 2016
2 parents 91a9da8 + 96d8fbe commit cfa36f3
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 22 deletions.
11 changes: 8 additions & 3 deletions homeassistant/components/media_player/plex.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ def __init__(self, device, plex_sessions, update_devices, update_sessions):
self.update_devices = update_devices
self.update_sessions = update_sessions
self.set_device(device)
self._season = None

def set_device(self, device):
"""Set the device property."""
Expand Down Expand Up @@ -240,9 +241,15 @@ def state(self):

def update(self):
"""Get the latest details."""
from plexapi.video import Show

self.update_devices(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
def _convert_na_to_none(self, value):
"""Convert PlexAPI _NA() instances to None."""
Expand Down Expand Up @@ -310,9 +317,7 @@ def media_title(self):
@property
def media_season(self):
"""Season of curent playing media (TV Show only)."""
from plexapi.video import Show
if isinstance(self.session, Show):
return self._convert_na_to_none(self.session.seasons()[0].index)
return self._season

@property
def media_series_title(self):
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/nest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

REQUIREMENTS = [
'http://github.com/technicalpickles/python-nest'
'/archive/dd628f90772d170b9602f262d5d2e7d61bdd3cf5.zip' # nest-cam branch
'#python-nest==3.0.0']
'/archive/b8391d2b3cb8682f8b0c2bdff477179983609f39.zip' # nest-cam branch
'#python-nest==3.0.2']

DOMAIN = 'nest'

Expand Down
31 changes: 16 additions & 15 deletions homeassistant/components/sensor/nest.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,20 @@ def __init__(self, structure, device, variable):

# device specific
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._unit = None

@property
def name(self):
"""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):
Expand All @@ -145,13 +152,10 @@ def state(self):
"""Return the state of the sensor."""
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):
"""Retrieve latest state."""
self._unit = SENSOR_UNITS.get(self.variable, None)

if self.variable == 'operation_mode':
self._state = getattr(self.device, "mode")
else:
Expand All @@ -161,21 +165,18 @@ def update(self):
class NestTempSensor(NestSensor):
"""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
def state(self):
"""Return the state of the sensor."""
return self._state

def update(self):
"""Retrieve latest state."""
if self.device.temperature_scale == 'C':
self._unit = TEMP_CELSIUS
else:
self._unit = TEMP_FAHRENHEIT

temp = getattr(self.device, self.variable)
if temp is None:
self._state = None
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""Constants used by Home Assistant components."""
MAJOR_VERSION = 0
MINOR_VERSION = 34
PATCH_VERSION = '4'
PATCH_VERSION = '5'
__short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION)
__version__ = '{}.{}'.format(__short_version__, PATCH_VERSION)
REQUIRED_PYTHON_VER = (3, 4, 2)
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ hikvision==0.4
# http://github.com/adafruit/Adafruit_Python_DHT/archive/310c59b0293354d07d94375f1365f7b9b9110c7d.zip#Adafruit_DHT==1.3.0

# 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
https://github.com/Danielhiversen/flux_led/archive/0.9.zip#flux_led==0.9
Expand Down

0 comments on commit cfa36f3

Please sign in to comment.