Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions config/telegraf.sample.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,41 @@
topic = "+/batcontrol/+"
measurement = "_/measurement/_"
tags = "_/_/pivot_field"
# The "value" parser keeps only the last whitespace separated token of a
# payload, so free text like /decision would arrive truncated. It is
# handled by the dedicated consumer below instead.
[inputs.mqtt_consumer.tagdrop]
pivot_field = ["decision"]

# /decision is a full sentence ("Charge from Grid 1250 W - ..."), so it needs
# a parser that takes the payload as a whole instead of the "value" parser.
[[inputs.mqtt_consumer]]
servers = ["tcp://mqtt:1883"]
topics = [
"house/batcontrol/decision"
]
name_override = "batcontrol-decision"
data_format = "grok"
grok_patterns = ["%{GREEDYDATA:decision}"]

# Optional: the machine readable side of the same status change. "reason" is
# null until the first decision with a decisive step, hence optional ("mode" is always an int).
#[[inputs.mqtt_consumer]]
# servers = ["tcp://mqtt:1883"]
# topics = [
# "house/batcontrol/decision/attributes"
# ]
# name_override = "batcontrol-decision"
# data_format = "json_v2"
# [[inputs.mqtt_consumer.json_v2]]
# [[inputs.mqtt_consumer.json_v2.tag]]
# path = "decided_by.reason"
# rename = "reason"
# optional = true
# [[inputs.mqtt_consumer.json_v2.field]]
# path = "mode"
# type = "int"
# optional = true

[[inputs.mqtt_consumer]]
servers = ["tcp://mqtt:1883"]
Expand Down
Loading