Пример #1
0
def retention(retention):
    """
    Parses a retention object give in JSON to Retention type
    :param retention: retention in JSON
    :return: PropertyInstance.Retention
    """
    if retention is None:
        return None

    context = None
    if retention.get('context') is not None:
        context = PropertyInstance.Context(retention['context'].get('type')
                                           or 'default')

    condition = None
    if retention.get('condition') is not None:
        condition = PropertyInstance.Condition(
            when=retention['condition'].get('when'),
            value=retention['condition'].get('value'))

    retentionType = PropertyInstance.Retention.RetentionType.HISTORICAL
    if retention['type'] == 'mostrecent':
        retentionType = PropertyInstance.Retention.RetentionType.MOSTRECENT

    return PropertyInstance.Retention(type=retentionType,
                                      context=context,
                                      lifetime=retention.get('lifetime'),
                                      capacity=retention.get('capacity'),
                                      condition=condition)
Пример #2
0
def parseMeasurement(measurement):
    """
    Parses a measurement object give in JSON to measurement type
    :param measurement: measurement in JSON
    :return: PropertyInstance.Measurement
    """
    typ = measurement.get('type')
    unit = measurement.get('unit')

    if typ and unit:
        label = unit.get('label')
        symbol = unit.get('symbol')
        if label and symbol:
            return PropertyInstance.Measurement(
                typ, PropertyInstance.MeasurementUnit(label, symbol))
        return None
    return None
Пример #3
0
def wireApp(client):
    # Create compressor app profile
    compressorManager = client.account.appprofiles.create(
        name='CompressorManager',
        friendly_name='Compressor Manager',
        description='Dalgakıran Compressor Management App',
        version='1.0',
        vendor_name='Dalgakıran')

    #------ Add profile properties

    unit = PropertyInstance.MeasurementUnit('', 'TL')
    measurement = PropertyInstance.Measurement('currency', unit)
    client.account.properties(compressorManager.id).create(
        name='electric_cost_per_kWh',
        data_type='number',
        access_type='public',
        publish_type='never',
        measurement=measurement)

    #------ Add profile methods

    client.account.methods(compressorManager.id).create(
        name='getDashboard',
        method_impl=MethodInstance.MethodImplementation(
            app.getDashboard_body()),
        access_type='public')
    client.account.methods(compressorManager.id).create(
        name='getElectricCostPerkWh',
        method_impl=MethodInstance.MethodImplementation(
            app.getElectricCostPerkWh_body()),
        access_type='public')

    # Create compressor app profile
    compressorManagerApp = client.account.apps.create(
        name='CompressorManager',
        friendly_name='Compressor Manager',
        profile='CompressorManager',
        tags=['icon:cogs:#0077c3'])
Пример #4
0
def boundaries(boundaries):
    """
    Parses a boundaries object give in JSON to Boundaries type
    :param boundaries: boundaries in JSON
    :return: PropertyInstance.Boundaries
    """
    if boundaries is None:
        return None

    geofence = None
    if boundaries.get('lat') is not None and boundaries.get(
            'lon') is not None and boundaries.get(
                'radius') is not None and boundaries.get('inside') is not None:
        geofence = PropertyInstance.Boundaries.Geofence(
            boundaries['lat'], boundaries['lon'], boundaries['radius'],
            boundaries['inside'])

    # v3 compatibility
    min = boundaries.get('min')
    max = boundaries.get('max')
    if boundaries.get('range') is not None:
        min = boundaries['range'].get('min')
        max = boundaries['range'].get('max')
    ##
    # v3 compatibility
    size = boundaries.get('size')
    if boundaries.get('size') is not None:
        if isinstance(boundaries['size'], dict):
            size = boundaries['size'].get('value')
    ##

    return PropertyInstance.Boundaries(min=min,
                                       max=max,
                                       size=size,
                                       set=boundaries.get('set'),
                                       geofence=geofence)
