From 4518e6bdf7d06ac9a15a1131c82fccae4029937f Mon Sep 17 00:00:00 2001
From: coreGreenberet <green@corona-bytes.net>
Date: Fri, 25 Jan 2019 19:00:37 +0100
Subject: [PATCH] Fix minor homematicip cloud binary sensor issues (#20398)

* fix for smoke detection

* a tilted window is now considered as "open"/on

* changed comparison to enum

* line length

* insert brackets for line length and comparison

* indentation should now be ok for hound
changed api version to 0.10.4

* indentation should now be ok for hound
changed api version to 0.10.4

* updating requirement files

* satisfy lint
---
 .../components/binary_sensor/homematicip_cloud.py         | 8 ++++----
 homeassistant/components/homematicip_cloud/__init__.py    | 2 +-
 requirements_all.txt                                      | 2 +-
 requirements_test_all.txt                                 | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/homeassistant/components/binary_sensor/homematicip_cloud.py b/homeassistant/components/binary_sensor/homematicip_cloud.py
index aba979b94f2..910666f93cb 100644
--- a/homeassistant/components/binary_sensor/homematicip_cloud.py
+++ b/homeassistant/components/binary_sensor/homematicip_cloud.py
@@ -15,8 +15,6 @@ DEPENDENCIES = ['homematicip_cloud']
 
 _LOGGER = logging.getLogger(__name__)
 
-STATE_SMOKE_OFF = 'IDLE_OFF'
-
 
 async def async_setup_platform(
         hass, config, async_add_entities, discovery_info=None):
@@ -65,7 +63,7 @@ class HomematicipShutterContact(HomematicipGenericDevice, BinarySensorDevice):
             return True
         if self._device.windowState is None:
             return None
-        return self._device.windowState == WindowState.OPEN
+        return self._device.windowState != WindowState.CLOSED
 
 
 class HomematicipMotionDetector(HomematicipGenericDevice, BinarySensorDevice):
@@ -95,7 +93,9 @@ class HomematicipSmokeDetector(HomematicipGenericDevice, BinarySensorDevice):
     @property
     def is_on(self):
         """Return true if smoke is detected."""
-        return self._device.smokeDetectorAlarmType != STATE_SMOKE_OFF
+        from homematicip.base.enums import SmokeDetectorAlarmType
+        return (self._device.smokeDetectorAlarmType
+                != SmokeDetectorAlarmType.IDLE_OFF)
 
 
 class HomematicipWaterDetector(HomematicipGenericDevice, BinarySensorDevice):
diff --git a/homeassistant/components/homematicip_cloud/__init__.py b/homeassistant/components/homematicip_cloud/__init__.py
index 700e6274c35..b0ea1a3b348 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.3']
+REQUIREMENTS = ['homematicip==0.10.4']
 
 _LOGGER = logging.getLogger(__name__)
 
diff --git a/requirements_all.txt b/requirements_all.txt
index 8d93a499c9d..72ae6e59b10 100644
--- a/requirements_all.txt
+++ b/requirements_all.txt
@@ -529,7 +529,7 @@ homeassistant-pyozw==0.1.2
 # homekit==0.12.2
 
 # homeassistant.components.homematicip_cloud
-homematicip==0.10.3
+homematicip==0.10.4
 
 # homeassistant.components.google
 # homeassistant.components.remember_the_milk
diff --git a/requirements_test_all.txt b/requirements_test_all.txt
index e1c0b3c00d9..659f02459d3 100644
--- a/requirements_test_all.txt
+++ b/requirements_test_all.txt
@@ -113,7 +113,7 @@ holidays==0.9.9
 home-assistant-frontend==20190121.1
 
 # homeassistant.components.homematicip_cloud
-homematicip==0.10.3
+homematicip==0.10.4
 
 # homeassistant.components.influxdb
 # homeassistant.components.sensor.influxdb
-- 
GitLab