A NodeRed project to retrieve data from public API, store and display. Once the nodes are imported, the flows would show the following.
- Subscribe public APIs - Dark Sky API is used here. Return weather data is in JSON format. Data is pulled every 5 minutes.
- Parse the receiving data - Parse interested weather data and package them to publish
- Publish to MQTT broker - Publish to a public MQTT broker from Mosquitto, test.mosquitto.org. A local mosquitto broker is used for reliability
- Display LED when temperature is at 85F (Optional) - Require Raspberry Pi or similar
- Subscribe to MQTT topic - Subscribe to the same topic when publishing MQTT message
- Save data to MySQL- See the table structure section for setup. User name and password are needed for your local database. NoSQL; MongoDB, is used for demo
- Create live temperature chart of the last 2 hours
- Retrieve and display temperature of the day from MySQL and MongoDB
- Stackhero MySQL
- node-red-contrib-mongodb3
- node-rpio (Raspberry Pi) - It can be any other similar board or simply skip it
- node-red-dashboard
- Functions is written in Javascript
CREATE TABLE `sj_data` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT, `time` varchar(255) DEFAULT NULL, `temperature` float DEFAULT NULL, `humidity` float DEFAULT NULL, `pressure` float DEFAULT NULL, `windSpeed` float DEFAULT NULL, `uvIndex` float DEFAULT NULL, `visibility` float DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci