Fix armed state in fibaro integration (#80218)

* Fix armed state in fibaro integration

* Update homeassistant/components/fibaro/__init__.py

Co-authored-by: Joakim Plate <elupus@ecce.se>

Co-authored-by: Joakim Plate <elupus@ecce.se>
This commit is contained in:
rappenze 2022-10-13 13:51:30 +02:00 committed by GitHub
parent 04cc2ae264
commit d80c0ddb5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -651,7 +651,13 @@ class FibaroDevice(Entity):
self.fibaro_device.properties.batteryLevel
)
if "armed" in self.fibaro_device.properties:
attr[ATTR_ARMED] = self.fibaro_device.properties.armed.lower() == "true"
armed = self.fibaro_device.properties.armed
if isinstance(armed, bool):
attr[ATTR_ARMED] = armed
elif isinstance(armed, str) and armed.lower() in ("true", "false"):
attr[ATTR_ARMED] = armed.lower() == "true"
else:
attr[ATTR_ARMED] = None
except (ValueError, KeyError):
pass