import clr
clr.AddReference('Soti.Connect.SemanticEngine.Conversions')

from Soti.Connect.SemanticEngine.Conversions import Converter

print("Loading ZebraDarknessToPercentSupportingBothRanges Converter")

class ZebraDarknessToPercentSupportingBothRanges(Converter):

    def Execute(self, args):
        val = 0
        if(args[1] == "zpl"):
            val = round((int((float(args[0])) * 100) / 30))
        elif (args[1] == "cpcl"):
            val = round(((int(args[0])+100) * 100) / 300) 
        return val




plugin = ZebraDarknessToPercentSupportingBothRanges("ZebraDarknessToPercentSupportingBothRanges")

store.AddConverter(plugin)