Habla con tu inversor

Modbus RTU sin secretos. Extrae toda la información de tu Huawei SUN2000.

Tu inversor solar te puede dar mucha más información de la que ves en la app del fabricante. En este vídeo te cuento cómo conecto con mi inversor, mediante un Elfin-EW11A y una conexión MODBUS RTU.

Espero que te guste.

Aquí la segunda parte del vídeo:

Enlaces:
Manual EW11A
Enlace de compra
Esquema de conversor RS485-UART
Manual del SUN2000
Registros SUN2000
Modbus Poll

Flujo de Node-Red a continuación:

[
    {
        "id": "7908d37bb69e42e5",
        "type": "tab",
        "label": "Inversor y Termo",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "5c086573dfca555a",
        "type": "function",
        "z": "7908d37bb69e42e5",
        "name": "PrimerChorizo",
        "func": "\nmsg.payload = {\n    PV_Un:        (msg.payload[0] << 16 >> 16)/10, \n    PV_In:        (msg.payload[1] << 16 >> 16)/100, \n    PV_P:         ((msg.payload[48] * 65536 + msg.payload[49]) << 16 >> 16)/1000,\n    U_A_B:        (msg.payload[50] << 16 >> 16)/10, \n    U_A:          (msg.payload[53] << 16 >> 16)/10, \n    U_B:          (msg.payload[54] << 16 >> 16)/10, \n    I_A:          ((msg.payload[56] * 65536 + msg.payload[57]))/1000,  \n    P_peak:       ((msg.payload[62] * 65536 + msg.payload[63]))/1000,  \n    P_active:     ((msg.payload[64] * 65536 + msg.payload[65]) ),\n    P_reactive:   ((msg.payload[66] * 65536 +  msg.payload[67]) << 32 >> 32)/1000,\n    PF:           (msg.payload[68] << 16 >> 16)/1000, \n    Frequency:    (msg.payload[69]) / 100, \n    η:            (msg.payload[70] << 16 >> 16)/100, \n    Temp:         msg.payload[71]/10, \n    P_accum:      ((msg.payload[90]*65536+msg.payload[91]))/100,\n    P_daily:      ((msg.payload[98]*65536+msg.payload[99]))/100\n}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 480,
        "y": 160,
        "wires": [
            [
                "715c9d25ace3ea6a"
            ]
        ]
    },
    {
        "id": "d83452ce7a7a426b",
        "type": "function",
        "z": "7908d37bb69e42e5",
        "name": "SegundoChorizo",
        "func": "\nmsg.payload = {\n    M_A_U       : ((msg.payload[0]*65536+msg.payload[1])<<32>>32)/10,\n    M_B_U       : ((msg.payload[2]*65536+msg.payload[3])<<32>>32)/10,\n    M_C_U       : ((msg.payload[4]*65536+msg.payload[5])<<32>>32)/10,\n    M_A_I       : ((msg.payload[6]*65536+msg.payload[7])<<32>>32)/100,\n    M_B_I       : ((msg.payload[8]*65536+msg.payload[9])<<32>>32)/100,\n    M_C_I       : ((msg.payload[10]*65536+msg.payload[11])<<32>>32)/100,\n    M_P         : (msg.payload[12]*65536+msg.payload[13])<<32>>32,\n    M_Pr        : (msg.payload[14]*65536+msg.payload[15])<<32>>32,\n    M_PF        : (msg.payload[16]<<16>>16)/1000, \n    M_Freq      : (msg.payload[17]<<16>>16)/100, \n    M_PExp      : ((msg.payload[18]*65536+msg.payload[19])<<32>>32)/100,  \n    M_PTot      : ((msg.payload[20]*65536+msg.payload[21])<<32>>32)/100,  \n    M_RPTot     : ((msg.payload[22]*65536+msg.payload[23])<<32>>32)/100,  \n    M_U_AB      : ((msg.payload[25]*65536+msg.payload[26])<<32>>32)/10,\n    M_U_BC      : ((msg.payload[27]*65536+msg.payload[28])<<32>>32)/10,\n    M_U_CA      : ((msg.payload[29]*65536+msg.payload[30])<<32>>32)/10,\n    M_A_P       : (msg.payload[31]*65536+msg.payload[32])<<32>>32,\n    M_B_P       : (msg.payload[33]*65536+msg.payload[34])<<32>>32,\n    M_C_P       : (msg.payload[35]*65536+msg.payload[36])<<32>>32\n}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 490,
        "y": 240,
        "wires": [
            [
                "715c9d25ace3ea6a"
            ]
        ]
    },
    {
        "id": "e422d63a95835fe8",
        "type": "function",
        "z": "7908d37bb69e42e5",
        "name": "TercerChorizo",
        "func": "\nmsg.payload = {\n    PF_comp     : (msg.payload[0]<<16>>16)/1000, \n    Q_S         : (msg.payload[1]<<16>>16)/1000\n}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 480,
        "y": 320,
        "wires": [
            [
                "715c9d25ace3ea6a"
            ]
        ]
    },
    {
        "id": "715c9d25ace3ea6a",
        "type": "join",
        "z": "7908d37bb69e42e5",
        "name": "",
        "mode": "custom",
        "build": "merged",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": false,
        "timeout": "3",
        "count": "",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "",
        "reduceFixup": "",
        "x": 710,
        "y": 240,
        "wires": [
            [
                "06cfc1db25b6289f",
                "2e62b03db2993530",
                "8ea68cf2fbfd449b",
                "f3d3a5922d1323c0",
                "7a0f6fb5a441fdfd"
            ]
        ]
    },
    {
        "id": "7b1d61131a9ccb26",
        "type": "comment",
        "z": "7908d37bb69e42e5",
        "name": "Extrae información del SUN2000 y aprovecha los excedentes para encender el termo",
        "info": "",
        "x": 370,
        "y": 60,
        "wires": []
    },
    {
        "id": "06cfc1db25b6289f",
        "type": "ha-sensor",
        "z": "7908d37bb69e42e5",
        "name": "Huawei_Producción",
        "entityConfig": "2ac5f6726f358279",
        "version": 0,
        "state": "payload.P_active",
        "stateType": "msg",
        "attributes": [],
        "inputOverride": "allow",
        "outputProperties": [],
        "x": 1000,
        "y": 120,
        "wires": [
            []
        ]
    },
    {
        "id": "2e62b03db2993530",
        "type": "ha-sensor",
        "z": "7908d37bb69e42e5",
        "name": "Huawei_Importada",
        "entityConfig": "506628433bd52ce9",
        "version": 0,
        "state": "($abs(payload.M_P) - payload.M_P) / 2",
        "stateType": "jsonata",
        "attributes": [],
        "inputOverride": "allow",
        "outputProperties": [],
        "x": 990,
        "y": 200,
        "wires": [
            []
        ]
    },
    {
        "id": "f3d3a5922d1323c0",
        "type": "ha-sensor",
        "z": "7908d37bb69e42e5",
        "name": "Huawei_Excedentes",
        "entityConfig": "046b262248383987",
        "version": 0,
        "state": "(payload.M_P + $abs(payload.M_P))/2",
        "stateType": "jsonata",
        "attributes": [],
        "inputOverride": "allow",
        "outputProperties": [],
        "x": 1000,
        "y": 360,
        "wires": [
            []
        ]
    },
    {
        "id": "8ea68cf2fbfd449b",
        "type": "ha-sensor",
        "z": "7908d37bb69e42e5",
        "name": "Huawei_Consumo",
        "entityConfig": "33ff9a8f9bc4e58d",
        "version": 0,
        "state": "($abs(payload.M_P) - payload.M_P) / 2 + payload.P_active - (payload.M_P + $abs(payload.M_P)) / 2",
        "stateType": "jsonata",
        "attributes": [],
        "inputOverride": "allow",
        "outputProperties": [],
        "x": 990,
        "y": 280,
        "wires": [
            []
        ]
    },
    {
        "id": "1e7252eabf853b98",
        "type": "modbus-read",
        "z": "7908d37bb69e42e5",
        "name": "PrimerChorizo: 32016-32115",
        "topic": "PrimerChorizo",
        "showStatusActivities": false,
        "logIOActivities": false,
        "showErrors": false,
        "showWarnings": true,
        "unitid": "1",
        "dataType": "HoldingRegister",
        "adr": "32016",
        "quantity": "100",
        "rate": "5",
        "rateUnit": "s",
        "delayOnStart": false,
        "startDelayTime": "",
        "server": "10af5c23.692ff4",
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "emptyMsgOnFail": false,
        "x": 180,
        "y": 160,
        "wires": [
            [
                "5c086573dfca555a"
            ],
            []
        ]
    },
    {
        "id": "ca91b75058b2b430",
        "type": "modbus-read",
        "z": "7908d37bb69e42e5",
        "name": "SegundoChorizo: 37101-37136",
        "topic": "SegundoChorizo",
        "showStatusActivities": false,
        "logIOActivities": false,
        "showErrors": false,
        "showWarnings": true,
        "unitid": "1",
        "dataType": "HoldingRegister",
        "adr": "37101",
        "quantity": "36",
        "rate": "5",
        "rateUnit": "s",
        "delayOnStart": false,
        "startDelayTime": "",
        "server": "10af5c23.692ff4",
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "emptyMsgOnFail": false,
        "x": 190,
        "y": 240,
        "wires": [
            [
                "d83452ce7a7a426b"
            ],
            []
        ]
    },
    {
        "id": "eba9b91816d69860",
        "type": "modbus-read",
        "z": "7908d37bb69e42e5",
        "name": "TercerChorizo: 40122-40123",
        "topic": "TercerChorizo",
        "showStatusActivities": false,
        "logIOActivities": false,
        "showErrors": false,
        "showWarnings": true,
        "unitid": "1",
        "dataType": "HoldingRegister",
        "adr": "40122",
        "quantity": "2",
        "rate": "5",
        "rateUnit": "s",
        "delayOnStart": false,
        "startDelayTime": "",
        "server": "10af5c23.692ff4",
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "emptyMsgOnFail": false,
        "x": 180,
        "y": 320,
        "wires": [
            [
                "e422d63a95835fe8"
            ],
            []
        ]
    },
    {
        "id": "7a0f6fb5a441fdfd",
        "type": "debug",
        "z": "7908d37bb69e42e5",
        "name": "debug 4",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 800,
        "y": 80,
        "wires": []
    },
    {
        "id": "2ac5f6726f358279",
        "type": "ha-entity-config",
        "server": "62897e3ae3b61f05",
        "deviceConfig": "",
        "name": "sensor config for Huawei_Producción",
        "version": "6",
        "entityType": "sensor",
        "haConfig": [
            {
                "property": "name",
                "value": "Huawei_Producción"
            },
            {
                "property": "icon",
                "value": ""
            },
            {
                "property": "entity_category",
                "value": ""
            },
            {
                "property": "device_class",
                "value": "power"
            },
            {
                "property": "unit_of_measurement",
                "value": "W"
            },
            {
                "property": "state_class",
                "value": ""
            }
        ],
        "resend": true,
        "debugEnabled": false
    },
    {
        "id": "506628433bd52ce9",
        "type": "ha-entity-config",
        "server": "62897e3ae3b61f05",
        "deviceConfig": "",
        "name": "sensor config for Huawei_Consumo_Importada",
        "version": "6",
        "entityType": "sensor",
        "haConfig": [
            {
                "property": "name",
                "value": "huawei_consumo_importada"
            },
            {
                "property": "icon",
                "value": ""
            },
            {
                "property": "entity_category",
                "value": ""
            },
            {
                "property": "device_class",
                "value": "power"
            },
            {
                "property": "unit_of_measurement",
                "value": "W"
            },
            {
                "property": "state_class",
                "value": ""
            }
        ],
        "resend": true,
        "debugEnabled": false
    },
    {
        "id": "046b262248383987",
        "type": "ha-entity-config",
        "server": "62897e3ae3b61f05",
        "deviceConfig": "",
        "name": "sensor config for Huawei_Excedentes",
        "version": "6",
        "entityType": "sensor",
        "haConfig": [
            {
                "property": "name",
                "value": "Huawei_Excedentes"
            },
            {
                "property": "icon",
                "value": ""
            },
            {
                "property": "entity_category",
                "value": ""
            },
            {
                "property": "device_class",
                "value": "power"
            },
            {
                "property": "unit_of_measurement",
                "value": "W"
            },
            {
                "property": "state_class",
                "value": ""
            }
        ],
        "resend": true,
        "debugEnabled": false
    },
    {
        "id": "33ff9a8f9bc4e58d",
        "type": "ha-entity-config",
        "server": "62897e3ae3b61f05",
        "deviceConfig": "",
        "name": "sensor config for Huawei_Consumo",
        "version": "6",
        "entityType": "sensor",
        "haConfig": [
            {
                "property": "name",
                "value": "Huawei_Consumo"
            },
            {
                "property": "icon",
                "value": ""
            },
            {
                "property": "entity_category",
                "value": ""
            },
            {
                "property": "device_class",
                "value": "power"
            },
            {
                "property": "unit_of_measurement",
                "value": "W"
            },
            {
                "property": "state_class",
                "value": ""
            }
        ],
        "resend": false,
        "debugEnabled": false
    },
    {
        "id": "10af5c23.692ff4",
        "type": "modbus-client",
        "name": "Huawei TCP",
        "clienttype": "tcp",
        "bufferCommands": false,
        "stateLogEnabled": false,
        "queueLogEnabled": false,
        "failureLogEnabled": false,
        "tcpHost": "192.168.0.195",
        "tcpPort": "502",
        "tcpType": "DEFAULT",
        "serialPort": "/dev/ttyUSB0",
        "serialType": "RTU-BUFFERD",
        "serialBaudrate": "9600",
        "serialDatabits": "8",
        "serialStopbits": "1",
        "serialParity": "none",
        "serialConnectionDelay": "10",
        "serialAsciiResponseStartDelimiter": "0x3A",
        "unit_id": "1",
        "commandDelay": "1",
        "clientTimeout": "1000",
        "reconnectOnTimeout": true,
        "reconnectTimeout": "2000",
        "parallelUnitIdsAllowed": false
    },
    {
        "id": "62897e3ae3b61f05",
        "type": "server",
        "name": "Home Assistant Rpi",
        "version": 5,
        "addon": false,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true,
        "heartbeat": false,
        "heartbeatInterval": "30",
        "areaSelector": "friendlyName",
        "deviceSelector": "friendlyName",
        "entitySelector": "friendlyName",
        "statusSeparator": "at: ",
        "statusYear": "hidden",
        "statusMonth": "short",
        "statusDay": "numeric",
        "statusHourCycle": "h23",
        "statusTimeFormat": "h:m",
        "enableGlobalContextStore": true
    }
]
Scroll al inicio