mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 02:07:09 +00:00
only check heater status if present (#4459)
This commit is contained in:
parent
e6c4113c5b
commit
265232af98
@ -55,10 +55,6 @@ def setup_scanner(hass, config, see):
|
||||
"""True if any door/window is opened."""
|
||||
return any([door[key] for key in door if "Open" in key])
|
||||
|
||||
see(dev_id=dev_id,
|
||||
host_name=host_name,
|
||||
gps=(position["latitude"],
|
||||
position["longitude"]),
|
||||
attributes = dict(
|
||||
unlocked=not vehicle["carLocked"],
|
||||
tank_volume=vehicle["fuelTankVolume"],
|
||||
@ -70,10 +66,19 @@ def setup_scanner(hass, config, see):
|
||||
bulb_failures=len(vehicle["bulbFailures"]) > 0,
|
||||
doors_open=any_opened(vehicle["doors"]),
|
||||
windows_open=any_opened(vehicle["windows"]),
|
||||
heater_on=vehicle["heater"]["status"] != "off",
|
||||
fuel=vehicle["fuelAmount"],
|
||||
odometer=round(vehicle["odometer"] / 1000), # km
|
||||
range=vehicle["distanceToEmpty"]))
|
||||
range=vehicle["distanceToEmpty"])
|
||||
|
||||
if "heater" in vehicle and \
|
||||
"status" in vehicle["heater"]:
|
||||
attributes.update(heater_on=vehicle["heater"]["status"] != "off")
|
||||
|
||||
see(dev_id=dev_id,
|
||||
host_name=host_name,
|
||||
gps=(position["latitude"],
|
||||
position["longitude"]),
|
||||
attributes=attributes)
|
||||
|
||||
def update(now):
|
||||
"""Update status from the online service."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user