After some first steps with zigbee devices and storing the data in an influxdb, i noticed that string values are suboptimal for building graphs.
Moving the data from mqtt to influxdb was done with telegraf:
https://www.influxdata.com/time-series-platform/telegraf/
And i was wondering, how i can change string to integers, but this i very easy:
[[processors.enum]]Next problem: if the column "water_leak" was already added inside your influxdb, you can not add numbers - so you have to drop the table and loose your data...
order = 2
[[processors.enum.mapping]]
field = "state"
[processors.enum.mapping.value_mappings]
"ON" = 1
"OFF" = 0
[[processors.enum.mapping]]
field = "contact"
[processors.enum.mapping.value_mappings]
"true" = 2
"false" = 1
[[processors.enum.mapping]]
field = "tamper"
[processors.enum.mapping.value_mappings]
"true" = 1
"false" = 0
[[processors.enum.mapping]]
field = "water_leak"
[processors.enum.mapping.value_mappings]
"true" = 1
"false" = 0
(This is not the full truth: you can export the data via a select to a file and insert the data afterwards - with the appropriate numbers...)
No comments:
Post a Comment