add my_partner for get the partner of one device

This commit is contained in:
Cayo Puigdefabregas 2022-11-22 11:59:31 +01:00
parent 67cf797c6c
commit 7bf879bbcf
1 changed files with 8 additions and 0 deletions

View File

@ -632,6 +632,14 @@ class Device(Thing):
return self.binding.device.devicehub_id return self.binding.device.devicehub_id
return self.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 @property
def get_updated(self): def get_updated(self):
if self.placeholder and self.placeholder.binding: if self.placeholder and self.placeholder.binding: