How to send mqtt to turn on a Shelly 1 device

I want to test a Shelly temperature, test if it is above or below and send a mqtt message to the Shelly to turn it on or off.

[
    {
        "id": "311ddb3abbfbce82",
        "type": "debug",
        "z": "f96ed7468badd9c4",
        "name": "<=18",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1030,
        "y": 200,
        "wires": []
    },
    {
        "id": "45ddefc9b9bbdec9",
        "type": "mqtt in",
        "z": "f96ed7468badd9c4",
        "name": "",
        "topic": "shellies/shelly1-3494547070DD/ext_temperature/0",
        "qos": "2",
        "datatype": "auto-detect",
        "broker": "3ecd7f11.4d3dd",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 370,
        "y": 280,
        "wires": [
            [
                "44581b7acff590d1"
            ]
        ]
    },
    {
        "id": "7d804b43fb3305b4",
        "type": "debug",
        "z": "f96ed7468badd9c4",
        "name": ">=19",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1030,
        "y": 340,
        "wires": []
    },
    {
        "id": "1464b3bde2ec1e1f",
        "type": "mqtt out",
        "z": "f96ed7468badd9c4",
        "name": "",
        "topic": "shellies/shelly1-3494547070DD/relay/0/command/on",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "3ecd7f11.4d3dd",
        "x": 1180,
        "y": 240,
        "wires": []
    },
    {
        "id": "44581b7acff590d1",
        "type": "switch",
        "z": "f96ed7468badd9c4",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "lte",
                "v": "18",
                "vt": "str"
            },
            {
                "t": "gte",
                "v": "19",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 710,
        "y": 280,
        "wires": [
            [
                "311ddb3abbfbce82",
                "1464b3bde2ec1e1f"
            ],
            [
                "7d804b43fb3305b4",
                "53bfabb355b0b9ec"
            ]
        ]
    },
    {
        "id": "53bfabb355b0b9ec",
        "type": "mqtt out",
        "z": "f96ed7468badd9c4",
        "name": "",
        "topic": "shellies/shelly1-3494547070DD/relay/0/command/off",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "3ecd7f11.4d3dd",
        "x": 1180,
        "y": 380,
        "wires": []
    },
    {
        "id": "3ecd7f11.4d3dd",
        "type": "mqtt-broker",
        "name": "Mosquitto MQTT Broker",
        "broker": "localhost",
        "port": "",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "userProps": "",
        "sessionExpiry": ""
    }
]

I know the mqtt out node is not correct it is an example of the mqtt message I want to send.

But how ?

Best Frank

Have you read the api

documentation
the second bullet point describes the topic and payload it will accept

thank your for the response.
yes I have and if I use an inject node and send
payload: on
topic: shellies/shelly1-3494547070DD/relay/0/command

into a mqtt out node it works :0)

How do I make an "inject node" that I can trigger?

Best Frank

Use a change node after a switch node to determine if temp greater or less than.

Ahh :0) I read your suggestion and thought that does not work I have to change both the topic and the payload.
And as it turns out you can :0) so thank you a loth I was really getting frustarted.

Thanks again
Frank

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