diff --git a/homeassistant/components/homematicip_cloud/__init__.py b/homeassistant/components/homematicip_cloud/__init__.py index b0ea1a3b348..f048a50d1d0 100644 --- a/homeassistant/components/homematicip_cloud/__init__.py +++ b/homeassistant/components/homematicip_cloud/__init__.py @@ -19,7 +19,7 @@ from .const import ( from .device import HomematicipGenericDevice # noqa: F401 from .hap import HomematicipAuth, HomematicipHAP # noqa: F401 -REQUIREMENTS = ['homematicip==0.10.4'] +REQUIREMENTS = ['homematicip==0.10.5'] _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/homematicip_cloud/sensor.py b/homeassistant/components/homematicip_cloud/sensor.py index 77feda20be1..911c00e45bc 100644 --- a/homeassistant/components/homematicip_cloud/sensor.py +++ b/homeassistant/components/homematicip_cloud/sensor.py @@ -7,11 +7,10 @@ https://home-assistant.io/components/sensor.homematicip_cloud/ import logging from homeassistant.components.homematicip_cloud import ( - HMIPC_HAPID, HomematicipGenericDevice) -from homeassistant.components.homematicip_cloud import DOMAIN as HMIPC_DOMAIN + DOMAIN as HMIPC_DOMAIN, HMIPC_HAPID, HomematicipGenericDevice) from homeassistant.const import ( - DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_ILLUMINANCE, DEVICE_CLASS_TEMPERATURE, - TEMP_CELSIUS) + DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_ILLUMINANCE, + DEVICE_CLASS_TEMPERATURE, TEMP_CELSIUS) _LOGGER = logging.getLogger(__name__) @@ -36,7 +35,9 @@ async def async_setup_entry(hass, config_entry, async_add_entities): AsyncHeatingThermostat, AsyncTemperatureHumiditySensorWithoutDisplay, AsyncTemperatureHumiditySensorDisplay, AsyncMotionDetectorIndoor, AsyncTemperatureHumiditySensorOutdoor, - AsyncMotionDetectorPushButton) + AsyncMotionDetectorPushButton, AsyncLightSensor, + AsyncPlugableSwitchMeasuring, AsyncBrandSwitchMeasuring, + AsyncFullFlushSwitchMeasuring) home = hass.data[HMIPC_DOMAIN][config_entry.data[HMIPC_HAPID]].home devices = [HomematicipAccesspointStatus(home)] @@ -51,6 +52,12 @@ async def async_setup_entry(hass, config_entry, async_add_entities): if isinstance(device, (AsyncMotionDetectorIndoor, AsyncMotionDetectorPushButton)): devices.append(HomematicipIlluminanceSensor(home, device)) + if isinstance(device, AsyncLightSensor): + devices.append(HomematicipLightSensor(home, device)) + if isinstance(device, (AsyncPlugableSwitchMeasuring, + AsyncBrandSwitchMeasuring, + AsyncFullFlushSwitchMeasuring)): + devices.append(HomematicipPowerSensor(home, device)) if devices: async_add_entities(devices) @@ -184,3 +191,30 @@ class HomematicipIlluminanceSensor(HomematicipGenericDevice): def unit_of_measurement(self): """Return the unit this state is expressed in.""" return 'lx' + + +class HomematicipLightSensor(HomematicipIlluminanceSensor): + """Represenation of a HomematicIP Illuminance device.""" + + @property + def state(self): + """Return the state.""" + return self._device.averageIllumination + + +class HomematicipPowerSensor(HomematicipGenericDevice): + """Represenation of a HomematicIP power measuring device.""" + + def __init__(self, home, device): + """Initialize the device.""" + super().__init__(home, device, 'Power') + + @property + def state(self): + """Represenation of the HomematicIP power comsumption value.""" + return self._device.currentPowerConsumption + + @property + def unit_of_measurement(self): + """Return the unit this state is expressed in.""" + return 'W' diff --git a/requirements_all.txt b/requirements_all.txt index 8b2a0a7cc6b..9f43fc82a5d 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -538,7 +538,7 @@ homeassistant-pyozw==0.1.2 homekit==0.12.2 # homeassistant.components.homematicip_cloud -homematicip==0.10.4 +homematicip==0.10.5 # homeassistant.components.google # homeassistant.components.remember_the_milk diff --git a/requirements_test_all.txt b/requirements_test_all.txt index df750d69972..9d768779ccc 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -122,7 +122,7 @@ home-assistant-frontend==20190203.0 homekit==0.12.2 # homeassistant.components.homematicip_cloud -homematicip==0.10.4 +homematicip==0.10.5 # homeassistant.components.influxdb # homeassistant.components.sensor.influxdb