Virtual PV Device example?

Can someone here please share a working example of a virtual PV device?

I have setup two now, but I don’t know what the actual requirements are. For example. Do we need to set the /StatusCode and if so to what value.

1 Like

This is my virtual PV inverter. I want to see the daily yield of my PV-Inverter instead of overall lifetime yield. It is measured by a Shelly 1PM Gen3 device.

[
    {
        "id": "9b8d5eacacb78531",
        "type": "tab",
        "label": "TomsBKW",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "c16a0bfd8dee5cea",
        "type": "victron-virtual",
        "z": "9b8d5eacacb78531",
        "name": "TomsBKW",
        "outputs": 1,
        "device": "pvinverter",
        "default_values": true,
        "battery_capacity": 25,
        "include_battery_temperature": false,
        "grid_nrofphases": 1,
        "include_motor_temp": false,
        "include_controller_temp": false,
        "include_coolant_temp": false,
        "include_motor_rpm": true,
        "include_motor_direction": true,
        "position": "1",
        "pvinverter_nrofphases": 1,
        "fluid_type": 0,
        "include_tank_battery": false,
        "include_tank_temperature": false,
        "tank_battery_voltage": 3.3,
        "tank_capacity": 0.2,
        "temperature_type": 2,
        "include_humidity": false,
        "include_pressure": false,
        "include_temp_battery": false,
        "temp_battery_voltage": 3.3,
        "x": 120,
        "y": 60,
        "wires": [
            []
        ]
    },
    {
        "id": "35275ec1f27f2af7",
        "type": "victron-output-custom",
        "z": "9b8d5eacacb78531",
        "service": "com.victronenergy.pvinverter/101",
        "path": "/Ac/L1/Power",
        "serviceObj": {
            "service": "com.victronenergy.pvinverter/101",
            "name": "TomsBKW (101)"
        },
        "pathObj": {
            "path": "/Ac/L1/Power",
            "name": "/Ac/L1/Power",
            "type": "number",
            "value": 11.3
        },
        "name": "",
        "onlyChanges": false,
        "outputs": 0,
        "x": 790,
        "y": 360,
        "wires": []
    },
    {
        "id": "6a8d240e49b53320",
        "type": "inject",
        "z": "9b8d5eacacb78531",
        "name": "permanent",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "2",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "0",
        "payloadType": "num",
        "x": 150,
        "y": 240,
        "wires": [
            [
                "042cf6a11932a8be"
            ]
        ]
    },
    {
        "id": "ce2636d2240cf373",
        "type": "victron-output-custom",
        "z": "9b8d5eacacb78531",
        "service": "com.victronenergy.pvinverter/101",
        "path": "/Ac/L1/Voltage",
        "serviceObj": {
            "service": "com.victronenergy.pvinverter/101",
            "name": "TomsBKW (101)"
        },
        "pathObj": {
            "path": "/Ac/L1/Voltage",
            "name": "/Ac/L1/Voltage",
            "type": "number",
            "value": 0
        },
        "name": "",
        "onlyChanges": false,
        "outputs": 0,
        "x": 800,
        "y": 240,
        "wires": []
    },
    {
        "id": "a7bfe9166a69cb9e",
        "type": "victron-output-custom",
        "z": "9b8d5eacacb78531",
        "service": "com.victronenergy.pvinverter/101",
        "path": "/Ac/L1/Current",
        "serviceObj": {
            "service": "com.victronenergy.pvinverter/101",
            "name": "TomsBKW (101)"
        },
        "pathObj": {
            "path": "/Ac/L1/Current",
            "name": "/Ac/L1/Current",
            "type": "number",
            "value": 0
        },
        "name": "",
        "onlyChanges": false,
        "outputs": 0,
        "x": 800,
        "y": 300,
        "wires": []
    },
    {
        "id": "6a9257942e76f89f",
        "type": "victron-output-custom",
        "z": "9b8d5eacacb78531",
        "service": "com.victronenergy.pvinverter/101",
        "path": "/Ac/Power",
        "serviceObj": {
            "service": "com.victronenergy.pvinverter/101",
            "name": "TomsBKW (101)"
        },
        "pathObj": {
            "path": "/Ac/Power",
            "name": "/Ac/Power",
            "type": "number",
            "value": 0
        },
        "name": "",
        "onlyChanges": false,
        "outputs": 0,
        "x": 780,
        "y": 420,
        "wires": []
    },
    {
        "id": "e5b35642815ff4c2",
        "type": "victron-output-custom",
        "z": "9b8d5eacacb78531",
        "service": "com.victronenergy.pvinverter/101",
        "path": "/Ac/Energy/Forward",
        "serviceObj": {
            "service": "com.victronenergy.pvinverter/101",
            "name": "TomsBKW (101)"
        },
        "pathObj": {
            "path": "/Ac/Energy/Forward",
            "name": "/Ac/Energy/Forward",
            "type": "number",
            "value": 0.025317999999999303
        },
        "name": "",
        "onlyChanges": false,
        "outputs": 0,
        "conditionalMode": false,
        "outputTrue": "",
        "outputFalse": "",
        "debounce": "",
        "x": 810,
        "y": 480,
        "wires": []
    },
    {
        "id": "b53fdec136fc0d9b",
        "type": "inject",
        "z": "9b8d5eacacb78531",
        "name": "atMidNight",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "01 00 * * *",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "0",
        "payloadType": "num",
        "x": 150,
        "y": 160,
        "wires": [
            [
                "712dd5e3c5be2f7a"
            ]
        ]
    },
    {
        "id": "905529d86a6c8c30",
        "type": "change",
        "z": "9b8d5eacacb78531",
        "name": "EnergyMidNight",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.switch0.aenergy.total",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 480,
        "y": 160,
        "wires": [
            [
                "9ab0ab5738569f61"
            ]
        ]
    },
    {
        "id": "9ab0ab5738569f61",
        "type": "change",
        "z": "9b8d5eacacb78531",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "dailystart",
                "pt": "flow",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 670,
        "y": 160,
        "wires": [
            []
        ]
    },
    {
        "id": "042cf6a11932a8be",
        "type": "shelly-gen2",
        "z": "9b8d5eacacb78531",
        "hostname": "192.168.1.98",
        "description": "TomsBKW",
        "mode": "polling",
        "verbose": false,
        "server": "",
        "outputmode": "event",
        "uploadretryinterval": 5000,
        "pollinginterval": 5000,
        "pollstatus": false,
        "getstatusoncommand": true,
        "devicetype": "S3SW-001P16EU",
        "devicetypemustmatchexactly": true,
        "captureblutooth": false,
        "outputs": 1,
        "x": 310,
        "y": 240,
        "wires": [
            [
                "5132accc2b308517"
            ]
        ]
    },
    {
        "id": "712dd5e3c5be2f7a",
        "type": "shelly-gen2",
        "z": "9b8d5eacacb78531",
        "hostname": "192.168.1.98",
        "description": "TomsBKW",
        "mode": "polling",
        "verbose": false,
        "server": "",
        "outputmode": "event",
        "uploadretryinterval": 5000,
        "pollinginterval": 5000,
        "pollstatus": false,
        "getstatusoncommand": true,
        "devicetype": "S3SW-001P16EU",
        "devicetypemustmatchexactly": true,
        "captureblutooth": false,
        "outputs": 1,
        "x": 310,
        "y": 160,
        "wires": [
            [
                "905529d86a6c8c30"
            ]
        ]
    },
    {
        "id": "5132accc2b308517",
        "type": "function",
        "z": "9b8d5eacacb78531",
        "name": "Split BKW data",
        "func": "let voltage = msg.payload.switch0.voltage;\nlet current = msg.payload.switch0.current;\nlet power = msg.payload.switch0.apower * (-1);\nlet energy = msg.payload.switch0.aenergy.total;\n\nlet startvalue = flow.get('dailystart') || 0;\nenergy = (energy - startvalue) / 1000.0;\n\nglobal.set ('pv_inverter', power);\n\nreturn [\n    {payload: voltage},\n    {payload: current},\n    {payload: power},\n    {payload: energy}\n];",
        "outputs": 4,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 320,
        "y": 400,
        "wires": [
            [
                "9553977e9932e6f1"
            ],
            [
                "a0d07accd66352e6"
            ],
            [
                "83bd7b882b32efca"
            ],
            [
                "677c58173e46c816"
            ]
        ]
    },
    {
        "id": "677c58173e46c816",
        "type": "rbe",
        "z": "9b8d5eacacb78531",
        "name": "",
        "func": "deadband",
        "gap": "0.001",
        "start": "",
        "inout": "out",
        "septopics": false,
        "property": "payload",
        "topi": "topic",
        "x": 560,
        "y": 480,
        "wires": [
            [
                "e5b35642815ff4c2"
            ]
        ]
    },
    {
        "id": "83bd7b882b32efca",
        "type": "rbe",
        "z": "9b8d5eacacb78531",
        "name": "",
        "func": "deadband",
        "gap": "1",
        "start": "",
        "inout": "out",
        "septopics": false,
        "property": "payload",
        "topi": "topic",
        "x": 560,
        "y": 360,
        "wires": [
            [
                "6a9257942e76f89f",
                "35275ec1f27f2af7"
            ]
        ]
    },
    {
        "id": "a0d07accd66352e6",
        "type": "rbe",
        "z": "9b8d5eacacb78531",
        "name": "",
        "func": "deadband",
        "gap": "0.1",
        "start": "",
        "inout": "out",
        "septopics": false,
        "property": "payload",
        "topi": "topic",
        "x": 560,
        "y": 300,
        "wires": [
            [
                "a7bfe9166a69cb9e"
            ]
        ]
    },
    {
        "id": "9553977e9932e6f1",
        "type": "rbe",
        "z": "9b8d5eacacb78531",
        "name": "",
        "func": "deadband",
        "gap": "1",
        "start": "",
        "inout": "out",
        "septopics": false,
        "property": "payload",
        "topi": "topic",
        "x": 560,
        "y": 240,
        "wires": [
            [
                "ce2636d2240cf373"
            ]
        ]
    },
    {
        "id": "6046c3d76da92ec6",
        "type": "global-config",
        "env": [],
        "modules": {
            "@victronenergy/node-red-contrib-victron": "1.6.60",
            "node-red-contrib-shelly": "11.7.5"
        }
    }
]

Hi Tom. You’re not using virtual devices are you? I might be wrong, but the nodes look different to what I have in v3.70

I do, and the flow above uses the “virtual device” node:

Node Red flows look different in the Node Red editor than here in the forum. The flow which I published above looks like that in Node Red:

Ah ok. I see. Sorry. Yeah that isn’t very helpful for this forum. But it does seem to work here, now, with a few hiccups. Like the most relevant paths when you click on the virtual device (TomsBKW in your flow example). It shows /Ac/Frequency — AC frequency in Hz. but I cannot find it in the list of paths under custom control nodes. Must be a documentations error.

One other thing. The solar is connected on AC-IN when the Kraus & Naimer selector is on Netz, but at AC-OUT when that switch is turned onto Not-Strom. That was an error in my side. I had the /Position set to 1 and had to change that to 0 to make it work. Aka not to make PV show up un Essential Loads.