Good evening @sailmich
You wrote:
I took a look into shellies API and found that the plug is also sending energy
That is correct, but it depends on the type of plug (generation 1 or generation 2), how to format the request.
it can be done and then it is a simple conversion.
Can you tell me, what the type of your plug is?. Is it a Shelly Plug or PlugS (Generation 1) or is it a Shelly Plus Plug S (Generation 2)
keep in mind that the value you receive from the Shelly for "Energy" is expressed in Wm (Watt-minute) So 1 Wm = 1/60 Wh
I got a solution with http but would like to do it with mqtt.
That is possible. I created something quick with an "Inject" node, (as I do not know the Generation of the Shelly yet)
See the flow below in order to give you an idea.
Code: Select all
[
{
"id": "de9d282626577580",
"type": "inject",
"z": "919eeef6718077fa",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "Watt_Erzeugung",
"payload": "123",
"payloadType": "num",
"x": 320,
"y": 340,
"wires": [
[
"92de407702b6a1c7"
]
]
},
{
"id": "16fc407458de7947",
"type": "inject",
"z": "919eeef6718077fa",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "kWh_Erzeugung",
"payload": "600",
"payloadType": "num",
"x": 320,
"y": 400,
"wires": [
[
"92de407702b6a1c7"
]
]
},
{
"id": "92de407702b6a1c7",
"type": "join",
"z": "919eeef6718077fa",
"name": "Join Watt and Watt-minute",
"mode": "custom",
"build": "object",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": "\\n",
"joinerType": "str",
"useparts": false,
"accumulate": true,
"timeout": "",
"count": "2",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "",
"reduceFixup": "",
"x": 610,
"y": 360,
"wires": [
[
"48ea9677282ac733",
"7102f68aedf7232e"
]
]
},
{
"id": "48ea9677282ac733",
"type": "debug",
"z": "919eeef6718077fa",
"name": "debug 1",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 880,
"y": 440,
"wires": []
},
{
"id": "7102f68aedf7232e",
"type": "function",
"z": "919eeef6718077fa",
"name": "function 1",
"func": "msg.payload = { \"command\": \"udevice\", \"idx\": 528, \"svalue\": msg.payload.Watt_Erzeugung.toString() + \";\" + (msg.payload.kWh_Erzeugung / 60).toString() };\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 860,
"y": 300,
"wires": [
[
"a66757038f23b540"
]
]
},
{
"id": "a66757038f23b540",
"type": "debug",
"z": "919eeef6718077fa",
"name": "debug 2",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1040,
"y": 300,
"wires": []
}
]
If crashing the dummy device by false values isn't a bug, could someone please move the tread.
I do not see it as a bug, but injecting wrong or no values in the Domoticz database is not a good idea.
But I agrre it would be better, that it would reject the value.
Personally I have never been able to crash Domoticz by injecting something wrong.
So to send it by MQTT, you need
1. Configure your Plug, Plug/S Plug Plus to use MQTT
2. Use to MQTT Explorer to check the communication
3. Let me know the type of plug.
Have a look at the example.
Regards