Fix xiaomi binary_sensor warning (#18280)

* Fix xiaomi binary_sensor warning

* Fix xiaomi binary_sensor warning
pull/18337/head
Daniel Høyer Iversen 2018-11-09 11:36:00 +01:00 committed by Anders Melchiorsen
parent b803075eb4
commit c571637176
1 changed files with 3 additions and 0 deletions

View File

@ -357,6 +357,9 @@ class XiaomiVibration(XiaomiBinarySensor):
def parse_data(self, data, raw_data): def parse_data(self, data, raw_data):
"""Parse data sent by gateway.""" """Parse data sent by gateway."""
value = data.get(self._data_key) value = data.get(self._data_key)
if value is None:
return False
if value not in ('vibrate', 'tilt', 'free_fall'): if value not in ('vibrate', 'tilt', 'free_fall'):
_LOGGER.warning("Unsupported movement_type detected: %s", _LOGGER.warning("Unsupported movement_type detected: %s",
value) value)