Merge pull request #1 from merlot-dev/patch-1
Resolve Bugs for multiple sockets device. tnx to Merlot-dev ;-)
This commit is contained in:
@@ -337,7 +337,8 @@ class BasePlugin:
|
||||
max_dps = max_unit
|
||||
|
||||
#groups management: #syntax: 1;2 : 3;4
|
||||
max_unit = max_unit + 1
|
||||
# +5 instead of +1 to have spare room for the extra devices for Amp, W, kWh
|
||||
max_unit = max_unit + 5
|
||||
if(Parameters["Mode4"]!="None"):
|
||||
groups = Parameters["Mode4"].split(":")
|
||||
for group in groups:
|
||||
@@ -353,6 +354,8 @@ class BasePlugin:
|
||||
if(val <= max_dps): #single socket dps
|
||||
Domoticz.Device(Name="Tuya SmartPlug (Switch)", Unit=val, TypeName="Switch").Create()
|
||||
Domoticz.Log("Tuya SmartPlug Device (Switch) #" + str(val) +" created.")
|
||||
## After the last DPS add the global devices
|
||||
if(val == max_dps):
|
||||
Domoticz.Device(Name="Tuya SmartPlug (A)" , Unit=val+1, TypeName="Current (Single)").Create()
|
||||
Domoticz.Log("Tuya SmartPlug Device (A) #" + str(val+1) +" created.")
|
||||
Domoticz.Device(Name="Tuya SmartPlug (kWh)", Unit=val+2, TypeName="kWh").Create()
|
||||
|
||||
Reference in New Issue
Block a user