import clr
clr.AddReference('Soti.Connect.SemanticEngine.Conversions')
import math
from Soti.Connect.SemanticEngine.Conversions import Converter

print("Loading EpsonSpeedToGeneric Converter")
class EpsonSpeedToGeneric(Converter):
    def Execute(self, args):
        if args is None or len(args) == 0 or args[0] is None:
            return None
        try:
            level = int(args[0])
        except (ValueError, TypeError):
            return None
        if level < 1 or level > 17:
            return None
        # Map level to mm/s (25.4, 50.8, ..., 431.8)
        return round(level * 25.4, 1)

plugin = EpsonSpeedToGeneric("EpsonSpeedToGeneric")
store.AddConverter(plugin)