Fix Volvo On Call lock state (#50832)

* Fix Volvo On Call: Locked shows as Unlocked #43260 and #49224

* Update binary_sensor.py

Black changed 'Door lock' to "Door lock" (double quotes)

* Update homeassistant/components/volvooncall/binary_sensor.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update binary_sensor.py

Amend code to pass pylint test

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
victorclaessen 2021-05-22 19:33:02 +02:00 committed by GitHub
parent 99e58f3c18
commit a03ee1e528
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,7 +16,9 @@ class VolvoSensor(VolvoEntity, BinarySensorEntity):
@property
def is_on(self):
"""Return True if the binary sensor is on."""
"""Return True if the binary sensor is on, but invert for the 'Door lock'."""
if self.instrument.attr == "is_locked":
return not self.instrument.is_on
return self.instrument.is_on
@property