S2 issue controlling heater

Hallo all,

@dfaber thank you for this example.
make a modification to use 3x 2000Watt Immersion heater monitor by EM24 and controll with Shelly Pro 3 (without PM)

at momenth i am not 100% ensure it work, because last 2x day need also lot of energy for the cars.
It has switched on automatically a few times already.

Question: why the s2 spend “null” return and not “Off” ?

Thank you
Roberto

Moved to its own topic.
Please attach your flow, ideally using the mermaid flows markup so it renders correctly, thanks.

[
    {
        "id": "c5e43150e5a3cf75",
        "type": "tab",
        "label": "SG Ready – S2",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "01699bb571cbaff5",
        "type": "group",
        "z": "c5e43150e5a3cf75",
        "name": "SG Ready with GX internal relay 2",
        "style": {
            "label": true
        },
        "nodes": [
            "5a7fe06fb0cc14fd",
            "3dda9e0f1623df5a",
            "b6a2de0233b7b207",
            "2c8d1241928bb3a2",
            "4d12cd887f8732ec",
            "98df9eef02269d4e",
            "f03b44ddf79d41c2",
            "06dadab77dfe6b24",
            "9813f67e32a76f81",
            "3896ba4e9202b410",
            "09ca747512875719"
        ],
        "x": 54,
        "y": 139,
        "w": 1192,
        "h": 182
    },
    {
        "id": "5a7fe06fb0cc14fd",
        "type": "switch",
        "z": "c5e43150e5a3cf75",
        "g": "01699bb571cbaff5",
        "name": "Switch by mode",
        "property": "payload.label",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "On",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "Off",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 420,
        "y": 260,
        "wires": [
            [
                "3dda9e0f1623df5a"
            ],
            [
                "b6a2de0233b7b207"
            ]
        ]
    },
    {
        "id": "3dda9e0f1623df5a",
        "type": "change",
        "z": "c5e43150e5a3cf75",
        "g": "01699bb571cbaff5",
        "name": "Turn on",
        "rules": [
            {
                "t": "set",
                "p": "powerValues",
                "pt": "flow",
                "to": "payload.power",
                "tot": "msg"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "1",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 620,
        "y": 240,
        "wires": [
            [
                "3896ba4e9202b410"
            ]
        ]
    },
    {
        "id": "b6a2de0233b7b207",
        "type": "change",
        "z": "c5e43150e5a3cf75",
        "g": "01699bb571cbaff5",
        "name": "Turn off",
        "rules": [
            {
                "t": "set",
                "p": "powerValues",
                "pt": "flow",
                "to": "payload.power",
                "tot": "msg"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "0",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 620,
        "y": 280,
        "wires": [
            [
                "3896ba4e9202b410"
            ]
        ]
    },
    {
        "id": "2c8d1241928bb3a2",
        "type": "switch",
        "z": "c5e43150e5a3cf75",
        "g": "01699bb571cbaff5",
        "name": "On Instruction",
        "property": "topic",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "ModeInstruction",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 220,
        "y": 260,
        "wires": [
            [
                "5a7fe06fb0cc14fd"
            ]
        ]
    },
    {
        "id": "4d12cd887f8732ec",
        "type": "s2-resource",
        "z": "c5e43150e5a3cf75",
        "g": "01699bb571cbaff5",
        "name": "SG Ready (Node-RED)",
        "rmName": "SG Ready (Node-RED)",
        "resourceId": "ebaefcdf-5b45-4efb-abe7-73a9496f737d",
        "roles": "ENERGY_CONSUMER",
        "controlTypes": "NOT_CONTROLABLE,OPERATION_MODE_BASED_CONTROL",
        "providesPowerMeasurement": "3_PHASE_SYMMETRIC",
        "providesForecast": false,
        "manufacturer": "Custom (Node-RED)",
        "model": "",
        "serialNumber": "",
        "firmwareVersion": "",
        "instructionPollIntervalMs": 2000,
        "skipInstructionStatus": false,
        "transport": "dbus",
        "cem": "",
        "reconnectInterval": 5,
        "dbusConfig": "b84278a84a44e1f9",
        "debug": false,
        "controlType": "ombc",
        "systemDescription": "{\"operationModes\":[{\"id\":\"5c5b5d80-d1d0-476a-9108-a648ad24b66f\",\"diagnostic_label\":\"Off\",\"power_ranges\":[{\"commodity_quantity\":\"ELECTRIC.POWER.L1\",\"start_of_range\":0,\"end_of_range\":0},{\"commodity_quantity\":\"ELECTRIC.POWER.L2\",\"start_of_range\":0,\"end_of_range\":0},{\"commodity_quantity\":\"ELECTRIC.POWER.L3\",\"start_of_range\":0,\"end_of_range\":0}],\"abnormal_condition_only\":false},{\"id\":\"f65ce0ee-405e-4c91-96d4-4110f5496d7e\",\"diagnostic_label\":\"On\",\"power_ranges\":[{\"commodity_quantity\":\"ELECTRIC.POWER.L1\",\"start_of_range\":500,\"end_of_range\":500},{\"commodity_quantity\":\"ELECTRIC.POWER.L2\",\"start_of_range\":0,\"end_of_range\":0},{\"commodity_quantity\":\"ELECTRIC.POWER.L3\",\"start_of_range\":0,\"end_of_range\":0}],\"abnormal_condition_only\":false}],\"transitions\":[{\"id\":\"21fd3599-8a6e-40ed-b6fb-e7078fd0cf34\",\"from\":\"5c5b5d80-d1d0-476a-9108-a648ad24b66f\",\"to\":\"f65ce0ee-405e-4c91-96d4-4110f5496d7e\",\"start_timers\":[\"cdcd33d8-aaab-459e-8b36-abf75dafab08\"],\"blocking_timers\":[\"8ed031a6-777c-4f95-b4aa-2da871e43ece\"],\"abnormal_condition_only\":false},{\"id\":\"4619ebd3-bf65-4435-a343-db6d2558ee70\",\"from\":\"f65ce0ee-405e-4c91-96d4-4110f5496d7e\",\"to\":\"5c5b5d80-d1d0-476a-9108-a648ad24b66f\",\"start_timers\":[\"8ed031a6-777c-4f95-b4aa-2da871e43ece\"],\"blocking_timers\":[\"cdcd33d8-aaab-459e-8b36-abf75dafab08\"],\"abnormal_condition_only\":false}],\"timers\":[{\"id\":\"8ed031a6-777c-4f95-b4aa-2da871e43ece\",\"duration\":600000},{\"id\":\"cdcd33d8-aaab-459e-8b36-abf75dafab08\",\"duration\":600000}]}",
        "defaultOperationModeId": "",
        "autoConfirmInstructions": false,
        "outputs": 1,
        "x": 890,
        "y": 180,
        "wires": [
            [
                "98df9eef02269d4e",
                "74fda23a0d73e46f"
            ]
        ]
    },
    {
        "id": "98df9eef02269d4e",
        "type": "link out",
        "z": "c5e43150e5a3cf75",
        "g": "01699bb571cbaff5",
        "name": "link out 10",
        "mode": "link",
        "links": [
            "f03b44ddf79d41c2"
        ],
        "x": 1055,
        "y": 180,
        "wires": []
    },
    {
        "id": "f03b44ddf79d41c2",
        "type": "link in",
        "z": "c5e43150e5a3cf75",
        "g": "01699bb571cbaff5",
        "name": "link in 13",
        "links": [
            "98df9eef02269d4e"
        ],
        "x": 95,
        "y": 260,
        "wires": [
            [
                "2c8d1241928bb3a2"
            ]
        ]
    },
    {
        "id": "06dadab77dfe6b24",
        "type": "change",
        "z": "c5e43150e5a3cf75",
        "g": "01699bb571cbaff5",
        "name": "Send power measurements from flow context",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "PowerMeasurement",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "{\t  \"values\": $exists($flowContext(\"powerValues\"))\t    ? $flowContext(\"powerValues\")\t    : msg.payload\t}",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 570,
        "y": 180,
        "wires": [
            [
                "4d12cd887f8732ec"
            ]
        ]
    },
    {
        "id": "09ca747512875719",
        "type": "shelly-gen2",
        "z": "c5e43150e5a3cf75",
        "g": "01699bb571cbaff5",
        "hostname": "192.168.202.52",
        "description": "ShellyPro3 - NodeRed - Heizstab",
        "mode": "polling",
        "verbose": false,
        "server": "",
        "outputmode": "event",
        "uploadretryinterval": 5000,
        "pollinginterval": 5000,
        "pollstatus": true,
        "getstatusoncommand": true,
        "devicetype": "SPSW-003XE16EU",
        "devicetypemustmatchexactly": true,
        "captureblutooth": false,
        "outputs": 1,
        "x": 1080,
        "y": 260,
        "wires": [
            []
        ]
    },
    {
        "id": "3896ba4e9202b410",
        "type": "function",
        "z": "c5e43150e5a3cf75",
        "g": "01699bb571cbaff5",
        "name": "On/Off Funktion",
        "func": "if(msg.payload == 1)\n    {\n        msg.payload = \n        {\n            \"method\": \"Switch.Set\",\n            \"parameters\": {\n            \"id\": 0,\n            \"on\": true\n            }\n        }\n        return msg;\n    }\nelse if(msg.payload == 0)\n    {\n        msg.payload = \n        {\n            \"method\": \"Switch.Set\",\n            \"parameters\": {\n            \"id\": 0,\n            \"on\": false\n            }\n        }\n        return msg;\n    }\nelse\n    {\n        msg.payload = \n        {\n            \"method\": \"Switch.Set\",\n            \"parameters\": {\n            \"id\": 0,\n            \"on\": false\n            }\n        }\n        return msg;\n    }",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 820,
        "y": 260,
        "wires": [
            [
                "09ca747512875719"
            ]
        ]
    },
    {
        "id": "9813f67e32a76f81",
        "type": "victron-input-custom",
        "z": "c5e43150e5a3cf75",
        "g": "01699bb571cbaff5",
        "outputs": 1,
        "service": "com.victronenergy.heatpump/41",
        "path": "/Ac/L1/Power",
        "serviceObj": {
            "service": "com.victronenergy.heatpump/41",
            "name": "EM24_Heizstab (41)"
        },
        "pathObj": {
            "path": "/Ac/L1/Power",
            "name": "/Ac/L1/Power",
            "type": "number",
            "value": 2052.3
        },
        "name": "",
        "onlyChanges": false,
        "roundValues": "no",
        "rateLimit": 0,
        "conditionalMode": false,
        "condition1HysteresisEnabled": false,
        "condition1HysteresisThreshold": "",
        "outputTrue": "true",
        "outputFalse": "false",
        "debounce": "2000",
        "x": 220,
        "y": 180,
        "wires": [
            [
                "06dadab77dfe6b24"
            ]
        ]
    },
    {
        "id": "74fda23a0d73e46f",
        "type": "debug",
        "z": "c5e43150e5a3cf75",
        "name": "debug 3",
        "active": true,
        "tosidebar": true,
        "console": true,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "counter",
        "x": 1130,
        "y": 100,
        "wires": []
    },
    {
        "id": "b84278a84a44e1f9",
        "type": "s2-dbus-config",
        "name": "SG Ready (Node-RED)",
        "connectionMode": "auto",
        "tcpAddress": "",
        "deviceType": "acload",
        "measurementType": "L1_L2_L3",
        "nrOfPhases": "1",
        "position": "1",
        "phaseSetting": 1,
        "autoCalculateEnergy": true
    },
    {
        "id": "a52ad006992927fe",
        "type": "global-config",
        "env": [],
        "modules": {
            "node-red-contrib-s2": "0.9.6",
            "node-red-contrib-shelly": "11.12.3",
            "@victronenergy/node-red-contrib-victron": "1.7.27"
        }
    }
]

You are not sending status confirmations, yet you have set the resource node to not have a default state - ie first wait for a state confirmation - and not to automatically acknowledge state changes from on/off requests (something it is expecting to be sent when it requests state changes).
So either configure a default state and auto acknowledgements, or improve the flow to provide the required payloads.