Skip to content

Commit 5ae6b64

Browse files
committed
Added Readme
1 parent 5961bbb commit 5ae6b64

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

README.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
2+
This flow receives a json string from SolarLog PV Monitoring units containing all available measurements.
3+
These measurements are then transformed in a function-node to be send to influxdb's telegraf via the mqtt protocol.
4+
5+
SolarLog will update the JSON string every 15 seconds. So it makes no sense to pull it more often. The function node that parses the JSON string will make sure that only updated values are processed.
6+
7+
#How To
8+
##Prerequisites
9+
10+
- [NodeRed](http://nodered.org/)
11+
- [Mosquitto](http://mosquitto.org/) or any other MQTT message broker
12+
- [Telegraf](https://influxdata.com/time-series-platform/telegraf/)
13+
- [InfluxDB](https://influxdata.com/time-series-platform/influxdb/)
14+
- [Grafana](http://grafana.org/) Optional for visualization
15+
16+
Setup instructions are widely available in the WWW for these products and may vary according to the hardware (RaspberryPI, i386 etc) and linux distribution.
17+
18+
##Configuration
19+
20+
###NodeRed
21+
####Import Flow
22+
Copy the flow.json in raw format to your clipboard.
23+
In NodeRed import the copied flow:
24+
![import_flow](https://raw.githubusercontent.com/Sineos/Push-Volkszaehler-Readings-to-Influxdb-via-MQTT/master/src_readme/import_nodered.jpg)
25+
26+
####Configure POST to SolarLog
27+
![enter image description here](https://raw.githubusercontent.com/Sineos/Push-SolarLog-Readings-to-Influxdb-via-MQTT/master/src_readme/edit_request_node.jpg)
28+
29+
Modify the URL to point to your SolarLog IP. The path needs to be:
30+
31+
IP_Solarlog/getjp
32+
33+
####Parse SolarLog JSON
34+
Double-click the function node `Parse SolarLog JSON`
35+
![enter image description here](https://raw.githubusercontent.com/Sineos/Push-SolarLog-Readings-to-Influxdb-via-MQTT/master/src_readme/edit_function_node.jpg)
36+
37+
- `Identifier` is the key in the SolarLog JSON string that identifies a certain measurement. **Do not edit this value**.
38+
- `Active` can be either set to 0 or 1 and will control, whether this `Identifier` is processed and send via MQTT. Set to 1 for every value, you want to store in InfluxDB.
39+
- The `topic` is needed for the MQTT message broker. This reflects the "path" or "channel" under which the MQTT message broker will publish the data. This will be the channel that we use in Telegraf to collect the data
40+
- `Measurement` is needed to put the data into the InfluxDB and will be used along with the `tags`. Read the InfluxDB manual [here](https://docs.influxdata.com/influxdb/v0.13/concepts/key_concepts/) and [here](https://docs.influxdata.com/influxdb/v0.13/concepts/schema_and_data_layout/) for a better understanding of the measurement and tag concept.
41+
- `Tags` are to be used alongside the `measurement` and need to be specified in the format `Tag_Key = Tag_Value`. They can be used to sort, query and cluster data within InfluxDB. You can specify none to an arbitrary number of tags.
42+
43+
####Configure MQTT output
44+
![enter image description here](https://raw.githubusercontent.com/Sineos/Push-Volkszaehler-Readings-to-Influxdb-via-MQTT/master/src_readme/edit_mqtt.jpg)
45+
46+
Edit the `Server` to match the IP and port of the MQTT message broker (e.g. Mosquitto).
47+
48+
###Telegraf
49+
In the telegraf.conf file you have to specify an Input-Plugin for the MQTT protocol:
50+
51+
# Read metrics from MQTT topic(s)
52+
[[inputs.mqtt_consumer]]
53+
servers = ["localhost:1883"]
54+
## MQTT QoS, must be 0, 1, or 2
55+
qos = 0
56+
57+
## Topics to subscribe to
58+
topics = [
59+
"/power/#",
60+
]
61+
62+
# if true, messages that can't be delivered while the subscriber is offline
63+
# will be delivered when it comes back (such as on service restart).
64+
# NOTE: if true, client_id MUST be set
65+
persistent_session = false
66+
# If empty, a random client ID will be generated.
67+
client_id = ""
68+
69+
## username and password to connect MQTT server.
70+
# username = "telegraf"
71+
# password = "metricsmetricsmetricsmetrics"
72+
73+
## Optional SSL Config
74+
# ssl_ca = "/etc/telegraf/ca.pem"
75+
# ssl_cert = "/etc/telegraf/cert.pem"
76+
# ssl_key = "/etc/telegraf/key.pem"
77+
## Use SSL but skip chain & host verification
78+
# insecure_skip_verify = false
79+
80+
## Data format to consume.
81+
## Each data format has it's own unique set of configuration options, read
82+
## more about them here:
83+
## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
84+
data_format = "influx"
85+
86+
- Modify `servers` to match the IP and port of the MQTT message broker (e.g. Mosquitto)
87+
- Modify `topics` to the topic(s) you used in the function node of the flow. Note that the `#` will match anything after the first part of the path

0 commit comments

Comments
 (0)