From fa09a93cfe13fb16613fca7676215e315f1a7680 Mon Sep 17 00:00:00 2001 From: ktownsend-personal Date: Sat, 22 Aug 2020 16:19:20 -0500 Subject: [PATCH] add zone status attribute so we can know if queued (#39133) Before this proposed change, all of the zones related to a running program turn "on", but it's not possible to know which zone is actually running (vs. queued). Adding the mapped state values (they are the same as program status values) as an attribute will allow inspection of all 3 states. --- homeassistant/components/rainmachine/switch.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/rainmachine/switch.py b/homeassistant/components/rainmachine/switch.py index 74704398061..c0dc450ee2b 100644 --- a/homeassistant/components/rainmachine/switch.py +++ b/homeassistant/components/rainmachine/switch.py @@ -45,7 +45,7 @@ ATTR_ZONES = "zones" DAYS = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] -PROGRAM_STATUS_MAP = {0: "Not Running", 1: "Running", 2: "Queued"} +RUN_STATUS_MAP = {0: "Not Running", 1: "Running", 2: "Queued"} SOIL_TYPE_MAP = { 0: "Not Set", @@ -233,7 +233,7 @@ class RainMachineProgram(RainMachineSwitch): ATTR_ID: self._switch_data["uid"], ATTR_NEXT_RUN: next_run, ATTR_SOAK: self._switch_data.get("soak"), - ATTR_STATUS: PROGRAM_STATUS_MAP[self._switch_data["status"]], + ATTR_STATUS: RUN_STATUS_MAP[self._switch_data["status"]], ATTR_ZONES: ", ".join(z["name"] for z in self.zones), } ) @@ -290,6 +290,7 @@ class RainMachineZone(RainMachineSwitch): self._attrs.update( { + ATTR_STATUS: RUN_STATUS_MAP[self._switch_data["state"]], ATTR_AREA: details.get("waterSense").get("area"), ATTR_CURRENT_CYCLE: self._switch_data.get("cycle"), ATTR_FIELD_CAPACITY: details.get("waterSense").get("fieldCapacity"),