I have a RPI4 with Mosquitto and Node Red installed. It is setup with an access-point that connects all the Shelly devices to the RPI.
I can get all info from a specific Shelly with the mqtt commnd shellies/#
and I can see that that calls for shellies/shelly1-3494547070DD/ext_temperature/0 but when I use the same command in an injection node I get no temperature printet from the debugnode, how do I get that temperature so I can move on and make functions?
THX Frank
There are different strings for Reading and Writing to the Shelly. Using MQTT Explorer enables you to both Read and Publish messages from/to the Shelly.
EDIT: Don't forget to use both the Topic and the Payload to get your message across.
If you can paste the flow you have so far, it will be easier to help you
[
{
"id": "f96ed7468badd9c4",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": "",
"env": []
},
{
"id": "3b96a0116ea63d6a",
"type": "mqtt out",
"z": "f96ed7468badd9c4",
"name": "",
"topic": "",
"qos": "2",
"retain": "false",
"broker": "3ecd7f11.4d3dd",
"x": 510,
"y": 500,
"wires": []
},
{
"id": "a7ec4d957c4d667c",
"type": "inject",
"z": "f96ed7468badd9c4",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "shellies/shelly1-3494547070DD/relay/0/command",
"payload": "on",
"payloadType": "str",
"x": 250,
"y": 460,
"wires": [
[
"3b96a0116ea63d6a"
]
]
},
{
"id": "36c42f4db656b004",
"type": "inject",
"z": "f96ed7468badd9c4",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "00 23 * * *",
"once": false,
"onceDelay": 0.1,
"topic": "shellies/shelly1-3494547070DD/relay/0/command",
"payload": "off",
"payloadType": "str",
"x": 250,
"y": 500,
"wires": [
[
"3b96a0116ea63d6a"
]
]
},
{
"id": "f04b4ebb7ab4123f",
"type": "mqtt in",
"z": "f96ed7468badd9c4",
"name": "",
"topic": "shellies/shelly1-3494547070DD/relay/0",
"qos": "2",
"datatype": "auto-detect",
"broker": "3ecd7f11.4d3dd",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 750,
"y": 500,
"wires": [
[
"311ddb3abbfbce82"
]
]
},
{
"id": "07f6029d03c5e247",
"type": "inject",
"z": "f96ed7468badd9c4",
"name": "temp",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "shellies/shelly1-3494547070DD/ext_temperature/0",
"payload": "",
"payloadType": "str",
"x": 250,
"y": 540,
"wires": [
[
"3b96a0116ea63d6a"
]
]
},
{
"id": "311ddb3abbfbce82",
"type": "debug",
"z": "f96ed7468badd9c4",
"name": "deB2",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1010,
"y": 500,
"wires": []
},
{
"id": "d43dea17928c70bc",
"type": "mqtt in",
"z": "f96ed7468badd9c4",
"name": "",
"topic": "shellies/#",
"qos": "2",
"datatype": "auto-detect",
"broker": "3ecd7f11.4d3dd",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 240,
"y": 320,
"wires": [
[
"4ef5ae54cd641876"
]
]
},
{
"id": "4ef5ae54cd641876",
"type": "debug",
"z": "f96ed7468badd9c4",
"name": "deB1",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1010,
"y": 320,
"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": ""
}
]
Thx for the answare 0)
In the Shelly documentation does it state the mqtt to be:
shellies/shelly1-3494547070DD/ext_temperature/0
to get the temperature of the first sensor but there is something I am missing :0) to get it displayed.
Best
Frank
In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```
)
```
code goes here
```
You can edit and correct your post by clicking the pencil icon.
See this post for more details - How to share code or flow json
I am new :0) thank you
If you use MQTT as suggested, you can see the message at the MQTT Broker.
You say you have a Shelly1. It does not support the temperature
topic. (See the link to the API docs)
If you select the Debug node and set up as in the image to see the complete message object, you will see all messages coming from the node. Once you see all of these, you can then select/display the msg you need once you have seen what is available.
Again, using MQTT Explorer, you can see that the messages coming from the Shelly have a topic of shellies/SHELLY ID-XXXXXX/# to see all of the messages coming from your particular Shelly device.
HTH
Thank you for the help I will try to learn more and be back :0)
thx Frank
Some last findings. You ware right the Shelly 1 temp can not be called it is send every 30 sec so you can only subscribe.
I opens the commendmodule in the RPI and put:
mosquitto_sub -h localhost -t "shellies/shelly1-3494547070DD/ext_temperature/0"
that give med the temperature ex. 17,2 but if I try sending the same command to the Shelly it returns 0.
Thank you again :0) and I will continiye my learning
Best Frank
Excellent!
Glad you are finding your way around the Shelly and Node-RED. MQTT can be daunting at first, but once you understand, it is easy.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.