Shelly is not bricked... it's working

This commit is contained in:
simonox 2023-02-27 17:01:27 +01:00
parent 1d926b9c26
commit 37b3a20294
12 changed files with 251 additions and 11 deletions

View file

@ -108,8 +108,96 @@ Your shelly will return something like a JSON object that looks like that:
}
```
After a while your Shelly Plug S should be flashed with Tasmota firmware and create a new Wifi. Join that Wifi and [configure the device)(http://192.164.4.1/).
After a while your Shelly Plug S should be flashed with Tasmota firmware.
> Note: This bricked my shelly device. I cannot reach it, anymore.
> Just be patient. This took longer than five minutes in my DSL connected network.
It will create create a new Wifi.
![Tasmota Wifi](./docs/images/wifi.png)
Join that Wifi and [configure the device)(http://192.164.4.1/).
![Join Wifi](./docs/images/configure-wifi.png)
You can configure it a a BlitzWolf SHP product.
Then it offers you power measurement and a programmable toogle.
![BlitzWolf](./docs/images/blitzwolf.png)
It should be configurable just like our [plant monitor](../plant-monitor/README.md).
Just enable MQTT and enter a shorter telemetry period.
![MQTT](./docs/images/mqtt.png) ![Telemetry period](./docs/images/telemetry-period.png)
It will post MQTT messages unter a topic `tele/tasmota_891E97/SENSOR` like this one:
```
{
"Time": "2023-02-27T16:45:07",
"ENERGY": {
"TotalStartTime": "2023-02-27T16:33:06",
"Total": 0.004,
"Yesterday": 0,
"Today": 0.004,
"Period": 0,
"Power": 34,
"ApparentPower": 44,
"ReactivePower": 27,
"Factor": 0.79,
"Voltage": 253,
"Current": 0.172
}
}
```
We now can consume this messages in Node-RED and post them into InfluxDB and build a dashboard in Grafana.
### InfluxDB Bucket
I created a bucket called `Shelly`in InfluxDB, so we can store the messages in this bucket.
### Node-RED
I create a usual flow in Node-RED. A MQTT node fetches the values.
![Node-RED](./docs/images/node-red.png)
The message is fed into a filter function to filter usefull information:
```
return {
payload: {
power: Number(msg.payload.ENERGY.Power),
volate: Number(msg.payload.ENERGY.Voltage),
current: Number(msg.payload.ENERGY.Current)
}
};
````
The `payload` will be stored in InfluxDB in the bucket "shelly".
### InfluxDB Data Explorer
In Influx DB Data Explorer you can query the stored data.
![Data Explorer](./docs/images/data-explorer.png)
The query created by Data Explorer look like that:
```
from(bucket: "shelly")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "msg")
|> filter(fn: (r) => r["_field"] == "power" or r["_field"] == "volate" or r["_field"] == "current")
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|> yield(name: "mean")
```
### Grafana
Using this query you can crate a dashboard in Grafana.
![Grafana](./docs/images/grafana.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 571 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

View file

@ -299,7 +299,6 @@
"y": 720,
"wires": [
[
"e3742f5060cf6cb7",
"29cd45a4f1feb505"
]
]
@ -335,26 +334,103 @@
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 500,
"y": 780,
"x": 760,
"y": 760,
"wires": []
},
{
"id": "29cd45a4f1feb505",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "toNumber",
"func": "var newMsg = {\n payload: {\n temperature: Number(msg.payload.DHT.Temperature),\n humidity: Number(msg.payload.DHT11.Humidity)\n }\n};\nreturn newMsg;",
"name": "plant2Influx",
"func": "var newMsg = {\n payload: {\n temperature: Number(msg.payload.DHT11.Temperature),\n humidity: Number(msg.payload.DHT11.Humidity)\n }\n};\nreturn newMsg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 520,
"x": 530,
"y": 640,
"wires": [
[
"23c62c30ebabca6e"
"23c62c30ebabca6e",
"e3742f5060cf6cb7"
]
]
},
{
"id": "f21213aec2f647ff",
"type": "mqtt in",
"z": "f6f2187d.f17ca8",
"name": "",
"topic": "tele/tasmota_891E97/SENSOR",
"qos": "1",
"datatype": "auto-detect",
"broker": "7ce136dbb8c897d1",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 190,
"y": 1000,
"wires": [
[
"5e4f2b3e1acad45b"
]
]
},
{
"id": "26b455c1bd337375",
"type": "influxdb out",
"z": "f6f2187d.f17ca8",
"influxdb": "d61a7da6caeb26aa",
"name": "Influx Shelly device",
"measurement": "msg",
"precision": "",
"retentionPolicy": "",
"database": "database",
"precisionV18FluxV20": "ms",
"retentionPolicyV18Flux": "",
"org": "Curious Community Labs",
"bucket": "shelly",
"x": 770,
"y": 920,
"wires": []
},
{
"id": "96eaf14353a89e9c",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "shelly",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 730,
"y": 1040,
"wires": []
},
{
"id": "5e4f2b3e1acad45b",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "shelly2Influx",
"func": "return {\n payload: {\n power: Number(msg.payload.ENERGY.Power),\n volate: Number(msg.payload.ENERGY.Voltage),\n current: Number(msg.payload.ENERBY.Current)\n }\n};\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 490,
"y": 1000,
"wires": [
[
"26b455c1bd337375",
"96eaf14353a89e9c"
]
]
},

View file

@ -342,14 +342,14 @@
"id": "29cd45a4f1feb505",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "toNumber",
"name": "plant2Influx",
"func": "var newMsg = {\n payload: {\n temperature: Number(msg.payload.DHT11.Temperature),\n humidity: Number(msg.payload.DHT11.Humidity)\n }\n};\nreturn newMsg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 520,
"x": 530,
"y": 640,
"wires": [
[
@ -358,6 +358,82 @@
]
]
},
{
"id": "f21213aec2f647ff",
"type": "mqtt in",
"z": "f6f2187d.f17ca8",
"name": "",
"topic": "tele/tasmota_891E97/SENSOR",
"qos": "1",
"datatype": "auto-detect",
"broker": "7ce136dbb8c897d1",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 190,
"y": 1000,
"wires": [
[
"5e4f2b3e1acad45b"
]
]
},
{
"id": "26b455c1bd337375",
"type": "influxdb out",
"z": "f6f2187d.f17ca8",
"influxdb": "d61a7da6caeb26aa",
"name": "Influx Shelly device",
"measurement": "msg",
"precision": "",
"retentionPolicy": "",
"database": "database",
"precisionV18FluxV20": "ms",
"retentionPolicyV18Flux": "",
"org": "Curious Community Labs",
"bucket": "shelly",
"x": 770,
"y": 920,
"wires": []
},
{
"id": "96eaf14353a89e9c",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "shelly",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 730,
"y": 1040,
"wires": []
},
{
"id": "5e4f2b3e1acad45b",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "shelly2Influx",
"func": "return {\n payload: {\n power: Number(msg.payload.ENERGY.Power),\n volate: Number(msg.payload.ENERGY.Voltage),\n current: Number(msg.payload.ENERGY.Current)\n }\n};\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 490,
"y": 1000,
"wires": [
[
"26b455c1bd337375",
"96eaf14353a89e9c"
]
]
},
{
"id": "e0977f2582bfaaa6",
"type": "mqtt in",