So, I have successfully been running TIG to collect some climate data from Tasmota devices. All has been good. Running Telegraf 1.13.2-1 on Ubuntu
Said Tasmota devices sends data in the following form
{
"Time" : "2020-01-27T06:38:05",
"AM2301" : {
"Temperature" : 17.7,
"Humidity" : 51.3
},
"TempUnit" : "C"
}
The publish to the topic “tele/+/SENSOR”, and i see good stuff in my database
> show series on telegraf
key
---
mqtt_consumer,host=server01,topic=tele/Klimatsensor_322Mats01/SENSOR
mqtt_consumer,host=server01,topic=tele/Klimatsensor_412Piano01/SENSOR
> select * from mqtt_consumer limit 10
name: mqtt_consumer
time AM2301_Humidity AM2301_Temperature SI7021_Humidity SI7021_Temperature host topic
---- --------------- ------------------ --------------- ------------------ ---- -----
82000000000 57.4 18.4 server01 tele/Klimatsensor_Verkstad/SENSOR
392000000000 56.3 18 server01 tele/Klimatsensor_Verkstad/SENSOR
1562523952000000000 93 13.1 server01 tele/Klimatsensor_Street01Lagt/SENSOR
Soo, i thought i would be clever and use the same database for a NON tasmota sensor, which published messages in the form of
{
"Time" : "2020-01-27T06:40:10",
"SEN0232" : {
"SoundLevel" : 47.14285714
},
"SoundLevelUnit" : "dBA"
}
to the topic dBA/Dansgolv
To me, these seem pretty much the same as the ones from Tasmota. But they do not make it into the database for some reason that baffels me. I thought i would see SEN0232_SoundLevel in my database. But no…
At the bottom of this post is my telegraf config before adding the new sensors. After adding the new sensors i changed my topics, and restarted telegraf.
I feel I must be missing something very silly, and very fundamental… But what?
j2@server01:/etc/telegraf# sudo cat /etc/telegraf/telegraf.conf | grep '^[[:blank:]]*[^[:blank:]#;]'
[global_tags]
[agent]
interval = "10s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
precision = ""
debug = true
quiet = false
logfile = "/tmp/telegraf.log"
logfile_rotation_interval = "1d"
logfile_rotation_max_size = "50MB"
logfile_rotation_max_archives = 5
hostname = ""
omit_hostname = false
[[outputs.influxdb]]
urls = ["http://127.0.0.1:8086"]
database = "telegraf"
username = "redacted"
password = "redacted"
[[outputs.file]]
files = ["stdout", "/tmp/metrics.out"]
rotation_interval = "1d"
rotation_max_archives = 60
data_format = "influx"
[[inputs.mqtt_consumer]]
servers = ["tcp://localhost:1883"]
qos = 2
topics = [
"tele/+/SENSOR"
]
persistent_session = true
client_id = "server01"
username = "redacted"
password = "redacted"
data_format = "json"
json_time_key = "Time"
json_time_format ="2006-01-02T15:04:05"
After adding the new sensors. my topics are as follows. (Again, i DID restart telegraf after making the change)
topics = [
"tele/+/SENSOR",
"dBA/Dansgolv"
]