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

from Soti.IoT.SemanticEngine.Conversions import Converter

print("Loading SatoBluetoothDarknessToGen Converter")

class SatoBluetoothDarknessToGen(Converter):
    def Execute(self, myList = [], *args):
        if not myList or len(myList) == 0:
            return None

        try:
            val = int(myList[0])
        except ValueError:
            return None

        max_val = 10
        min_val = 1
        result = val if val <= max_val else max_val
        result = result if result >= min_val else min_val

        result *= 10

        return result


plugin = SatoBluetoothDarknessToGen("SatoBluetoothDarknessToGen")

store.AddConverter(plugin)