From 929f25eaf63d8cd453adbf97b14a999f8d3dc279 Mon Sep 17 00:00:00 2001 From: steve Date: Fri, 17 Feb 2023 08:48:56 +1000 Subject: [PATCH] Diesel debug change --- custom_components/fordpass/sensor.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/custom_components/fordpass/sensor.py b/custom_components/fordpass/sensor.py index fa107ae..e093608 100644 --- a/custom_components/fordpass/sensor.py +++ b/custom_components/fordpass/sensor.py @@ -31,13 +31,11 @@ async def async_setup_entry(hass, config_entry, async_add_entities): if sensor.coordinator.data["elVehDTE"] != None: sensors.append(sensor) elif key == "dieselSystemStatus": - if "dieselSystemStatus" in sensor.coordinator.data: - if "filterRegenerationStatus" in sensor.coordinator.data["dieselSystemStatus"]: - sensors.append(sensor) + if sensor.coordinator.data.get("dieselSystemStatus", {}).get("filterRegenerationStatus"): + sensors.append(sensor) elif key == "exhaustFluidLevel": - if "exhaustFluidLevel" in sensor.coordinator.data: - if "exhaustFluidLevel" in sensor.coordinator.data["dieselSystemStatus"]: - sensors.append(sensor) + if sensor.coordinator.data.get("dieselSystemStatus", {}).get("exhaustFluidLevel"): + sensors.append(sensor) else: sensors.append(sensor) async_add_entities(sensors, True)