Skip to content

Instantly share code, notes, and snippets.

@bwarden
Created July 22, 2019 19:20
Show Gist options
  • Save bwarden/947fd5932fb97f9af401a435ba08504a to your computer and use it in GitHub Desktop.
Save bwarden/947fd5932fb97f9af401a435ba08504a to your computer and use it in GitHub Desktop.
diff --git a/home_assistant/custom_components/switch.py b/home_assistant/custom_components/switch.py
index 841b2a4..2f9d26f 100644
--- a/home_assistant/custom_components/switch.py
+++ b/home_assistant/custom_components/switch.py
@@ -51,7 +51,10 @@ class VeSyncSwitchHA(SwitchDevice):
@property
def unique_id(self):
"""Return the ID of this switch."""
- return self.smartplug.cid
+ if hasattr(self.smartplug, 'sub_device_no'):
+ return self.smartplug.cid + str(self.smartplug.sub_device_no)
+ else:
+ return self.smartplug.cid
@property
def name(self):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment