This commit is contained in:
Paulus Schoutsen 2019-07-31 12:25:30 -07:00
parent da05dfe708
commit 4de97abc3a
2676 changed files with 163166 additions and 140084 deletions

View file

@ -2,8 +2,7 @@
import logging
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.components.homematic import (
ATTR_DISCOVERY_TYPE, DISCOVER_BATTERY)
from homeassistant.components.homematic import ATTR_DISCOVERY_TYPE, DISCOVER_BATTERY
from homeassistant.const import DEVICE_CLASS_BATTERY
from . import ATTR_DISCOVER_DEVICES, HMDevice
@ -11,19 +10,19 @@ from . import ATTR_DISCOVER_DEVICES, HMDevice
_LOGGER = logging.getLogger(__name__)
SENSOR_TYPES_CLASS = {
'IPShutterContact': 'opening',
'IPShutterContactSabotage': 'opening',
'MaxShutterContact': 'opening',
'Motion': 'motion',
'MotionV2': 'motion',
'PresenceIP': 'motion',
'Remote': None,
'RemoteMotion': None,
'ShutterContact': 'opening',
'Smoke': 'smoke',
'SmokeV2': 'smoke',
'TiltSensor': None,
'WeatherSensor': None,
"IPShutterContact": "opening",
"IPShutterContactSabotage": "opening",
"MaxShutterContact": "opening",
"Motion": "motion",
"MotionV2": "motion",
"PresenceIP": "motion",
"Remote": None,
"RemoteMotion": None,
"ShutterContact": "opening",
"Smoke": "smoke",
"SmokeV2": "smoke",
"TiltSensor": None,
"WeatherSensor": None,
}
@ -56,8 +55,8 @@ class HMBinarySensor(HMDevice, BinarySensorDevice):
def device_class(self):
"""Return the class of this sensor from DEVICE_CLASSES."""
# If state is MOTION (Only RemoteMotion working)
if self._state == 'MOTION':
return 'motion'
if self._state == "MOTION":
return "motion"
return SENSOR_TYPES_CLASS.get(self._hmdevice.__class__.__name__, None)
def _init_data_struct(self):