Welasco / HubitatAlarm

6 stars 1 forks source link

Alarm | Fix Zone numbers not sequential #18

Closed Welasco closed 3 years ago

Welasco commented 3 years ago

Alarm | Fix Zone numbers not sequential

Welasco commented 3 years ago

Fixed the number not sequential Now I need to figure out how to allow the change of the zone label, block change zoneid, driver type after it get created and fix the duplicated to with zone- in it:

Allow change to ZoneLabel. Block change for Zone Network ID and Driver type after it get created.

def getZonesSettings(){ def configZones = [] for(int i = 1;i<=settings.zones;i++) { def zoneindex = (i.toString().length() == 1) ? '00'+i.toString() : (i.toString().length() == 2)? '0'+i.toString(): i.toString(); def zoneName = settings."zone-$zoneindex" def zoneType = settings."zonetype-$zoneindex" def zoneNetworkId = (settings."zone-networkid-$zoneindex".toString().length() == 1) ? '00'+settings."zone-networkid-$zoneindex" : (settings."zone-networkid-$zoneindex".toString().length() == 2)? '0'+settings."zone-networkid-$zoneindex": settings."zone-networkid-$zoneindex"; configZones << [ "zone": zoneindex, "type": zoneType, "networkId": zoneNetworkId, "name": zoneName ] } return configZones }

def getZonesSettingsChild(){ def configZones = [] for(int i = 1;i<=settings.zones;i++) { def zoneindex = (i.toString().length() == 1) ? '00'+i.toString() : (i.toString().length() == 2)? '0'+i.toString(): i.toString(); def zoneName = settings."zone-$zoneindex" def zoneType = settings."zonetype-$zoneindex" def zoneNetworkId = (settings."zone-networkid-$zoneindex".toString().length() == 1) ? '00'+settings."zone-networkid-$zoneindex" : (settings."zone-networkid-$zoneindex".toString().length() == 2)? '0'+settings."zone-networkid-$zoneindex": settings."zone-networkid-$zoneindex"; configZones << [ "zone": zoneindex, "type": zoneType, "networkId": "zone-$zoneNetworkId", "name": zoneName ] } return configZones }

Welasco commented 3 years ago

would be better if there were a way to control the input by adding zone- at the input time.