Update python-wink version and multiple wink fixes/updates. (#11833)

This commit is contained in:
William Scanlon 2018-01-25 11:31:38 -05:00 committed by GitHub
parent 3d9ff372fc
commit 5123487705
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 42 additions and 10 deletions

View file

@ -143,6 +143,13 @@ class WinkHub(WinkBinarySensorDevice):
_attributes['update_needed'] = self.wink.update_needed()
_attributes['firmware_version'] = self.wink.firmware_version()
_attributes['pairing_mode'] = self.wink.pairing_mode()
_kidde_code = self.wink.kidde_radio_code()
if _kidde_code is not None:
# The service call to set the Kidde code
# takes a string of 1s and 0s so it makes
# sense to display it to the user that way
_formatted_kidde_code = "{:b}".format(_kidde_code).zfill(8)
_attributes['kidde_radio_code'] = _formatted_kidde_code
return _attributes

View file

@ -30,6 +30,8 @@ ATTR_SCHEDULE_ENABLED = 'schedule_enabled'
ATTR_SMART_TEMPERATURE = 'smart_temperature'
ATTR_TOTAL_CONSUMPTION = 'total_consumption'
ATTR_VACATION_MODE = 'vacation_mode'
ATTR_HEAT_ON = 'heat_on'
ATTR_COOL_ON = 'cool_on'
DEPENDENCIES = ['wink']
@ -131,6 +133,12 @@ class WinkThermostat(WinkDevice, ClimateDevice):
if self.eco_target:
data[ATTR_ECO_TARGET] = self.eco_target
if self.heat_on:
data[ATTR_HEAT_ON] = self.heat_on
if self.cool_on:
data[ATTR_COOL_ON] = self.cool_on
current_humidity = self.current_humidity
if current_humidity is not None:
data[ATTR_CURRENT_HUMIDITY] = current_humidity
@ -174,6 +182,16 @@ class WinkThermostat(WinkDevice, ClimateDevice):
"""Return status of if the thermostat has detected occupancy."""
return self.wink.occupied()
@property
def heat_on(self):
"""Return whether or not the heat is actually heating."""
return self.wink.heat_on()
@property
def cool_on(self):
"""Return whether or not the heat is actually heating."""
return self.wink.heat_on()
@property
def current_operation(self):
"""Return current operation ie. heat, cool, idle."""

View file

@ -6,8 +6,8 @@ https://home-assistant.io/components/cover.wink/
"""
import asyncio
from homeassistant.components.cover import CoverDevice
from homeassistant.components.wink import DOMAIN, WinkDevice
from homeassistant.components.cover import CoverDevice, STATE_UNKNOWN
from homeassistant.components.wink import WinkDevice, DOMAIN
DEPENDENCIES = ['wink']
@ -35,21 +35,24 @@ class WinkCoverDevice(WinkDevice, CoverDevice):
self.hass.data[DOMAIN]['entities']['cover'].append(self)
def close_cover(self, **kwargs):
"""Close the shade."""
"""Close the cover."""
self.wink.set_state(0)
def open_cover(self, **kwargs):
"""Open the shade."""
"""Open the cover."""
self.wink.set_state(1)
def set_cover_position(self, position, **kwargs):
"""Move the roller shutter to a specific position."""
"""Move the cover shutter to a specific position."""
self.wink.set_state(float(position)/100)
@property
def current_cover_position(self):
"""Return the current position of roller shutter."""
return int(self.wink.state()*100)
"""Return the current position of cover shutter."""
if self.wink.state() is not None:
return int(self.wink.state()*100)
else:
return STATE_UNKNOWN
@property
def is_closed(self):

View file

@ -26,7 +26,7 @@ from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers.event import track_time_interval
from homeassistant.util.json import load_json, save_json
REQUIREMENTS = ['python-wink==1.7.1', 'pubnubsub-handler==1.0.2']
REQUIREMENTS = ['python-wink==1.7.3', 'pubnubsub-handler==1.0.2']
_LOGGER = logging.getLogger(__name__)
@ -357,6 +357,10 @@ def setup(hass, config):
hass.bus.listen(EVENT_HOMEASSISTANT_STOP, save_credentials)
# Save the users potentially updated oauth credentials at a regular
# interval to prevent them from being expired after a HA reboot.
track_time_interval(hass, save_credentials, timedelta(minutes=60))
def force_update(call):
"""Force all devices to poll the Wink API."""
_LOGGER.info("Refreshing Wink states from API")

View file

@ -10,7 +10,7 @@ pair_new_device:
description: One of ["zigbee", "zwave", "zwave_exclusion", "zwave_network_rediscovery", "lutron", "bluetooth", "kidde"].
example: 'zigbee'
kidde_radio_code:
description: 'A string of 8 1s and 0s one for each dip switch on the kidde device left --> right = 1 --> 8'
description: 'A string of 8 1s and 0s one for each dip switch on the kidde device left --> right = 1 --> 8. Down = 1 and Up = 0'
example: '10101010'
rename_wink_device:

View file

@ -948,7 +948,7 @@ python-velbus==2.0.11
python-vlc==1.1.2
# homeassistant.components.wink
python-wink==1.7.1
python-wink==1.7.3
# homeassistant.components.sensor.swiss_public_transport
python_opendata_transport==0.0.3