Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON parser ignoring boolean values #6398

Closed
heinrichnak opened this issue Sep 16, 2019 · 2 comments · Fixed by #6400
Closed

JSON parser ignoring boolean values #6398

heinrichnak opened this issue Sep 16, 2019 · 2 comments · Fixed by #6400
Labels
regression something that used to work, but is now broken
Milestone

Comments

@heinrichnak
Copy link

heinrichnak commented Sep 16, 2019

Relevant telegraf.conf:

[[inputs.mqtt_consumer]]
   servers = ["tcp://localhost:1883"]
   topics = [
     "events/central_heating/otmonitor/flame",
   ]
   data_format = "json"
   data_type = "boolean"
   name_override = "flame"
   name_prefix = "otgw_"
   json_string_fields = [
     "value",
   ]
   interval = "10s"

System info:

Telegraf version 1.12.1 on Ubuntu 18.04.3 LTS

Steps to reproduce:

  1. Read boolean type of JSON message from a MQTT topic

Expected behavior:

Store boolean in influxdb:

> select * from otgw_flame
name: otgw_flame
time                host   timestamp     topic                                  value
----                ----   ---------     -----                                  -----
1568614387211376524 ubuntu 1568611817541 events/central_heating/otmonitor/flame true

Actual behavior:

Only the timestamp is stored, not the boolean value:

> select * from otgw_flame
name: otgw_flame
time                host   timestamp     topic
----                ----   ---------     -----
1568614387211376524 ubuntu 1568611817541 events/central_heating/otmonitor/flame

Additional info:

This used to work until version 1.12.0, so it seems that something introduced in 1.12.0 broke this.

This is the message from MQTT perspective:

# mosquitto_sub -t events/central_heating/otmonitor/flame
{"name": "on", "type": "boolean", "value": false, "timestamp": 1568611817541}
@glinton
Copy link
Contributor

glinton commented Sep 16, 2019

It appears this functionality was removed in 41176dd

@glinton glinton added the regression something that used to work, but is now broken label Sep 16, 2019
@glinton glinton added this to the 1.12.2 milestone Sep 16, 2019
@glinton glinton changed the title inputs.mqtt_consumer does not pick up boolean JSON value JSON parser ignoring boolean values Sep 16, 2019
@heinrichnak
Copy link
Author

Thanks! Works fine again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression something that used to work, but is now broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants