#
# See: https://www.influxdata.com/integration/mqtt-telegraf-consumer/
#

[[inputs.mqtt_consumer]]
  servers = ["ssl://mqtt.easypi.duckdns.org:8883"]
  topics = [
    "zigbee2mqtt/+",
  ]
  data_format = "json"
  json_string_fields = ["contact", "occupancy", "action"]
  username = "telegraf"
  password = "telegraf"

[[processors.enum]]
  order = 2
  [[processors.enum.mapping]]
    field = "contact"
    [processors.enum.mapping.value_mappings]
      false = 0
      true = 1
  [[processors.enum.mapping]]
    field = "occupancy"
    [processors.enum.mapping.value_mappings]
      false = 0
      true = 1
  [[processors.enum.mapping]]
    field = "action"
    [processors.enum.mapping.value_mappings]
      single = 1
      double = 2
      long = 3
