Return True if the binary sensor is on.
val = getattr(self.vehicle, self._attribute)
if self._attribute == "bulb_failures":
return len(val) > 0 elif self._attribute in ["doors", "windows"]:
return any([val[key] for key in val if "Open" in key])
else:
return val != "Normal"
After Change
Return True if the binary sensor is on.
val = getattr(self.vehicle, self._attribute)
if self._attribute == "bulb_failures":
return bool(val)
elif self._attribute in ["doors", "windows"]:
return any([val[key] for key in val if "Open" in key])
else:
return val != "Normal"