Combine mulitple values in monitoring

Hi,

I have a PowerGenerator, which is automatically starting, if there is an power outage and stopping again, when the power is restored.

Unfortunatley I cannot monitor remotley if the Power Generator is running.

Therefore I bought a Shelly 3PM and created a flow in Nodered.

I have two issues with my flow:

  1. Sometimes I get the message multiple times after around each 20 to 30 minutes, that the Power Generator is running although I got already the first message.

  2. I am currently monitoring only one phase of the 3PM. I am not sure how to add the 2 other ones as well, I guess via a FUNCTION?

[
 {
        "id": "44f3ae8fb3a783ff",
        "type": "inject",
        "z": "253be448.e51e8c",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 140,
        "y": 860,
        "wires": [
            [
                "bc8a2e03959c54f3"
            ]
        ]
    },
    {
        "id": "a2aab6305a42668a",
        "type": "switch",
        "z": "253be448.e51e8c",
        "name": "Check Groups",
        "property": "payload.emeters[0].current",
        "propertyType": "msg",
        "rules": [
            {
                "t": "lte",
                "v": "0.05",
                "vt": "num"
            },
            {
                "t": "gt",
                "v": "0.05",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 540,
        "y": 820,
        "wires": [
            [
                "147c8283e4947bf5"
            ],
            [
                "a56edfe302467644"
            ]
        ]
    },
    {
        "id": "147c8283e4947bf5",
        "type": "throttle",
        "z": "253be448.e51e8c",
        "name": "",
        "throttleType": "reset",
        "timeLimit": 0,
        "timeLimitType": "seconds",
        "countLimit": 0,
        "blockSize": 0,
        "locked": true,
        "x": 760,
        "y": 840,
        "wires": [
            [
                "2d8548fb8c4852fe"
            ]
        ]
    },
    {
        "id": "a56edfe302467644",
        "type": "throttle",
        "z": "253be448.e51e8c",
        "name": "",
        "throttleType": "reset",
        "timeLimit": 0,
        "timeLimitType": "seconds",
        "countLimit": 0,
        "blockSize": 0,
        "locked": false,
        "x": 760,
        "y": 900,
        "wires": [
            [
                "161b677a73ed958c",
                "b7f85ed2a7217c93"
            ]
        ]
    },
    {
        "id": "161b677a73ed958c",
        "type": "change",
        "z": "253be448.e51e8c",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "reset",
                "pt": "msg",
                "to": "Generator ein",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1120,
        "y": 900,
        "wires": [
            [
                "147c8283e4947bf5"
            ]
        ]
    },
    {
        "id": "023a06011e705659",
        "type": "change",
        "z": "253be448.e51e8c",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "reset",
                "pt": "msg",
                "to": "Generator aus",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1120,
        "y": 840,
        "wires": [
            [
                "a56edfe302467644"
            ]
        ]
    },
    {
        "id": "b7f85ed2a7217c93",
        "type": "change",
        "z": "253be448.e51e8c",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "Generator läuft",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "Generator",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1120,
        "y": 940,
        "wires": [
            [
                "d2317caaa6012905"
            ]
        ]
    },
    {
        "id": "802642fd25fd1f05",
        "type": "change",
        "z": "253be448.e51e8c",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "Generator aus",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "Generator",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1120,
        "y": 800,
        "wires": [
            [
                "2d61fe43a54845e4"
            ]
        ]
    },
    {
        "id": "c2c38bdf244b2632",
        "type": "switch",
        "z": "253be448.e51e8c",
        "name": "Check Groups",
        "property": "payload.emeters[1].current",
        "propertyType": "msg",
        "rules": [
            {
                "t": "lte",
                "v": "0.05",
                "vt": "num"
            },
            {
                "t": "gt",
                "v": "0.05",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 540,
        "y": 860,
        "wires": [
            [],
            []
        ]
    },
    {
        "id": "07980bcf29a5f0a4",
        "type": "switch",
        "z": "253be448.e51e8c",
        "name": "Check Groups",
        "property": "payload.emeters[2].current",
        "propertyType": "msg",
        "rules": [
            {
                "t": "lte",
                "v": "0.05",
                "vt": "num"
            },
            {
                "t": "gt",
                "v": "0.05",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 540,
        "y": 900,
        "wires": [
            [],
            []
        ]
    },
    {
        "id": "59f011f341325a63",
        "type": "http request",
        "z": "253be448.e51e8c",
        "name": "",
        "method": "use",
        "ret": "txt",
        "paytoqs": "ignore",
        "url": "",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "",
        "senderr": false,
        "x": 1530,
        "y": 880,
        "wires": [
            []
        ]
    },
    {
        "id": "d2317caaa6012905",
        "type": "change",
        "z": "253be448.e51e8c",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "method",
                "pt": "msg",
                "to": "post",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "url",
                "pt": "msg",
                "to": "https://API",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "headers.content-type",
                "pt": "msg",
                "to": "application/json",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "{\"username\":\"XYZ\",\"password\":\"XYZ)2jd!Br43\",\"customerId\":\"XYZ\",\"hideTriggerDetails\":false,\"alarmText\":\"Notstromaggregat Rüsthaus läuft\",\"type\":\"info\",\"needsAcknowledgement\":false,\"duration\":60,\"recipientConfirmation\":false,\"groupCodes\":[\"G12\"]}",
                "tot": "json"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1320,
        "y": 920,
        "wires": [
            [
                "59f011f341325a63"
            ]
        ]
    },
    {
        "id": "2d61fe43a54845e4",
        "type": "change",
        "z": "253be448.e51e8c",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "method",
                "pt": "msg",
                "to": "post",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "url",
                "pt": "msg",
                "to": "https://API",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "headers.content-type",
                "pt": "msg",
                "to": "application/json",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "{\"username\":\"ag-ff-metnitz\",\"password\":\"fw4)2jd!Br43\",\"customerId\":\"105050\",\"hideTriggerDetails\":false,\"alarmText\":\"Notstromaggregat RĂĽsthaus wieder ausgeschalten\",\"type\":\"info\",\"needsAcknowledgement\":false,\"duration\":60,\"recipientConfirmation\":false,\"groupCodes\":[\"G12\"]}",
                "tot": "json"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1320,
        "y": 820,
        "wires": [
            [
                "59f011f341325a63"
            ]
        ]
    },
    {
        "id": "bc8a2e03959c54f3",
        "type": "shelly-gen1",
        "z": "253be448.e51e8c",
        "hostname": "x.x.x.x",
        "description": "",
        "mode": "polling",
        "server": "",
        "outputmode": "event",
        "uploadretryinterval": 5000,
        "pollinginterval": 5000,
        "pollstatus": true,
        "getstatusoncommand": true,
        "devicetype": "Measure",
        "outputs": 2,
        "x": 320,
        "y": 860,
        "wires": [
            [
                "a2aab6305a42668a",
                "c2c38bdf244b2632",
                "07980bcf29a5f0a4"
            ],
            []
        ]
    },
    {
        "id": "2d8548fb8c4852fe",
        "type": "delay",
        "z": "253be448.e51e8c",
        "name": "",
        "pauseType": "delay",
        "timeout": "30",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 900,
        "y": 840,
        "wires": [
            [
                "802642fd25fd1f05",
                "023a06011e705659"
            ]
        ]
    }
]

Your flow.json example is missing the starting [, so others can not import you flow.

You may want to look at this example, it output true if any emitter current is above set value, it will not output true again until the emitter message currents drop below set value and a false is outputted.

[{"id":"44f3ae8fb3a783ff","type":"inject","z":"d1395164b4eec73e","name":"above 0,05","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"emeters\":[{\"current\":0.05},{\"current\":0.05},{\"current\":0.01}]}","payloadType":"json","x":420,"y":7280,"wires":[["1c5df780a71143dc"]]},{"id":"1c5df780a71143dc","type":"change","z":"d1395164b4eec73e","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"true in payload.emeters.($.current >= 0.05)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":7280,"wires":[["714da383cd83bd1e"]]},{"id":"298a74465c166378","type":"inject","z":"d1395164b4eec73e","name":"below 0.05","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"emeters\":[{\"current\":0.01},{\"current\":0.01},{\"current\":0.01}]}","payloadType":"json","x":420,"y":7340,"wires":[["1c5df780a71143dc"]]},{"id":"714da383cd83bd1e","type":"rbe","z":"d1395164b4eec73e","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":810,"y":7280,"wires":[["7b5999e2df3d3d75"]]},{"id":"7b5999e2df3d3d75","type":"debug","z":"d1395164b4eec73e","name":"debug 2480","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":775.176025390625,"y":7088.9716796875,"wires":[]}]
1 Like

That works great.

One Question: If I start now the flow, nodered or the PI then the Flow starts with sending the down message.

Can the flow be enhanced, that the first message after a restart is ignored?

Br,
Johannes

Would the setting in the filter node Block unless value changes (ignore initial value ) work?

1 Like

Yes, I think so!

You could also have a Shelly (does not have to be a PM) flashed with Tasmota and have it send a MQTT message on startup and death (LWT) - have it powered by the generator only - so you will know when the generator starts - as you will get an up message from the Shelly - and then when it dies the MQTT LWT will let you know

Craig

Thanks, but the Generator is fully integrated in the Infrastrucutre and doesnt have any Plug. Thats why I am using a PM.

The option of E1cid works perfectly now.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.