Пример #5
0
def wire(client,
         name='LogikaL33',
         friendly="Logika L33 Controller",
         base="BaseLogikaProfile"):
    # Create Logika L33 profile
    compressor = client.account.deviceprofiles.create(
        name=name,
        friendly_name=friendly,
        base_profile=base,
        description='Logika L33 controller',
        tags=['logika', 'L33'],
        device_class='controller',
        product_name='L33',
        vendor_name='Logika')

    #------ Add profile properties

    client.account.properties(compressor.id).create(name="workingFlags",
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    unit = PropertyInstance.MeasurementUnit('Celsius', '°C')
    measurement = PropertyInstance.Measurement('temperature', unit)
    client.account.properties(compressor.id).create(
        name='secondTemperature',
        data_type='number',
        access_type='protected',
        publish_type='never',
        description='Secondary Temperature (°C * 10)',
        measurement=measurement,
        boundaries={
            'min': -10,
            'max': 125
        })
    unit = PropertyInstance.MeasurementUnit('Bar', 'bar')
    measurement = PropertyInstance.Measurement('pressure', unit)
    client.account.properties(compressor.id).create(
        name='secondPressure',
        data_type='number',
        access_type='protected',
        publish_type='never',
        description='Secondary Pressure (Bar * 10)',
        measurement=measurement,
        boundaries={
            'min': 0,
            'max': 16
        })
    unit = PropertyInstance.MeasurementUnit('Volt', 'V')
    measurement = PropertyInstance.Measurement('electricity', unit)
    client.account.properties(compressor.id).create(
        name='drive24VSupply',
        data_type='number',
        access_type='protected',
        publish_type='never',
        description='Drive 24V Supply (V * 10)',
        measurement=measurement,
        boundaries={
            'min': 0,
            'max': 300
        })
    client.account.properties(compressor.id).create(
        name='driveAnalogInput',
        data_type='number',
        access_type='protected',
        publish_type='never',
        description='Drive analog Input (V * 10)',
        measurement=measurement,
        boundaries={
            'min': 0,
            'max': 300
        })
    client.account.properties(compressor.id).create(name='configSwitches',
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')

    # Inverter properties
    unit = PropertyInstance.MeasurementUnit('RPM', 'rpm')
    measurement = PropertyInstance.Measurement('custom', unit)
    client.account.properties(compressor.id).create(name='motorSpeed',
                                                    data_type='number',
                                                    access_type='protected',
                                                    publish_type='never',
                                                    measurement=measurement)
    unit = PropertyInstance.MeasurementUnit('Frequence', 'Hz')
    measurement = PropertyInstance.Measurement('custom', unit)
    client.account.properties(compressor.id).create(name='motorFrequency',
                                                    data_type='number',
                                                    access_type='protected',
                                                    publish_type='never',
                                                    measurement=measurement)
    unit = PropertyInstance.MeasurementUnit('Current', 'A')
    measurement = PropertyInstance.Measurement('electricity', unit)
    client.account.properties(compressor.id).create(name='motorCurrent',
                                                    data_type='number',
                                                    access_type='protected',
                                                    publish_type='never',
                                                    measurement=measurement)

    condition = PropertyInstance.Condition(
        when=PropertyInstance.Condition.ConditionType.CHANGED)
    retention = PropertyInstance.Retention(
        context=PropertyInstance.Context(type='default'),
        capacity='0',
        condition=condition)
    client.account.properties(compressor.id).create(name="driveStatus",
                                                    data_type='string',
                                                    access_type='protected',
                                                    publish_type='never',
                                                    retention=retention)
    client.account.properties(compressor.id).create(name="driveMeasures",
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name="driveFaultString",
                                                    data_type='string',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name="driveCommands",
                                                    data_type='string',
                                                    access_type='protected',
                                                    publish_type='never')

    client.account.properties(compressor.id).create(name="WPx",
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name="SPx",
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name="WPs",
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name="WPS2Px",
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name="WPS2Ps",
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name="WTx",
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name="Wtx_",
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name="STAx",
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    #client.account.properties(compressor.id).create(name="ST3", data_type='object', access_type='protected', publish_type='never')
    client.account.properties(compressor.id).create(name="STT1",
                                                    data_type='number',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name="STD1",
                                                    data_type='number',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name="R0x",
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name="DSx",
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name="DAx",
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name="DFx",
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name="V0x",
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name="D1",
                                                    data_type='number',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name="D3",
                                                    data_type='number',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name="D6",
                                                    data_type='number',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name="D7",
                                                    data_type='number',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name="Sx",
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')

    #------ Add profile methods

    accessLevel2 = 'private'

    client.account.methods(compressor.id).create(
        name='fetchAlarmList',
        method_impl=MethodInstance.MethodImplementation(fetchAlarmList_body()),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='fetchReadRequest',
        method_impl=MethodInstance.MethodImplementation(
            fetchReadRequest_body()),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='fetchWriteRequest',
        method_impl=MethodInstance.MethodImplementation(
            fetchWriteRequest_body()),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='fetchModbusSettings',
        method_impl=MethodInstance.MethodImplementation(
            fetchModbusSettings_body()),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='fetchControllerStates',
        method_impl=MethodInstance.MethodImplementation(
            fetchControllerStates_body()),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='fetchCompressorStates',
        method_impl=MethodInstance.MethodImplementation(
            fetchCompressorStates_body()),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='fetchCompressorStateTypes',
        method_impl=MethodInstance.MethodImplementation(
            fetchCompressorStateTypes_body()),
        access_type=accessLevel2)

    accessLevel3 = 'private'

    # Controller specific SET methods (private)
    client.account.methods(compressor.id).create(
        name='setRelayOutputs',
        method_impl=MethodInstance.MethodImplementation(
            setRelayOutputs_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setDigitalInputs',
        method_impl=MethodInstance.MethodImplementation(
            setDigitalInputs_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setWorkingFlags',
        method_impl=MethodInstance.MethodImplementation(
            setWorkingFlags_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setSecondTemperature',
        method_impl=MethodInstance.MethodImplementation(
            setSecondTemperature_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setSecondPressure',
        method_impl=MethodInstance.MethodImplementation(
            setSecondPressure_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setDrive24VSupply',
        method_impl=MethodInstance.MethodImplementation(
            setDrive24VSupply_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setDriveAnalogInput',
        method_impl=MethodInstance.MethodImplementation(
            setDriveAnalogInput_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setConfigSwitches',
        method_impl=MethodInstance.MethodImplementation(
            setConfigSwitches_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setDriveStatus',
        method_impl=MethodInstance.MethodImplementation(setDriveStatus_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setDriveMeasures',
        method_impl=MethodInstance.MethodImplementation(
            setDriveMeasures_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setDriveFaultString',
        method_impl=MethodInstance.MethodImplementation(
            setDriveFaultString_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setDriveCommands',
        method_impl=MethodInstance.MethodImplementation(
            setDriveCommands_body()),
        access_type=accessLevel3)

    client.account.methods(compressor.id).create(
        name='setWPx',
        method_impl=MethodInstance.MethodImplementation(setWPx_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setSPx',
        method_impl=MethodInstance.MethodImplementation(setSPx_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setSP5',
        method_impl=MethodInstance.MethodImplementation(setSP5_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setSP6',
        method_impl=MethodInstance.MethodImplementation(setSP6_body()),
        access_type=accessLevel3)
    #client.account.methods(compressor.id).create(name='setWPs', method_impl= MethodInstance.MethodImplementation(setWPs_body()), access_type=accessLevel3)
    #client.account.methods(compressor.id).create(name='setWPS2Px', method_impl= MethodInstance.MethodImplementation(setWPS2Px_body()), access_type=accessLevel3)
    #client.account.methods(compressor.id).create(name='setWPS2Ps', method_impl= MethodInstance.MethodImplementation(setWPS2Ps_body()), access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setWTx',
        method_impl=MethodInstance.MethodImplementation(setWTx_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setWtx_',
        method_impl=MethodInstance.MethodImplementation(setWtx_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setSTAx',
        method_impl=MethodInstance.MethodImplementation(setSTAx_body()),
        access_type=accessLevel3)
    #client.account.methods(compressor.id).create(name='setST3', method_impl= MethodInstance.MethodImplementation(setST3_body()), access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setSTT1',
        method_impl=MethodInstance.MethodImplementation(setSTT1_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setSTD1',
        method_impl=MethodInstance.MethodImplementation(setSTD1_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setR0x',
        method_impl=MethodInstance.MethodImplementation(setR0x_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setDSx',
        method_impl=MethodInstance.MethodImplementation(setDSx_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setDAx',
        method_impl=MethodInstance.MethodImplementation(setDAx_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setDFx',
        method_impl=MethodInstance.MethodImplementation(setDFx_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setV0x',
        method_impl=MethodInstance.MethodImplementation(setV0x_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setD6',
        method_impl=MethodInstance.MethodImplementation(setD6_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setD7',
        method_impl=MethodInstance.MethodImplementation(setD7_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setD1',
        method_impl=MethodInstance.MethodImplementation(setD1_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setD3',
        method_impl=MethodInstance.MethodImplementation(setD3_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setS12_S13_S14',
        method_impl=MethodInstance.MethodImplementation(setS12_S13_S14_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setS02',
        method_impl=MethodInstance.MethodImplementation(setS02_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setS07',
        method_impl=MethodInstance.MethodImplementation(setS07_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setS08_S09',
        method_impl=MethodInstance.MethodImplementation(setS08_S09_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setS11',
        method_impl=MethodInstance.MethodImplementation(setS11_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setS16',
        method_impl=MethodInstance.MethodImplementation(setS16_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setS15',
        method_impl=MethodInstance.MethodImplementation(setS15_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setS21_S22',
        method_impl=MethodInstance.MethodImplementation(setS21_S22_body()),
        access_type=accessLevel3)

    #client.account.methods(compressor.id).create(name='setDF7', method_impl= MethodInstance.MethodImplementation(setDF7_body()), access_type=accessLevel3)

    client.account.methods(compressor.id).create(
        name='makeCompressorCommand',
        method_impl=MethodInstance.MethodImplementation(
            makeCompressorCommand_body()),
        access_type='protected')

    accessLevel4 = 'public'

    # Controller specific public methods
    client.account.methods(compressor.id).create(
        name='hasInverter',
        method_impl=MethodInstance.MethodImplementation(hasInverter_body()),
        access_type=accessLevel4)

    # Controller specific tag R/W operations - Read-only tags first
    client.account.methods(compressor.id).create(
        name='readWorkingFlags',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('workingFlags')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readSecondTemperature',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('secondTemperature')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readSecondPressure',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('secondPressure')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readDrive24VSupply',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('drive24VSupply')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readDriveAnalogInput',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('driveAnalogInput')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readConfigSwitches',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('configSwitches')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readDriveStatus',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('driveStatus')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readDriveMeasures',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('driveMeasures')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readDriveFaultString',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('driveFaultString')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readDriveCommands',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('driveCommands')),
        access_type=accessLevel4)

    client.account.methods(compressor.id).create(
        name='readWPx',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('WP')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readSPx',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('SP')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readSP5',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('SP5')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readSP6',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('SP6')),
        access_type=accessLevel4)
    #client.account.methods(compressor.id).create(name='readWPs', method_impl= MethodInstance.MethodImplementation(readTagIntoProperty_body('WPs')), access_type=accessLevel4)
    #client.account.methods(compressor.id).create(name='readWPS2Px', method_impl= MethodInstance.MethodImplementation(readTagIntoProperty_body('WPS2P')), access_type=accessLevel4)
    #client.account.methods(compressor.id).create(name='readWPS2Ps', method_impl= MethodInstance.MethodImplementation(readTagIntoProperty_body('WPS2Ps')), access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readWTx',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('WT')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readWtx_',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('Wt')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readWt11',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('Wt11')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readSTAx',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('STA')),
        access_type=accessLevel4)
    #client.account.methods(compressor.id).create(name='readST3', method_impl= MethodInstance.MethodImplementation(readTagIntoProperty_body('ST3')), access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readSTT1',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('STT1')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readSTD1',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('STD1')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readR0x',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('R0')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readR03',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('R03')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readDSx',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('DS')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readDAx',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('DA')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readDFx',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('DF')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readV0',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('V0')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readD1',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('D1')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readD3',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('D3')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readD6',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('D6')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readD7',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('D7')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readS12_S13_S14',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('S12')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readS02',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('S02')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readS07',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('S07')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readS08_S09',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('S08')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readS11',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('S11')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readS16',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('S16')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readS15',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('S15')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readS21_S22',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('S21')),
        access_type=accessLevel4)
    #client.account.methods(compressor.id).create(name='readDF7', method_impl= MethodInstance.MethodImplementation(readTagIntoProperty_body('DF7')), access_type=accessLevel4)

    # Write Only Tags
    client.account.methods(compressor.id).create(
        name='writeRelativeSpeed',
        method_impl=MethodInstance.MethodImplementation(
            writeRelativeSpeed_body()),
        access_type=accessLevel4)
    #
    client.account.methods(compressor.id).create(
        name='writeLevel1Password',
        method_impl=MethodInstance.MethodImplementation(
            writeLevel1Password_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeLevel2Password',
        method_impl=MethodInstance.MethodImplementation(
            writeLevel2Password_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeLevel3Password',
        method_impl=MethodInstance.MethodImplementation(
            writeLevel3Password_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeConfigSwitches',
        method_impl=MethodInstance.MethodImplementation(
            writeConfigSwitches_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeWPx',
        method_impl=MethodInstance.MethodImplementation(writeWPx_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeSPx',
        method_impl=MethodInstance.MethodImplementation(writeSPx_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeSP5',
        method_impl=MethodInstance.MethodImplementation(writeSP5_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeSP6',
        method_impl=MethodInstance.MethodImplementation(writeSP6_body()),
        access_type=accessLevel4)
    #client.account.methods(compressor.id).create(name='writeWPs', method_impl= MethodInstance.MethodImplementation(writeWPs_body()), access_type=accessLevel4)
    #client.account.methods(compressor.id).create(name='writeWPS2Px', method_impl= MethodInstance.MethodImplementation(writeWPS2Px_body()), access_type=accessLevel4)
    #client.account.methods(compressor.id).create(name='writeWPS2Ps', method_impl= MethodInstance.MethodImplementation(writeWPS2Ps_body()), access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeWTx',
        method_impl=MethodInstance.MethodImplementation(writeWTx_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeWtx_',
        method_impl=MethodInstance.MethodImplementation(writeWtx_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeSTAx',
        method_impl=MethodInstance.MethodImplementation(writeSTAx_body()),
        access_type=accessLevel4)
    #client.account.methods(compressor.id).create(name='writeST3', method_impl= MethodInstance.MethodImplementation(writeST3_body()), access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeSTT1',
        method_impl=MethodInstance.MethodImplementation(writeSTT1_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeSTD1',
        method_impl=MethodInstance.MethodImplementation(writeSTD1_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeR0x',
        method_impl=MethodInstance.MethodImplementation(writeR0x_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeDSx',
        method_impl=MethodInstance.MethodImplementation(writeDSx_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeDAx',
        method_impl=MethodInstance.MethodImplementation(writeDAx_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeDFx',
        method_impl=MethodInstance.MethodImplementation(writeDFx_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeV0x',
        method_impl=MethodInstance.MethodImplementation(writeV0x_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeD6',
        method_impl=MethodInstance.MethodImplementation(writeD6_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeD7',
        method_impl=MethodInstance.MethodImplementation(writeD7_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeD1',
        method_impl=MethodInstance.MethodImplementation(writeD1_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeD3',
        method_impl=MethodInstance.MethodImplementation(writeD3_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeS12_S13_S14',
        method_impl=MethodInstance.MethodImplementation(
            writeS12_S13_S14_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeS02',
        method_impl=MethodInstance.MethodImplementation(writeS02_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeS07',
        method_impl=MethodInstance.MethodImplementation(writeS07_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeS08_S09',
        method_impl=MethodInstance.MethodImplementation(writeS08_S09_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeS11',
        method_impl=MethodInstance.MethodImplementation(writeS11_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeS16',
        method_impl=MethodInstance.MethodImplementation(writeS16_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeS15',
        method_impl=MethodInstance.MethodImplementation(writeS15_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeS21_S22',
        method_impl=MethodInstance.MethodImplementation(writeS21_S22_body()),
        access_type=accessLevel4)
Пример #6
0
def wire(client,
         name="LogikaL26",
         friendly="Logika L26 Controller",
         base="BaseLogikaProfile"):
    # Create Logika L26 profile
    compressor = client.account.deviceprofiles.create(
        name=name,
        friendly_name=friendly,
        base_profile=base,
        description='Logika L26 controller',
        tags=['logika', 'L26'],
        device_class='controller',
        product_name='L26',
        vendor_name='Logika')

    #------ Add profile properties

    unit = PropertyInstance.MeasurementUnit('Bar', 'bar')
    measurement = PropertyInstance.Measurement('pressure', unit)
    client.account.properties(compressor.id).create(name='auxPressure',
                                                    data_type='number',
                                                    access_type='protected',
                                                    publish_type='never',
                                                    measurement=measurement,
                                                    boundaries={
                                                        'min': 0,
                                                        'max': 16
                                                    })

    unit = PropertyInstance.MeasurementUnit('Volt', 'V')
    measurement = PropertyInstance.Measurement('electricity', unit)
    client.account.properties(compressor.id).create(name='ptcInput',
                                                    data_type='number',
                                                    access_type='protected',
                                                    publish_type='never',
                                                    measurement=measurement,
                                                    boundaries={
                                                        'min': 0,
                                                        'max': 300
                                                    })

    unit = PropertyInstance.MeasurementUnit('Frequence', 'Hz')
    measurement = PropertyInstance.Measurement('custom', unit)
    client.account.properties(compressor.id).create(name='analogueOutFreq',
                                                    data_type='number',
                                                    access_type='protected',
                                                    publish_type='never',
                                                    measurement=measurement,
                                                    boundaries={
                                                        'min': 0,
                                                        'max': 400
                                                    })

    client.account.properties(compressor.id).create(name='configSwitches',
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='configSelections',
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')

    condition = PropertyInstance.Condition(
        when=PropertyInstance.Condition.ConditionType.CHANGED)
    retention = PropertyInstance.Retention(
        context=PropertyInstance.Context(type='default'),
        capacity='0',
        condition=condition)
    client.account.properties(compressor.id).create(name="driveStatus",
                                                    data_type='string',
                                                    access_type='protected',
                                                    publish_type='never',
                                                    retention=retention)
    #
    client.account.properties(compressor.id).create(name="driveMeasures",
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name="driveFaultString",
                                                    data_type='string',
                                                    access_type='protected',
                                                    publish_type='never')

    # Inverter properties
    unit = PropertyInstance.MeasurementUnit('RPM', 'rpm')
    measurement = PropertyInstance.Measurement('custom', unit)
    client.account.properties(compressor.id).create(name='motorSpeed',
                                                    data_type='number',
                                                    access_type='protected',
                                                    publish_type='never',
                                                    measurement=measurement)
    unit = PropertyInstance.MeasurementUnit('Frequence', 'Hz')
    measurement = PropertyInstance.Measurement('custom', unit)
    client.account.properties(compressor.id).create(name='motorFrequency',
                                                    data_type='number',
                                                    access_type='protected',
                                                    publish_type='never',
                                                    measurement=measurement)
    unit = PropertyInstance.MeasurementUnit('Current', 'A')
    measurement = PropertyInstance.Measurement('electricity', unit)
    client.account.properties(compressor.id).create(name='motorCurrent',
                                                    data_type='number',
                                                    access_type='protected',
                                                    publish_type='never',
                                                    measurement=measurement)

    client.account.properties(compressor.id).create(name='WPx',
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='WTx',
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='Wtx_',
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='C07_x',
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='C02',
                                                    data_type='number',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='C08',
                                                    data_type='number',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='C10',
                                                    data_type='number',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='C07_5',
                                                    data_type='number',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='C25',
                                                    data_type='number',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='APx',
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='C19_x',
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='PIx',
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='FRx',
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='PTx',
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='PM1',
                                                    data_type='number',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='AOx',
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='C20_x',
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='C22',
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='DRx',
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='DAx',
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')

    #------ Add profile methods

    accessLevel2 = 'private'

    # Overriden methods
    client.account.methods(compressor.id).create(
        name='fetchAlarmList',
        method_impl=MethodInstance.MethodImplementation(fetchAlarmList_body()),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='fetchReadRequest',
        method_impl=MethodInstance.MethodImplementation(
            fetchReadRequest_body()),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='fetchWriteRequest',
        method_impl=MethodInstance.MethodImplementation(
            fetchWriteRequest_body()),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='fetchModbusSettings',
        method_impl=MethodInstance.MethodImplementation(
            fetchModbusSettings_body()),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='fetchControllerStates',
        method_impl=MethodInstance.MethodImplementation(
            fetchControllerStates_body()),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='fetchCompressorStates',
        method_impl=MethodInstance.MethodImplementation(
            fetchCompressorStates_body()),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='fetchCompressorStateTypes',
        method_impl=MethodInstance.MethodImplementation(
            fetchCompressorStateTypes_body()),
        access_type=accessLevel2)

    accessLevel3 = 'private'

    # Controller specific SET methods (private)
    client.account.methods(compressor.id).create(
        name='setRelayOutputs',
        method_impl=MethodInstance.MethodImplementation(
            setRelayOutputs_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setDigitalInputs',
        method_impl=MethodInstance.MethodImplementation(
            setDigitalInputs_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setAuxPressure',
        method_impl=MethodInstance.MethodImplementation(setAuxPressure_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setPTCInput',
        method_impl=MethodInstance.MethodImplementation(setPTCInput_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setAnalogueOutFreq',
        method_impl=MethodInstance.MethodImplementation(
            setAnalogueOutFreq_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setConfigSwitches',
        method_impl=MethodInstance.MethodImplementation(
            setConfigSwitches_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setConfigSelections',
        method_impl=MethodInstance.MethodImplementation(
            setConfigSelections_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setDriveStatus',
        method_impl=MethodInstance.MethodImplementation(setDriveStatus_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setDriveMeasures',
        method_impl=MethodInstance.MethodImplementation(
            setDriveMeasures_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setDriveFaultString',
        method_impl=MethodInstance.MethodImplementation(
            setDriveFaultString_body()),
        access_type=accessLevel3)

    client.account.methods(compressor.id).create(
        name='setWPx',
        method_impl=MethodInstance.MethodImplementation(setWPx_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setWTx',
        method_impl=MethodInstance.MethodImplementation(setWTx_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setWtx_',
        method_impl=MethodInstance.MethodImplementation(setWtx_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setC07_x',
        method_impl=MethodInstance.MethodImplementation(setC07x_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setC08',
        method_impl=MethodInstance.MethodImplementation(setC08_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setC02',
        method_impl=MethodInstance.MethodImplementation(setC02_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setC10',
        method_impl=MethodInstance.MethodImplementation(setC10_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setC07_5',
        method_impl=MethodInstance.MethodImplementation(setC07_5_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setC25',
        method_impl=MethodInstance.MethodImplementation(setC25_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setAPx',
        method_impl=MethodInstance.MethodImplementation(setAPx_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setC19_x',
        method_impl=MethodInstance.MethodImplementation(setC19x_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setPIx',
        method_impl=MethodInstance.MethodImplementation(setPIx_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setFRx',
        method_impl=MethodInstance.MethodImplementation(setFRx_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setPTx',
        method_impl=MethodInstance.MethodImplementation(setPTx_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setPM1',
        method_impl=MethodInstance.MethodImplementation(setPM1_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setAOx',
        method_impl=MethodInstance.MethodImplementation(setAOx_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setC20_x',
        method_impl=MethodInstance.MethodImplementation(setC20x_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setC22',
        method_impl=MethodInstance.MethodImplementation(setC22_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setDRx',
        method_impl=MethodInstance.MethodImplementation(setDRx_body()),
        access_type=accessLevel3)
    client.account.methods(compressor.id).create(
        name='setDAx',
        method_impl=MethodInstance.MethodImplementation(setDAx_body()),
        access_type=accessLevel3)

    client.account.methods(compressor.id).create(
        name='makeCompressorCommand',
        method_impl=MethodInstance.MethodImplementation(
            makeCompressorCommand_body()),
        access_type='protected')

    accessLevel4 = 'public'

    # Controller specific public methods
    client.account.methods(compressor.id).create(
        name='hasInverter',
        method_impl=MethodInstance.MethodImplementation(hasInverter_body()),
        access_type=accessLevel4)

    # Controller specific tag R/W operations - Read-only tags first
    client.account.methods(compressor.id).create(
        name='readAuxPressure',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('auxPressure')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readPTCInput',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('ptcInput')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readAnalogueOutFreq',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('analogueOut')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readConfigSwitches',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('configSwitches')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readConfigSelections',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('configSelections')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readDriveStatus',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('driveStatus')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readDriveMeasures',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('driveMeasures')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readDriveFaultString',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('driveFaultString')),
        access_type=accessLevel4)

    #
    client.account.methods(compressor.id).create(
        name='readWPx',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('WP')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readWTx',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('WT')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readWtx_',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('Wt')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readC07_x',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('C07')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readC02',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('C02')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readC08',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('C08')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readC10',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('C10')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readC07_5',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('C07_5')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readC25',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('C25')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readAPx',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('AP')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readC19_x',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('C19')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readPIx',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('PI')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readFRx',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('FR')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readPTx',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('PT')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readPM1',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('PM1')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readAOx',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('AO')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readC20_x',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('C20')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readC22',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('C22')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readDRx',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('DR')),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='readDAx',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('DA')),
        access_type=accessLevel4)

    #
    client.account.methods(compressor.id).create(
        name='writeWPx',
        method_impl=MethodInstance.MethodImplementation(writeWPx_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeWTx',
        method_impl=MethodInstance.MethodImplementation(writeWTx_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeWtx_',
        method_impl=MethodInstance.MethodImplementation(writeWtx_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeC07_x',
        method_impl=MethodInstance.MethodImplementation(writeC07x_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeC02',
        method_impl=MethodInstance.MethodImplementation(writeC02_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeC08',
        method_impl=MethodInstance.MethodImplementation(writeC08_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeC10',
        method_impl=MethodInstance.MethodImplementation(writeC10_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeC07_5',
        method_impl=MethodInstance.MethodImplementation(writeC07_5_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeC25',
        method_impl=MethodInstance.MethodImplementation(writeC25_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeAPx',
        method_impl=MethodInstance.MethodImplementation(writeAPx_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeAP4',
        method_impl=MethodInstance.MethodImplementation(writeAP4_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeC19_1',
        method_impl=MethodInstance.MethodImplementation(writeC19_1_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeC19_2',
        method_impl=MethodInstance.MethodImplementation(writeC19_2_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writePIx',
        method_impl=MethodInstance.MethodImplementation(writePIx_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeFRx',
        method_impl=MethodInstance.MethodImplementation(writeFRx_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writePTx',
        method_impl=MethodInstance.MethodImplementation(writePTx_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writePM1',
        method_impl=MethodInstance.MethodImplementation(writePM1_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeAOx',
        method_impl=MethodInstance.MethodImplementation(writeAOx_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeC20_x',
        method_impl=MethodInstance.MethodImplementation(writeC20x_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeC2x',
        method_impl=MethodInstance.MethodImplementation(writeC22_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeDRx',
        method_impl=MethodInstance.MethodImplementation(writeDRx_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeDAx',
        method_impl=MethodInstance.MethodImplementation(writeDAx_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeLevel1Password',
        method_impl=MethodInstance.MethodImplementation(
            writeLevel1Password_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeLevel2Password',
        method_impl=MethodInstance.MethodImplementation(
            writeLevel2Password_body()),
        access_type=accessLevel4)
    client.account.methods(compressor.id).create(
        name='writeLevel3Password',
        method_impl=MethodInstance.MethodImplementation(
            writeLevel3Password_body()),
        access_type=accessLevel4)
Пример #7
0
def wireBase(client,
             name="BaseLogikaProfile",
             friendly="Logika Base",
             base='ModbusGateway'):
    # Create new Logika base profile
    compressor = client.account.deviceprofiles.create(
        name=name,
        friendly_name=friendly,
        base_profile=base,
        description='Logika controller base profile',
        tags=['logika', 'base'],
        device_class='controller',
        product_name='LSeries',
        vendor_name='Logika')

    #------ Add base profile properties

    client.account.properties(compressor.id).create(name='tagValue',
                                                    data_type='string',
                                                    access_type='protected',
                                                    publish_type='never')

    client.account.properties(compressor.id).create(name='cfgSerialNumber',
                                                    data_type='string',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='cfgLogikaModel',
                                                    data_type='string',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='cfgLogikaFwVersion',
                                                    data_type='string',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='cfgLevel1Pwd',
                                                    data_type='string',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='cfgLevel2Pwd',
                                                    data_type='string',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='cfgLevel3Pwd',
                                                    data_type='string',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='activeAlarms',
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='activeAlarmsNonAck',
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='controllerState',
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='compressorState',
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='blockingAlarm',
                                                    data_type='string',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='relayOutputs',
                                                    data_type='string',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='digitalInputs',
                                                    data_type='string',
                                                    access_type='protected',
                                                    publish_type='never')
    unit = PropertyInstance.MeasurementUnit('Celsius', '°C')
    measurement = PropertyInstance.Measurement('temperature', unit)
    client.account.properties(compressor.id).create(
        name='screwTemperature',
        data_type='number',
        access_type='protected',
        publish_type='never',
        description='Main Screw Temperature (°C * 10)',
        measurement=measurement,
        boundaries={
            'min': -10,
            'max': 125
        })

    unit = PropertyInstance.MeasurementUnit('Bar', 'bar')
    measurement = PropertyInstance.Measurement('pressure', unit)
    client.account.properties(compressor.id).create(
        name='workingPressure',
        data_type='number',
        access_type='protected',
        publish_type='never',
        description='Main Working Pressure (Bar * 10)',
        measurement=measurement,
        boundaries={
            'min': 0,
            'max': 16
        })

    unit = PropertyInstance.MeasurementUnit('Volt', 'V')
    measurement = PropertyInstance.Measurement('electricity', unit)
    client.account.properties(compressor.id).create(
        name='controllerSupplyVoltage',
        data_type='number',
        access_type='protected',
        publish_type='never',
        description='Main Screw Temperature (V * 10)',
        measurement=measurement,
        boundaries={
            'min': 0,
            'max': 300
        })

    client.account.properties(compressor.id).create(name='cfgMaintCycles',
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')

    unit = PropertyInstance.MeasurementUnit('Hour', 'h')
    measurement = PropertyInstance.Measurement('time', unit)
    client.account.properties(compressor.id).create(
        name='totalHours',
        data_type='number',
        access_type='protected',
        publish_type='never',
        description='Total hours compressor was working',
        measurement=measurement)

    client.account.properties(compressor.id).create(
        name='totalLoadHours',
        data_type='number',
        access_type='protected',
        publish_type='never',
        description='Total hours compressor was on load',
        measurement=measurement)
    client.account.properties(compressor.id).create(
        name='maintCounters',
        data_type='object',
        access_type='protected',
        publish_type='never',
        description='Time from the last maintenance in minutes')
    client.account.properties(compressor.id).create(
        name='maintenanceLog',
        data_type='object',
        access_type='protected',
        publish_type='never',
        description='Log of compressor maintenances')

    unit = PropertyInstance.MeasurementUnit('Percentage', '%')
    measurement = PropertyInstance.Measurement('percentage', unit)
    client.account.properties(compressor.id).create(
        name='loadPercInLast100h',
        data_type='number',
        access_type='protected',
        publish_type='never',
        description=
        "On load minutes in last 100 hours of motor running (100% is 6000)",
        measurement=measurement,
        boundaries={
            'min': 0,
            'max': 100
        })

    unit = PropertyInstance.MeasurementUnit('Count', '#')
    measurement = PropertyInstance.Measurement('custom', unit)
    client.account.properties(compressor.id).create(
        name='nbrOfStartsInLastHour',
        data_type='number',
        access_type='protected',
        publish_type='never',
        measurement=measurement)
    client.account.properties(compressor.id).create(name='controllerTime',
                                                    data_type='string',
                                                    access_type='protected',
                                                    publish_type='never')

    # derived properties
    client.account.properties(compressor.id).create(name='lastAlarms',
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='lastWarnings',
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    unit = PropertyInstance.MeasurementUnit('Count', '#')
    measurement = PropertyInstance.Measurement('custom', unit)
    client.account.properties(compressor.id).create(name='nbrOfAlarms',
                                                    data_type='number',
                                                    access_type='protected',
                                                    publish_type='never',
                                                    measurement=measurement)
    client.account.properties(compressor.id).create(name='nbrOfWarnings',
                                                    data_type='number',
                                                    access_type='protected',
                                                    publish_type='never',
                                                    measurement=measurement)

    client.account.properties(compressor.id).create(name='powercutStops',
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='plannedStops',
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='unplannedStops',
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never')

    unit = PropertyInstance.MeasurementUnit('Minute', 'min')
    measurement = PropertyInstance.Measurement('time', unit)
    client.account.properties(compressor.id).create(name='idleRunningMinutes',
                                                    data_type='number',
                                                    access_type='protected',
                                                    publish_type='never',
                                                    measurement=measurement)
    client.account.properties(compressor.id).create(name='loadRunningMinutes',
                                                    data_type='number',
                                                    access_type='protected',
                                                    publish_type='never',
                                                    measurement=measurement)
    client.account.properties(compressor.id).create(
        name='unplannedStopsMinutes',
        data_type='number',
        access_type='protected',
        publish_type='never',
        measurement=measurement)
    client.account.properties(compressor.id).create(name='plannedStopsMinutes',
                                                    data_type='number',
                                                    access_type='protected',
                                                    publish_type='never',
                                                    measurement=measurement)

    # settings
    # unit = PropertyInstance.MeasurementUnit('Month', 'months')
    # measurement = PropertyInstance.Measurement('custom', unit)
    # client.account.properties(compressor.id).create(name='warrantyExpiresIn', data_type='number', access_type='public', publish_type='never', measurement=measurement)

    client.account.properties(compressor.id).create(name='warrantyExpiryDate',
                                                    data_type='string',
                                                    access_type='public',
                                                    publish_type='never')
    client.account.properties(compressor.id).create(name='icon',
                                                    data_type='string',
                                                    access_type='public',
                                                    publish_type='never')

    # This can go to app maybe?
    description = """
Asagidaki sekilde bakim ucretlerini girebilirsiniz:
{
  "currencySymbol": "$",
  "currency": "USD",  
  "oilFilterChange": 0,
  "oilChange": 0,
  "bearingLubrication": 0,
  "compressorCheck": 0,
  "airFilterChange": 0,
  "separatorFilterChange": 0
}
"""
    client.account.properties(compressor.id).create(name='maintenanceCostList',
                                                    data_type='object',
                                                    access_type='public',
                                                    publish_type='never',
                                                    description=description)

    # Views
    condition = PropertyInstance.Condition(
        when=PropertyInstance.Condition.ConditionType.ALWAYS)
    retention = PropertyInstance.Retention(
        type=PropertyInstance.Retention.RetentionType.MOSTRECENT,
        context=PropertyInstance.Context(type='default'),
        capacity='0',
        condition=condition)
    client.account.properties(compressor.id).create(name='state',
                                                    data_type='object',
                                                    access_type='protected',
                                                    publish_type='never',
                                                    retention=retention)

    #------ Add base profile methods

    client.account.methods(compressor.id).create(
        name='init',
        method_impl=MethodInstance.MethodImplementation(getInit_body()),
        access_type='public',
        description="""e.g. 
{ 
  "hasInverter": false, 
  "warrantyInMonth": 12,
  "icon": "inversys-15-plus-depolu.png",
  "elecCost": {
    "value": 0, 
    "unit": "USD"
  }
}
    
    hasInverter: kompresorun inverter'u varsa 'true' yoksa 'false' olmalidir - default deger 'false'
    warrantyInMonth: kompresorun garanti suresini belirtir - default deger 12
    icon: kompresor resim dosyasinin adi
    elecCost: kompresorun kullanildigi bolgedeki elektrik birim fiyati ve para birimi
    """)
    client.account.methods(compressor.id).create(
        name='getDashboard',
        method_impl=MethodInstance.MethodImplementation(getDashboard_body()),
        access_type='public',
        description="""
Build the default dashboard view of the compressor. Some information must be populated by calling `preaggregate()` method ahead of time."""
    )
    client.account.methods(compressor.id).create(
        name='getLatestValues',
        method_impl=MethodInstance.MethodImplementation(
            getLatestValues_body()),
        access_type='public')
    client.account.methods(compressor.id).create(
        name='preaggregate',
        method_impl=MethodInstance.MethodImplementation(preaggregate_body()),
        access_type='public')

    client.account.methods(compressor.id).create(
        name='showOEE',
        method_impl=MethodInstance.MethodImplementation(showOEE_body()),
        access_type='public')
    client.account.methods(compressor.id).create(
        name='getHistOEE',
        method_impl=MethodInstance.MethodImplementation(getHistOEE_body()),
        access_type='public',
        description="""{
 "value": {
  "from": { "unit": "WEEKS", "value":	1 }, 
  "sampling": { "unit": "HOURS", "value": 1 }
  }
}""")
    client.account.methods(compressor.id).create(
        name='getHistMttr',
        method_impl=MethodInstance.MethodImplementation(getHistMttr_body()),
        access_type='public',
        description="""{
 "value": {
  "from": { "unit": "WEEKS", "value":	1 }, 
  "sampling": { "unit": "HOURS", "value": 1 }
  }
}""")
    client.account.methods(compressor.id).create(
        name='getHistMtbf',
        method_impl=MethodInstance.MethodImplementation(getHistMtbf_body()),
        access_type='public',
        description="""{
 "value": {
  "from": { "unit": "WEEKS", "value":	1 }, 
  "sampling": { "unit": "HOURS", "value": 1 }
  }
}""")
    client.account.methods(compressor.id).create(
        name='getHistEstimPowerConsumption',
        method_impl=MethodInstance.MethodImplementation(
            getHistEstimPowerConsumption_body()),
        access_type='public',
        description="""{
 "value": {
  "from": { "unit": "WEEKS", "value":	1 }, 
  "sampling": { "unit": "HOURS", "value": 1 }
  }
}""")
    client.account.methods(compressor.id).create(
        name='getHistEstimEnergyConsumption',
        method_impl=MethodInstance.MethodImplementation(
            getHistEstimEnergyConsumption_body()),
        access_type='public',
        description="""{
 "value": {
  "from": { "unit": "WEEKS", "value":	1 }, 
  "sampling": { "unit": "HOURS", "value": 1 }
  }
}""")

    accessLevel1 = 'protected'
    accessLevel1_1 = 'private'

    client.account.methods(compressor.id).create(
        name='getEmptyState',
        method_impl=MethodInstance.MethodImplementation(getEmptyState_body()),
        access_type=accessLevel1,
        description="e.g. { 'value': 0, 'unit': '$' }")
    client.account.methods(compressor.id).create(
        name='getCompressorInfo',
        method_impl=MethodInstance.MethodImplementation(
            getCompressorInfo_body()),
        access_type=accessLevel1)

    # dashboarding
    client.account.methods(compressor.id).create(
        name='buildAggregateQueries',
        method_impl=MethodInstance.MethodImplementation(
            buildAggregateQueries_body()),
        access_type=accessLevel1_1)
    client.account.methods(compressor.id).create(
        name='queryAggregates',
        method_impl=MethodInstance.MethodImplementation(
            queryAggregates_body()),
        access_type=accessLevel1_1)
    client.account.methods(compressor.id).create(
        name='queryPropertySummary',
        method_impl=MethodInstance.MethodImplementation(
            queryPropertySummary_body()),
        access_type=accessLevel1)
    client.account.methods(compressor.id).create(
        name='queryWarningAlarmSummary',
        method_impl=MethodInstance.MethodImplementation(
            queryWarningAlarmSummary_body()),
        access_type=accessLevel1)
    client.account.methods(compressor.id).create(
        name='queryTimeToMaintenance',
        method_impl=MethodInstance.MethodImplementation(
            queryTimeToMaintenance_body()),
        access_type=accessLevel1_1)
    client.account.methods(compressor.id).create(
        name='queryLoadRatio',
        method_impl=MethodInstance.MethodImplementation(queryLoadRatio_body()),
        access_type=accessLevel1_1)

    client.account.methods(compressor.id).create(
        name='getActiveAlarm',
        method_impl=MethodInstance.MethodImplementation(getActiveAlarm_body()),
        access_type=accessLevel1_1)
    client.account.methods(compressor.id).create(
        name='getConnectivity',
        method_impl=MethodInstance.MethodImplementation(
            getConnectivity_body()),
        access_type=accessLevel1_1,
        description="""
/** @enum {string} */
Connectivity = {
  OFFLINE: 'offline',
  ONLINE_ACTIVE: 'online-active',
  ONLINE_INACTIVE: 'online-inactive',
};""")
    client.account.methods(compressor.id).create(
        name='common',
        method_impl=MethodInstance.MethodImplementation(common_body()),
        access_type=accessLevel1_1,
        description="""
Common utils, constants, enums, etc""")

    client.account.methods(compressor.id).create(
        name='processCompressorStates',
        method_impl=MethodInstance.MethodImplementation(
            processCompressorStates_body()),
        access_type=accessLevel1_1)
    client.account.methods(compressor.id).create(
        name='calculateAll',
        method_impl=MethodInstance.MethodImplementation(calculateAll_body()),
        access_type=accessLevel1_1)

    client.account.methods(compressor.id).create(
        name='convertToHours',
        method_impl=MethodInstance.MethodImplementation(convertToHours_body()),
        access_type=accessLevel1_1)
    client.account.methods(compressor.id).create(
        name='convertToDec',
        method_impl=MethodInstance.MethodImplementation(convertToDec_body()),
        access_type=accessLevel1_1)
    client.account.methods(compressor.id).create(
        name='makeWriteRequest',
        method_impl=MethodInstance.MethodImplementation(
            makeWriteRequest_body()),
        access_type=accessLevel1_1)
    client.account.methods(compressor.id).create(
        name='makeWriteValue',
        method_impl=MethodInstance.MethodImplementation(makeWriteValue_body()),
        access_type=accessLevel1_1)

    client.account.methods(compressor.id).create(
        name='setAny',
        method_impl=MethodInstance.MethodImplementation(setAny_body()),
        access_type=accessLevel1_1)

    client.account.methods(compressor.id).create(
        name='setSerialNumber',
        method_impl=MethodInstance.MethodImplementation(
            setSerialNumber_body()),
        access_type=accessLevel1_1)
    client.account.methods(compressor.id).create(
        name='setLogikaModel',
        method_impl=MethodInstance.MethodImplementation(setLogikaModel_body()),
        access_type=accessLevel1_1)
    client.account.methods(compressor.id).create(
        name='setLogikaFwVersion',
        method_impl=MethodInstance.MethodImplementation(
            setLogikaFwVersion_body()),
        access_type=accessLevel1_1)

    client.account.methods(compressor.id).create(
        name='setLevel1Pwd',
        method_impl=MethodInstance.MethodImplementation(setLevelXPwd_body(1)),
        access_type=accessLevel1_1)
    client.account.methods(compressor.id).create(
        name='setLevel2Pwd',
        method_impl=MethodInstance.MethodImplementation(setLevelXPwd_body(2)),
        access_type=accessLevel1_1)
    client.account.methods(compressor.id).create(
        name='setLevel3Pwd',
        method_impl=MethodInstance.MethodImplementation(setLevelXPwd_body(3)),
        access_type=accessLevel1_1)

    client.account.methods(compressor.id).create(
        name='setAlarms',
        method_impl=MethodInstance.MethodImplementation(setAlarms_body()),
        access_type=accessLevel1_1)
    client.account.methods(compressor.id).create(
        name='setNonAckAlarms',
        method_impl=MethodInstance.MethodImplementation(
            setNonAckAlarms_body()),
        access_type=accessLevel1_1)
    client.account.methods(compressor.id).create(
        name='setControllerState',
        method_impl=MethodInstance.MethodImplementation(
            setControllerState_body()),
        access_type=accessLevel1_1)
    client.account.methods(compressor.id).create(
        name='setCompressorState',
        method_impl=MethodInstance.MethodImplementation(
            setCompressorState_body()),
        access_type=accessLevel1_1)
    client.account.methods(compressor.id).create(
        name='setBlockingAlarm',
        method_impl=MethodInstance.MethodImplementation(
            setBlockingAlarm_body()),
        access_type=accessLevel1_1)

    client.account.methods(compressor.id).create(
        name='setScrewTemperature',
        method_impl=MethodInstance.MethodImplementation(
            setScrewTemperature_body()),
        access_type=accessLevel1_1)
    client.account.methods(compressor.id).create(
        name='setWorkingPressure',
        method_impl=MethodInstance.MethodImplementation(
            setWorkingPressure_body()),
        access_type=accessLevel1_1)
    client.account.methods(compressor.id).create(
        name='setControllerSupplyVoltage',
        method_impl=MethodInstance.MethodImplementation(
            setControllerSupplyVoltage_body()),
        access_type=accessLevel1_1)
    client.account.methods(compressor.id).create(
        name='setMaintCycles',
        method_impl=MethodInstance.MethodImplementation(setMaintCycles_body()),
        access_type=accessLevel1_1)
    client.account.methods(compressor.id).create(
        name='setTotalHours',
        method_impl=MethodInstance.MethodImplementation(setTotalHours_body()),
        access_type=accessLevel1_1)
    client.account.methods(compressor.id).create(
        name='setTotalLoadHours',
        method_impl=MethodInstance.MethodImplementation(
            setTotalLoadHours_body()),
        access_type=accessLevel1_1)
    client.account.methods(compressor.id).create(
        name='setMaintCounters',
        method_impl=MethodInstance.MethodImplementation(
            setMaintCounters_body()),
        access_type=accessLevel1_1)
    client.account.methods(compressor.id).create(
        name='setLoadPercInLast100h',
        method_impl=MethodInstance.MethodImplementation(
            setLoadPercInLast100h_body()),
        access_type=accessLevel1_1)
    client.account.methods(compressor.id).create(
        name='setNbrOfStartsInLastHour',
        method_impl=MethodInstance.MethodImplementation(
            setNbrOfStartsInLastHour_body()),
        access_type=accessLevel1_1)
    client.account.methods(compressor.id).create(
        name='setControllerTime',
        method_impl=MethodInstance.MethodImplementation(
            setControllerTime_body()),
        access_type=accessLevel1_1)

    accessLevel2 = 'public'

    client.account.methods(compressor.id).create(
        name='sendCommand',
        method_impl=MethodInstance.MethodImplementation(sendCommand_body()),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='start',
        method_impl=MethodInstance.MethodImplementation(startStop_body(1)),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='stop',
        method_impl=MethodInstance.MethodImplementation(startStop_body(0)),
        access_type=accessLevel2)

    client.account.methods(compressor.id).create(
        name='writeAnyTag',
        method_impl=MethodInstance.MethodImplementation(writeAnyTag_body()),
        access_type=accessLevel2,
        description="""
Bu method ile herhangi bir tag'i yazabilirsiniz. Gereken parametreler sunlar:

- setValue: Yazilacak deger
- addr: Tag'in modbus adresi
- size: Yazilacak tag'in uzunlugu - default 2 (word)

Ornegin:

{ "setValue": 13, "addr": "0x401", "size": 2 } 
""")
    client.account.methods(compressor.id).create(
        name='readAnyTag',
        method_impl=MethodInstance.MethodImplementation(readAnyTag_body()),
        access_type=accessLevel2,
        description="""
 Bu method ile herhangi bir tag'i okumak icin gateway'e komut gonderebilirsiniz. Okunan deger tagValue isimli property icine yailir. 
 Gereken parametreler sunlar:

- addr: Tag'in modbus adresi
- size: Okunacak tag'in uzunlugu - default 2 (word)

Ornegin:

{ "addr": "0x401", "size": 2 } 
""")

    client.account.methods(compressor.id).create(
        name='readSerialNumber',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('cfgSerialNumber')),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='readLogikaModel',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('cfgLogikaModel')),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='readLogikaFwVersion',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('cfgLogikaFwVersion')),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='readLevel1Pwd',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('cfgLevel1Pwd')),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='readLevel2Pwd',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('cfgLevel2Pwd')),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='readLevel3Pwd',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('cfgLevel3Pwd')),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='readRelayOutputs',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('relayOutputs')),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='readDigitalInputs',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('digitalInputs')),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='readMaintCycles',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('cfgMaintCycles')),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='readMaintCounters',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('maintCounters')),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='readTotalHours',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('totalHours')),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='readTotalLoadHours',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('totalLoadHours')),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='readLoadPercInLast100h',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('loadPercInLast100h')),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='readNbrOfStartsInLastHour',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('nbrOfStartsInLastHour')),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='readControllerTime',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('controllerTime')),
        access_type=accessLevel2)

    client.account.methods(compressor.id).create(
        name='writeChangeAirFilter',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('writeChangeAirFilter_body')),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='writeChangeOilFilter',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('writeChangeOilFilter_body')),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='writeChangeOil',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('writeChangeOil_body')),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='writeChangeSeperatorFilter',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('writeChangeSeperatorFilter_body')),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='writeCheckCompressor',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('writeCheckCompressor_body')),
        access_type=accessLevel2)
    client.account.methods(compressor.id).create(
        name='writeBearingLubrication',
        method_impl=MethodInstance.MethodImplementation(
            readTagIntoProperty_body('writeBearingLubrication_body')),
        access_type=accessLevel2)