{"id":23752501,"url":"https://github.com/rwbl/tinkerforge-airquality-node-red-dashboard","last_synced_at":"2026-01-27T05:31:45.524Z","repository":{"id":156024063,"uuid":"207279218","full_name":"rwbl/tinkerforge-airquality-node-red-dashboard","owner":"rwbl","description":"To display data from the Tinkerforge Air Quality Bricklet in a Node-RED dashboard using MQTT.","archived":false,"fork":false,"pushed_at":"2020-02-04T09:02:55.000Z","size":40,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-25T00:21:57.581Z","etag":null,"topics":["node-red","node-red-dashboard","tinkerforge"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rwbl.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-09-09T10:00:24.000Z","updated_at":"2020-02-04T09:02:57.000Z","dependencies_parsed_at":"2025-11-15T03:02:38.981Z","dependency_job_id":null,"html_url":"https://github.com/rwbl/tinkerforge-airquality-node-red-dashboard","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rwbl/tinkerforge-airquality-node-red-dashboard","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwbl%2Ftinkerforge-airquality-node-red-dashboard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwbl%2Ftinkerforge-airquality-node-red-dashboard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwbl%2Ftinkerforge-airquality-node-red-dashboard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwbl%2Ftinkerforge-airquality-node-red-dashboard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rwbl","download_url":"https://codeload.github.com/rwbl/tinkerforge-airquality-node-red-dashboard/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwbl%2Ftinkerforge-airquality-node-red-dashboard/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28803892,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T03:44:14.111Z","status":"ssl_error","status_checked_at":"2026-01-27T03:43:33.507Z","response_time":168,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["node-red","node-red-dashboard","tinkerforge"],"created_at":"2024-12-31T17:53:07.241Z","updated_at":"2026-01-27T05:31:45.511Z","avatar_url":"https://github.com/rwbl.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tinkerforge Air Quality Node-RED Dashboard\n\n## Objectives\nTo display data from the Tinkerforge Air Quality Bricklet in a Node-RED dashboard using MQTT.\n\n![tfindoorairquality-dashboard](https://user-images.githubusercontent.com/47274144/64522178-ba8cf380-d2f9-11e9-88ca-c8cc59b9d7ef.png)\n\n## Solution\nThe Tinkerforge Air Quality Bricklet is connected to a Tinkerforge Master brick = the Tinkerforge Building Blocks.\nThe Master Brick is connected via USB with a Raspberry Pi 4 running Node-RED.\nCommunication between the Tinkerforge Node-RED and the Tinkerforge Building Blocks is via MQTT.\nOn the Raspberry Pi, mosquitto is used as broker. \nThe Tinkerforge MQTT bindings (2.0) are used to control the Master Bricks and Bricklets using the MQTT protocol.\n\n## Parts\n* 1x Raspberry Pi 4B (OS Buster)\n* 1x Tinkerforge Master Bricklet 2.1\n* 1x Tinkerforge Air Quality Bricklet\n\n## Prepare\n\n### MQTT Raspberry Pi\nInstall mosquitto and related packages.\nThe Tinkerforge MQTT bindings are based on the Tinkerforge Python bindings.\n```\nsudo apt-get install mosquitto\nsudo apt-get install mosquitto mosquitto-clients\nsudo apt-get install libusb-1.0-0 libudev0 pm-utils\nsudo apt-get install python3-pip\nsudo pip3 install tinkerforge paho-mqtt\n```\n\n#### MQTT Service\n\n##### Service File\n\nCreate a service file /home/pi/tinkerforge/mqtt/tinkerforge_mqtt.service\n```\n[Unit]\nDescription=Tinkerforge MQTT Bindings\n# brickd is running locally\nAfter=brickd.service\n\n# mosquitto is running locally\nAfter=mosquitto.service\n\n[Service]\nType=simple\nStandardOutput=file:/home/pi/tinkerforge/mqtt/tinkerforge_mqtt.log\nExecStart=/usr/bin/python3 /usr/local/bin/tinkerforge_mqtt\n\n[Install]\nWantedBy=multi-user.target\n```\n\nCopy the service file to /etc/systemd/system/\n```\nsudo cp tinkerforge_mqtt.service /etc/systemd/system/tinkerforge_mqtt.service\n```\n\n##### Service Start, Stop, Status, Boot Enable/Disable\n\n###### Start\n```\nsudo systemctl start tinkerforge_mqtt\n```\n\n###### Stop\n```\nsudo systemctl stop tinkerforge_mqtt\n```\n\n###### Status\n```\nsudo systemctl status tinkerforge_mqtt\n```\nExample output\n```\ntinkerforge_mqtt.service - Tinkerforge MQTT Bindings\n  Loaded: loaded (/etc/systemd/system/tinkerforge_mqtt.service; enabled; vendor\n  Active: active (running) since Sat 2019-09-07 10:17:09 CEST; 6min ago\nMain PID: 558 (python3)\n  Tasks: 5 (limit: 4063)\n  Memory: 18.7M\n  CGroup: /system.slice/tinkerforge_mqtt.service\n          └─558 /usr/bin/python3 /usr/local/bin/tinkerforge_mqtt\nSep 07 10:17:09 4dev systemd[1]: Started Tinkerforge MQTT Bindings.\n```\n\n###### Boot Enable, Disable\nSet the boot flag: enable to start service during boot.\n```\nsudo systemctl enable tinkerforge_mqtt\nsudo systemctl disable tinkerforge_mqtt\n```\n\n### Tinkerforge Building Blocks\nInstall the Brick Deamon and Brick Viewer on the Raspberry Pi.\nThis is described on the Tinkerforge Website.\n\n#### Brick Deamon \u0026 Brick Viewer\nTo install and update the required files, using a bash script update.sh located in folder /home/pi/tinkerforge.\n\nEnsure to make the bash script executable:\n```\nsudo chmod +x update.sh.\n```\n\nRun the script\n```\n./update.sh\n```\n\nBash Script Content\n```\n#!/bin/bash\necho \"Updating Brick Deamon and Brick Viewer\"\n## update.sh\n## 20190907 rwbL\ncd /home/pi/tinkerforge\necho \"Removing deb files...\"\nrm *.deb\necho \"Ok\"\necho \"Updating libraries...\"\nsudo apt-get install libusb-1.0-0 libudev0 pm-utils\necho \"Updating Brick Deamon...\"\nwget https://download.tinkerforge.com/tools/brickd/linux/brickd_linux_latest_armhf.deb\nsudo dpkg -i brickd_linux_latest_armhf.deb\necho \"Ok\"\necho \"Updating Brick Viewer...\"\nsudo apt-get install python3 python3-pyqt5 python3-pyqt5.qtopengl python3-serial python3-tz python3-tzlocal\nwget https://download.tinkerforge.com/tools/brickv/linux/brickv_linux_latest.deb\nsudo dpkg -i brickv_linux_latest.deb\necho \"Ok\"\nrm *.deb\necho \"Done\"\n```\n\n#### Connect Tinkerforge Building Blocks\nConnect the Air Quality Bricklet to the Master Brick.\nConnect the Master Brick via USB with the Raspberry Pi.\nStart the Brick Viewer (Menu Programming \u003e Brick Viewer)\nUse as host localhost with defaut port 4223.\nConnect\nThe Master Brick (UID: 6yLduG, FW: 2.4.10) with the Air Quality Bricklet (UID: Jvj, FW: 2.0.5) should be listed.\nCheck the frmware (FW) versions and update if required.\nClick on Tab Air Quality Bricklet and check if data is gathered.\n\n#### MQTT Tests\nEnsure the tinkerforge_mqtt script is running. Just check again with:\n```\nsudo systemctl status tinkerforge_mqtt\n```\n\n#### Test Subscribe to Air Quality Messages\nThis test uses the callback to log Air Quality messages published.\n\n##### Open Terminal 1\nTwo options shared.\n###### Option 1: Subscribe to all messages\n```\nmosquitto_sub -v -t '#'\n```\n\n###### Option 2: Subscribe to all values using callback\n```\nmosquitto_sub -v -t tinkerforge/callback/air_quality_bricklet/Jvj/all_values\n```\n\n##### Open Terminal 2\nSet the Callback Configuration for the Air Quality bricklet, i.e.\npublish every 5s, i.e period 5000 and always log even if data has not changed.\n```\nmosquitto_pub -t tinkerforge/request/air_quality_bricklet/Jvj/set_all_values_callback_configuration -m '{\"period\": 5000,\"value_has_to_change\": false}'\n```\n\nSet the register to true (start callback)\n```\nmosquitto_pub -t tinkerforge/register/air_quality_bricklet/Jvj/all_values -m '{\"register\": true}'\n```\nUse false to turn register off (stop callback)\n```\nmosquitto_pub -t tinkerforge/register/air_quality_bricklet/Jvj/all_values -m '{\"register\": false}'\n```\n\n##### Check Terminal 1\nThe topic and payload of the Air Quality Bricklet are logged every 5s.\n\n###### Option 1\nThese are the messages when subscribing to all messages:\n```\nmosquitto_sub -v -t '#'\n```\n\n```\ntinkerforge/callback/air_quality_bricklet/Jvj/all_values {\"iaq_index\": 38, \"iaq_index_accuracy\": \"low\", \"temperature\": 2152, \"humidity\": 6015, \"air_pressure\": 101742}\ntinkerforge/callback/air_quality_bricklet/Jvj/all_values {\"iaq_index\": 40, \"iaq_index_accuracy\": \"low\", \"temperature\": 2152, \"humidity\": 6015, \"air_pressure\": 101742}\ntinkerforge/callback/air_quality_bricklet/Jvj/all_values {\"iaq_index\": 36, \"iaq_index_accuracy\": \"low\", \"temperature\": 2152, \"humidity\": 6013, \"air_pressure\": 101741}\ntinkerforge/register/air_quality_bricklet/Jvj/all_values {\"register\": false}\n```\nLast entry turned the register off.\n\n###### Option 2\nThese are the messages when subscribing to all values from the Air Quality Bricklet:\n```\nmosquitto_sub -v -t tinkerforge/callback/air_quality_bricklet/Jvj/all_values\n```\n\n```\ntinkerforge/callback/air_quality_bricklet/Jvj/all_values {\"iaq_index\": 118, \"iaq_index_accuracy\": \"low\", \"temperature\": 2074, \"humidity\": 6181, \"air_pressure\": 101839}\ntinkerforge/callback/air_quality_bricklet/Jvj/all_values {\"iaq_index\": 118, \"iaq_index_accuracy\": \"low\", \"temperature\": 2074, \"humidity\": 6184, \"air_pressure\": 101840}\ntinkerforge/callback/air_quality_bricklet/Jvj/all_values {\"iaq_index\": 117, \"iaq_index_accuracy\": \"low\", \"temperature\": 2075, \"humidity\": 6186, \"air_pressure\": 101839}\n```\n\n#### Single request \u0026 response\nTerminal 1: Subscribe to messages published.\n```\nmosquitto_sub -v -t tinkerforge/response/air_quality_bricklet/Jvj/get_all_values\n```\n\nTerminal 2: Publish a single message.\n```\nmosquitto_pub -t tinkerforge/request/air_quality_bricklet/Jvj/get_all_values -m ''\n```\n\nTerminal 1: logs the message as a result from command in terminal 2\n```\ntinkerforge/response/air_quality_bricklet/Jvj/get_all_values {\"iaq_index\": 90, \"iaq_index_accuracy\": \"low\", \"temperature\": 2559, \"humidity\": 5089, \"air_pressure\": 101891}\n```\n\n\n\n\nSo far so good - lets start building Node-RED Dashboard solution.\n\n### Node-RED\nThe flow has two sections settings and data.\nThe communication with the Tinkerforge Building Blocks is via MQTT.\n\n![tfindoorairquality-dashboard-flow](https://user-images.githubusercontent.com/47274144/64522177-ba8cf380-d2f9-11e9-9762-120ce0c0f658.png)\n\n#### MQTT\nThe nodes mqtt in and mqtt out are used.\nTo update the settings, i.e. the Tinkerforge Air Quality Bricklet configuration, the mqtt out node is used.\nThe topics to publish messages are (Javascript code from the function node):\n```\nmsg.topic = \"tinkerforge/request/air_quality_bricklet/Jvj/set_all_values_callback_configuration\";\nmsg.payload = {\"period\": callbackPeriod, \"value_has_to_change\": false}; \n```\nand (Topic and Payload from a ui_switch node)\n```\ntinkerforge/register/air_quality_bricklet/Jvj/all_values\n{\"register\":true} or {\"register\":false}\n```\n\nTo get data from the Tinkerforge Air Quality Bricklet, the mqtt in node is used.\nThe topic to subscribe to messages is:\n```\ntinkerforge/#\n```\nThis means all messages published by Tinkerforge MQTT Python script are coming in.\nA switch node is used to select a topic. This enables to use multiple bricklets.\nFor this solution, only one bricklet is used:\n```\ntinkerforge/callback/air_quality_bricklet/Jvj/all_values\n```\n\n#### Settings\nThe settings enables to set the callback configuration and the callback register.\nThe configuration parameter callback period (ms) can be set via dashboard text input node.\nWhen the flow starts, an initial value is injected.\nThe configuration is changed via mqtt out node.\n\nThe callback register can be set to true (=on) and false (=off) via dashboard switch.\nWhen the flow starts, the switch is set to true to start creating data messages.\nThe configuration is changed via mqtt out node.\n\n#### Data\nIncoming MQTT messages are filtered by topic, only one topic used for now.\nThe payload is converted to a JavaScript object to get the payload properties containing the data.\nExample published payload JSON string:\n```\n{\"iaq_index\":51,\"iaq_index_accuracy\":\"low\",\"temperature\":2190,\"humidity\":6091,\"air_pressure\":101391}\n```\nFor each of the properties a change node converts the property to a payload\nThis payload is used by Dashboard Gauge, Chart and other nodes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwbl%2Ftinkerforge-airquality-node-red-dashboard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frwbl%2Ftinkerforge-airquality-node-red-dashboard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwbl%2Ftinkerforge-airquality-node-red-dashboard/lists"}