Update pyhomematic 1.19 & small cleanups (#5299)

This commit is contained in:
Pascal Vizeli 2017-01-13 21:22:09 +01:00 committed by GitHub
parent 1219ca3c3b
commit a30711f1a0
2 changed files with 14 additions and 16 deletions

View File

@ -23,10 +23,10 @@ from homeassistant.config import load_yaml_config_file
from homeassistant.util import Throttle
DOMAIN = 'homematic'
REQUIREMENTS = ["pyhomematic==0.1.18"]
REQUIREMENTS = ["pyhomematic==0.1.19"]
MIN_TIME_BETWEEN_UPDATE_HUB = timedelta(seconds=300)
MIN_TIME_BETWEEN_UPDATE_VAR = timedelta(seconds=30)
SCAN_INTERVAL = timedelta(seconds=30)
DISCOVER_SWITCHES = 'homematic.switch'
DISCOVER_LIGHTS = 'homematic.light'
@ -54,16 +54,17 @@ SERVICE_SET_DEV_VALUE = 'set_dev_value'
HM_DEVICE_TYPES = {
DISCOVER_SWITCHES: [
'Switch', 'SwitchPowermeter', 'IOSwitch', 'IPSwitch',
'IPSwitchPowermeter', 'KeyMatic'],
'IPSwitchPowermeter', 'KeyMatic', 'HMWIOSwitch'],
DISCOVER_LIGHTS: ['Dimmer', 'KeyDimmer'],
DISCOVER_SENSORS: [
'SwitchPowermeter', 'Motion', 'MotionV2', 'RemoteMotion',
'SwitchPowermeter', 'Motion', 'MotionV2', 'RemoteMotion', 'MotionIP',
'ThermostatWall', 'AreaThermostat', 'RotaryHandleSensor',
'WaterSensor', 'PowermeterGas', 'LuxSensor', 'WeatherSensor',
'WeatherStation', 'ThermostatWall2', 'TemperatureDiffSensor',
'TemperatureSensor', 'CO2Sensor', 'IPSwitchPowermeter'],
DISCOVER_CLIMATE: [
'Thermostat', 'ThermostatWall', 'MAXThermostat', 'ThermostatWall2'],
'Thermostat', 'ThermostatWall', 'MAXThermostat', 'ThermostatWall2',
'MAXWallThermostat'],
DISCOVER_BINARY_SENSORS: [
'ShutterContact', 'Smoke', 'SmokeV2', 'Motion', 'MotionV2',
'RemoteMotion', 'WeatherSensor', 'TiltSensor', 'IPShutterContact'],
@ -234,7 +235,7 @@ def setup(hass, config):
"""Setup the Homematic component."""
from pyhomematic import HMConnection
component = EntityComponent(_LOGGER, DOMAIN, hass)
component = EntityComponent(_LOGGER, DOMAIN, hass, SCAN_INTERVAL)
hass.data[DATA_DELAY] = config[DOMAIN].get(CONF_DELAY)
hass.data[DATA_DEVINIT] = {}
@ -461,9 +462,7 @@ def _get_devices(hass, device_type, keys, proxy):
_LOGGER.debug("Handling %s: %s", param, channels)
for channel in channels:
name = _create_ha_name(
name=device.NAME,
channel=channel,
param=param,
name=device.NAME, channel=channel, param=param,
count=len(channels)
)
device_dict = {
@ -623,7 +622,6 @@ class HMHub(Entity):
state = self._homematic.getServiceMessages(self._name)
self._state = STATE_UNKNOWN if state is None else len(state)
@Throttle(MIN_TIME_BETWEEN_UPDATE_VAR)
def _update_variables_state(self):
"""Retrive all variable data and update hmvariable states."""
if not self._use_variables:
@ -855,11 +853,11 @@ class HMDevice(Entity):
# Set callbacks
for channel in channels_to_sub:
_LOGGER.debug("Subscribe channel %s from %s",
str(channel), self._name)
self._hmdevice.setEventCallback(callback=self._hm_event_callback,
bequeath=False,
channel=channel)
_LOGGER.debug(
"Subscribe channel %s from %s", str(channel), self._name)
self._hmdevice.setEventCallback(
callback=self._hm_event_callback, bequeath=False,
channel=channel)
def _load_data_from_hm(self):
"""Load first value from pyhomematic."""

View File

@ -425,7 +425,7 @@ pyharmony==1.0.12
pyhik==0.0.7
# homeassistant.components.homematic
pyhomematic==0.1.18
pyhomematic==0.1.19
# homeassistant.components.device_tracker.icloud
pyicloud==0.9.1