From 7bf879bbcf608889095560df7f9eb462ac1f849f Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Tue, 22 Nov 2022 11:59:31 +0100 Subject: [PATCH] add my_partner for get the partner of one device --- ereuse_devicehub/resources/device/models.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ereuse_devicehub/resources/device/models.py b/ereuse_devicehub/resources/device/models.py index 0f398737..35e4d559 100644 --- a/ereuse_devicehub/resources/device/models.py +++ b/ereuse_devicehub/resources/device/models.py @@ -632,6 +632,14 @@ class Device(Thing): return self.binding.device.devicehub_id return self.devicehub_id + @property + def my_partner(self): + if self.placeholder and self.placeholder.binding: + return self.placeholder.binding + if self.binding: + return self.binding.device + return self + @property def get_updated(self): if self.placeholder and self.placeholder.binding: