From ffb41539acc85a269fd40582f33452289d108a43 Mon Sep 17 00:00:00 2001 From: IAmTheMilkManMyMilkIsDelicious <4s3fgbin@zantaz.anonaddy.com> Date: Tue, 20 Jun 2023 13:23:23 +0100 Subject: [PATCH 1/3] Environment as attribute --- custom_components/portainer/coordinator.py | 2 +- custom_components/portainer/sensor_types.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/custom_components/portainer/coordinator.py b/custom_components/portainer/coordinator.py index c2bb95d..b13f943 100644 --- a/custom_components/portainer/coordinator.py +++ b/custom_components/portainer/coordinator.py @@ -171,8 +171,8 @@ def get_containers(self) -> None: {"name": "EndpointId", "default": eid}, ], ) - for cid in self.data["containers"]: + self.data["containers"][cid]["Environment"] = self.data["endpoints"][eid]["Name"] self.data["containers"][cid]["Name"] = self.data["containers"][cid][ "Names" ][0][1:] diff --git a/custom_components/portainer/sensor_types.py b/custom_components/portainer/sensor_types.py index 6a88c65..f786ffb 100644 --- a/custom_components/portainer/sensor_types.py +++ b/custom_components/portainer/sensor_types.py @@ -35,6 +35,7 @@ "Compose_Stack", "Compose_Service", "Compose_Version", + "Environment" ] From 5aff5651546e04c1205d8bf5d4239bdf30773ac5 Mon Sep 17 00:00:00 2001 From: IAmTheMilkManMyMilkIsDelicious <4s3fgbin@zantaz.anonaddy.com> Date: Tue, 20 Jun 2023 13:27:08 +0100 Subject: [PATCH 2/3] Format --- custom_components/portainer/coordinator.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/custom_components/portainer/coordinator.py b/custom_components/portainer/coordinator.py index b13f943..7475936 100644 --- a/custom_components/portainer/coordinator.py +++ b/custom_components/portainer/coordinator.py @@ -172,7 +172,9 @@ def get_containers(self) -> None: ], ) for cid in self.data["containers"]: - self.data["containers"][cid]["Environment"] = self.data["endpoints"][eid]["Name"] + self.data["containers"][cid]["Environment"] = self.data["endpoints"][ + eid + ]["Name"] self.data["containers"][cid]["Name"] = self.data["containers"][cid][ "Names" ][0][1:] From 59c229ea264654321d1325ac7b03c6116b15ca67 Mon Sep 17 00:00:00 2001 From: Tomaae <23486452+tomaae@users.noreply.github.com> Date: Tue, 20 Jun 2023 15:54:56 +0200 Subject: [PATCH 3/3] Update sensor_types.py black --- custom_components/portainer/sensor_types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/portainer/sensor_types.py b/custom_components/portainer/sensor_types.py index f786ffb..4fb1a32 100644 --- a/custom_components/portainer/sensor_types.py +++ b/custom_components/portainer/sensor_types.py @@ -35,7 +35,7 @@ "Compose_Stack", "Compose_Service", "Compose_Version", - "Environment" + "Environment", ]