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

from Soti.IoT.SemanticEngine.Conversions import Converter

print("Loading DarknessPercentToZebraDarknessBothRanges Converter")

class DarknessPercentToZebraDarknessBothRanges(Converter):

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




plugin = DarknessPercentToZebraDarknessBothRanges("DarknessPercentToZebraDarknessBothRanges")

store.AddConverter(plugin)