{
    "rtype":  0,   // 0 = modbus, 1 = http/json
     "mtype": 4,   // 0 = other, 1 = meter, 2 = inverter, 4 = battery

    "name": "Deye LP3 Batt1",   // as displayed in the config dialog
    "manufacturer": "Deye",
    "dev_type": "deye_lp3_batt1",   // will be prefixed by "meter_"

    // modbus parameters
    "rtu": {
        "silence_period": 50,    // msec
        "silence_same_slave": false,
        "retries": 4,
        "rcv_timeout": 120       // msec
    },
    "modbus_read": 3,            // function code to read registers
    "modbus_read_max_registers": 96, 
    "modbus_write": 16,          // function code to write register(s)
    "modbus_write_max_registers": 64,

    // values used to build the model string
    "type_designation": {
        "fixed": "LP3 Battery"
    },
    "version": {
        "fixed": "1.0"
    },
    "firmware_version": {
        "fixed": "1.0"
    },
    "serial": {
        "address": 3,
        "type": "string",
        "length": 5
    },
    
    "maxcharge_initial": {
    "address": "108",
    "type": "int16",
    "once": true
    },
    
     "maxdischarge_initial": {
    "address": "109",
    "type": "int16",
    "once": true
    },
    
    "power_w": {
        "address": 590,
        "type": "int16",
        "resolution": -1.0
    },
    "soc": {
        "address": 588,
        "type": "int16"
    },
    
     "maxcharge_cur": {
       "expr": "round(charge_power_w/50)"
    },
    "maxdischarge_cur": {
       "expr": "round(discharge_power_w/50)"
    },
    
    "*maxch_ini": {
       "expr": "maxcharge_initial"
    },
    "*maxdis_ini": {
       "expr": "maxdischarge_initial"
    },
    
    "*maxch_cur": {
       "expr": "maxcharge_cur"
    },
    
    "*maxdis_cur": {
       "expr": "maxdischarge_cur"
    },
    
    "outputs": [
       { "address": "http://localhost/cnf?cmd=modbus_set&addr=${address}&func=16&id=${id}&reg=108&val=${maxcharge_cur&type=w"
       },
       { "address": "http://localhost/cnf?cmd=modbus_set&addr=${address}&func=16&id=${id}&reg=109&val=${maxdischarge_cur}&type=w"
       }
    ],
    
    "resets": [
       { "address": "http://localhost/cnf?cmd=modbus_set&addr=${address}&func=16&id=${id}&reg=108&val=${maxcharge_initial}&type=w"
       },
       { "address": "http://localhost/cnf?cmd=modbus_set&addr=${address}&func=16&id=${id}&reg=109&val=${maxdischarge_initial&type=w"
       }
    ]
 }
