Homematic fixes + device support (#5503)
* Using new MaxShutterContact class * Skip unnecessary function calls * Added casting for VALUE * Some renaming to clarify what's happening * Bumped dependency version * Bumped version in requirements
This commit is contained in:
parent
75adb7ff46
commit
59b0491d29
4 changed files with 15 additions and 12 deletions
|
@ -17,6 +17,7 @@ DEPENDENCIES = ['homematic']
|
||||||
SENSOR_TYPES_CLASS = {
|
SENSOR_TYPES_CLASS = {
|
||||||
"Remote": None,
|
"Remote": None,
|
||||||
"ShutterContact": "opening",
|
"ShutterContact": "opening",
|
||||||
|
"MaxShutterContact": "opening",
|
||||||
"IPShutterContact": "opening",
|
"IPShutterContact": "opening",
|
||||||
"Smoke": "smoke",
|
"Smoke": "smoke",
|
||||||
"SmokeV2": "smoke",
|
"SmokeV2": "smoke",
|
||||||
|
|
|
@ -23,7 +23,7 @@ from homeassistant.config import load_yaml_config_file
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
|
|
||||||
DOMAIN = 'homematic'
|
DOMAIN = 'homematic'
|
||||||
REQUIREMENTS = ["pyhomematic==0.1.19"]
|
REQUIREMENTS = ["pyhomematic==0.1.20"]
|
||||||
|
|
||||||
MIN_TIME_BETWEEN_UPDATE_HUB = timedelta(seconds=300)
|
MIN_TIME_BETWEEN_UPDATE_HUB = timedelta(seconds=300)
|
||||||
SCAN_INTERVAL = timedelta(seconds=30)
|
SCAN_INTERVAL = timedelta(seconds=30)
|
||||||
|
@ -432,8 +432,8 @@ def _system_callback_handler(hass, config, src, *args):
|
||||||
}, config)
|
}, config)
|
||||||
|
|
||||||
|
|
||||||
def _get_devices(hass, device_type, keys, proxy):
|
def _get_devices(hass, discovery_type, keys, proxy):
|
||||||
"""Get the Homematic devices."""
|
"""Get the Homematic devices for given discovery_type."""
|
||||||
device_arr = []
|
device_arr = []
|
||||||
|
|
||||||
for key in keys:
|
for key in keys:
|
||||||
|
@ -441,14 +441,14 @@ def _get_devices(hass, device_type, keys, proxy):
|
||||||
class_name = device.__class__.__name__
|
class_name = device.__class__.__name__
|
||||||
metadata = {}
|
metadata = {}
|
||||||
|
|
||||||
# is class supported by discovery type
|
# Class supported by discovery type
|
||||||
if class_name not in HM_DEVICE_TYPES[device_type]:
|
if class_name not in HM_DEVICE_TYPES[discovery_type]:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Load metadata if needed to generate a param list
|
# Load metadata if needed to generate a param list
|
||||||
if device_type == DISCOVER_SENSORS:
|
if discovery_type == DISCOVER_SENSORS:
|
||||||
metadata.update(device.SENSORNODE)
|
metadata.update(device.SENSORNODE)
|
||||||
elif device_type == DISCOVER_BINARY_SENSORS:
|
elif discovery_type == DISCOVER_BINARY_SENSORS:
|
||||||
metadata.update(device.BINARYNODE)
|
metadata.update(device.BINARYNODE)
|
||||||
else:
|
else:
|
||||||
metadata.update({None: device.ELEMENT})
|
metadata.update({None: device.ELEMENT})
|
||||||
|
@ -459,8 +459,9 @@ def _get_devices(hass, device_type, keys, proxy):
|
||||||
if param in HM_IGNORE_DISCOVERY_NODE:
|
if param in HM_IGNORE_DISCOVERY_NODE:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# add devices
|
# Add devices
|
||||||
_LOGGER.debug("Handling %s: %s", param, channels)
|
_LOGGER.debug("%s: Handling %s: %s: %s",
|
||||||
|
discovery_type, key, param, channels)
|
||||||
for channel in channels:
|
for channel in channels:
|
||||||
name = _create_ha_name(
|
name = _create_ha_name(
|
||||||
name=device.NAME, channel=channel, param=param,
|
name=device.NAME, channel=channel, param=param,
|
||||||
|
@ -485,7 +486,7 @@ def _get_devices(hass, device_type, keys, proxy):
|
||||||
str(err))
|
str(err))
|
||||||
else:
|
else:
|
||||||
_LOGGER.debug("Got no params for %s", key)
|
_LOGGER.debug("Got no params for %s", key)
|
||||||
_LOGGER.debug("%s autodiscovery: %s", device_type, str(device_arr))
|
_LOGGER.debug("%s autodiscovery done: %s", discovery_type, str(device_arr))
|
||||||
return device_arr
|
return device_arr
|
||||||
|
|
||||||
|
|
||||||
|
@ -873,7 +874,7 @@ class HMDevice(Entity):
|
||||||
(self._hmdevice.SENSORNODE, self._hmdevice.getSensorData),
|
(self._hmdevice.SENSORNODE, self._hmdevice.getSensorData),
|
||||||
(self._hmdevice.BINARYNODE, self._hmdevice.getBinaryData)):
|
(self._hmdevice.BINARYNODE, self._hmdevice.getBinaryData)):
|
||||||
for node in metadata:
|
for node in metadata:
|
||||||
if node in self._data:
|
if metadata[node] and node in self._data:
|
||||||
self._data[node] = funct(name=node, channel=self._channel)
|
self._data[node] = funct(name=node, channel=self._channel)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -41,6 +41,7 @@ HM_UNIT_HA_CAST = {
|
||||||
"SUNSHINEDURATION": "#",
|
"SUNSHINEDURATION": "#",
|
||||||
"AIR_PRESSURE": "hPa",
|
"AIR_PRESSURE": "hPa",
|
||||||
"FREQUENCY": "Hz",
|
"FREQUENCY": "Hz",
|
||||||
|
"VALUE": "#"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -435,7 +435,7 @@ pyharmony==1.0.12
|
||||||
pyhik==0.0.7
|
pyhik==0.0.7
|
||||||
|
|
||||||
# homeassistant.components.homematic
|
# homeassistant.components.homematic
|
||||||
pyhomematic==0.1.19
|
pyhomematic==0.1.20
|
||||||
|
|
||||||
# homeassistant.components.device_tracker.icloud
|
# homeassistant.components.device_tracker.icloud
|
||||||
pyicloud==0.9.1
|
pyicloud==0.9.1
|
||||||
|
|
Loading…
Add table
Reference in a new issue