From a03ee1e5284a8e3745e89363baa7bdbdd397a1d4 Mon Sep 17 00:00:00 2001 From: victorclaessen Date: Sat, 22 May 2021 19:33:02 +0200 Subject: [PATCH] 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 * Update binary_sensor.py Amend code to pass pylint test Co-authored-by: Martin Hjelmare --- homeassistant/components/volvooncall/binary_sensor.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/volvooncall/binary_sensor.py b/homeassistant/components/volvooncall/binary_sensor.py index f08b4509bd1..7d2a9660703 100644 --- a/homeassistant/components/volvooncall/binary_sensor.py +++ b/homeassistant/components/volvooncall/binary_sensor.py @@ -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