From 09bb3d22f2323e35139abaf8c618b0bee6a76ef0 Mon Sep 17 00:00:00 2001 From: steve Date: Fri, 17 Feb 2023 08:03:41 +1000 Subject: [PATCH 1/4] Diesel regen bug --- custom_components/fordpass/sensor.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/custom_components/fordpass/sensor.py b/custom_components/fordpass/sensor.py index 844a467..fa107ae 100644 --- a/custom_components/fordpass/sensor.py +++ b/custom_components/fordpass/sensor.py @@ -31,11 +31,13 @@ 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 and sensor.coordinator.data["dieselSystemStatus"]["filterRegenerationStatus"] != None: - sensors.append(sensor) + if "dieselSystemStatus" in sensor.coordinator.data: + if "filterRegenerationStatus" in sensor.coordinator.data["dieselSystemStatus"]: + sensors.append(sensor) elif key == "exhaustFluidLevel": - if "exhaustFluidLevel" in sensor.coordinator.data and sensor.coordinator.data["dieselSystemStatus"]["exhaustFluidLevel"] != None: - sensors.append(sensor) + if "exhaustFluidLevel" in sensor.coordinator.data: + if "exhaustFluidLevel" in sensor.coordinator.data["dieselSystemStatus"]: + sensors.append(sensor) else: sensors.append(sensor) async_add_entities(sensors, True) From a4a500e95ae01fb4cc3bb7543a6170a7193641b8 Mon Sep 17 00:00:00 2001 From: steve Date: Fri, 17 Feb 2023 08:04:47 +1000 Subject: [PATCH 2/4] update version and info.md --- custom_components/fordpass/manifest.json | 2 +- info.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/custom_components/fordpass/manifest.json b/custom_components/fordpass/manifest.json index c545d66..4760f9e 100644 --- a/custom_components/fordpass/manifest.json +++ b/custom_components/fordpass/manifest.json @@ -5,7 +5,7 @@ "integration_type": "device", "documentation": "https://github.com/itchannel/fordpass-ha", "issue_tracker": "https://github.com/itchannel/fordpass-ha/issues", - "version": "0.1.45", + "version": "0.1.46", "requirements": [], "ssdp": [], "zeroconf": [], diff --git a/info.md b/info.md index dd27669..fb06c86 100644 --- a/info.md +++ b/info.md @@ -1,4 +1,6 @@ ## **Changelog** +### Version 1.46 +- Fix diesel filter error ### Version 1.45 - Fix window position reporting as open always ### Version 1.44 From 929f25eaf63d8cd453adbf97b14a999f8d3dc279 Mon Sep 17 00:00:00 2001 From: steve Date: Fri, 17 Feb 2023 08:48:56 +1000 Subject: [PATCH 3/4] 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) From 4ce6208e5fdbfbeb1662e1b7a2148798015a3a18 Mon Sep 17 00:00:00 2001 From: steve Date: Fri, 17 Feb 2023 09:22:50 +1000 Subject: [PATCH 4/4] Diesel fix to handle None "dieselSystemStatus" val --- custom_components/fordpass/sensor.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/custom_components/fordpass/sensor.py b/custom_components/fordpass/sensor.py index e093608..7b145f7 100644 --- a/custom_components/fordpass/sensor.py +++ b/custom_components/fordpass/sensor.py @@ -31,11 +31,13 @@ async def async_setup_entry(hass, config_entry, async_add_entities): if sensor.coordinator.data["elVehDTE"] != None: sensors.append(sensor) elif key == "dieselSystemStatus": - if sensor.coordinator.data.get("dieselSystemStatus", {}).get("filterRegenerationStatus"): - sensors.append(sensor) + if sensor.coordinator.data.get("dieselSystemStatus", {}): + if sensor.coordinator.data.get("dieselSystemStatus", {}).get("filterRegenerationStatus"): + sensors.append(sensor) elif key == "exhaustFluidLevel": - if sensor.coordinator.data.get("dieselSystemStatus", {}).get("exhaustFluidLevel"): - sensors.append(sensor) + if sensor.coordinator.data.get("dieselSystemStatus", {}): + if sensor.coordinator.data.get("dieselSystemStatus", {}).get("exhaustFluidLevel"): + sensors.append(sensor) else: sensors.append(sensor) async_add_entities(sensors, True)