{"id":21482797,"url":"https://github.com/ibmstreams/streamsx.waterconservation.starterkit","last_synced_at":"2025-08-28T09:14:44.542Z","repository":{"id":74839711,"uuid":"61134903","full_name":"IBMStreams/streamsx.waterConservation.starterKit","owner":"IBMStreams","description":"Starter kit for smart and connected sprinkler system using Apache Edgent, Streaming Analytics and Insights for Weather ","archived":false,"fork":false,"pushed_at":"2021-02-16T15:32:50.000Z","size":51393,"stargazers_count":7,"open_issues_count":6,"forks_count":10,"subscribers_count":6,"default_branch":"develop","last_synced_at":"2024-04-14T20:02:43.667Z","etag":null,"topics":["bluemix","edgent","ibm-streams","iot","nodejs","raspberry-pi","raspberrypi","reactjs","sensor-data","smart-home","starterkit","stream-processing","water-resources","watson-iot-platform","weather-api"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IBMStreams.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2016-06-14T15:37:04.000Z","updated_at":"2021-10-10T04:59:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"d394ea78-b885-4b7e-9697-a97d4563d272","html_url":"https://github.com/IBMStreams/streamsx.waterConservation.starterKit","commit_stats":{"total_commits":55,"total_committers":4,"mean_commits":13.75,"dds":0.6,"last_synced_commit":"1048615aec224da487db565852200b8c0b6da821"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBMStreams%2Fstreamsx.waterConservation.starterKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBMStreams%2Fstreamsx.waterConservation.starterKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBMStreams%2Fstreamsx.waterConservation.starterKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBMStreams%2Fstreamsx.waterConservation.starterKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IBMStreams","download_url":"https://codeload.github.com/IBMStreams/streamsx.waterConservation.starterKit/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226045055,"owners_count":17564916,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["bluemix","edgent","ibm-streams","iot","nodejs","raspberry-pi","raspberrypi","reactjs","sensor-data","smart-home","starterkit","stream-processing","water-resources","watson-iot-platform","weather-api"],"created_at":"2024-11-23T12:37:01.820Z","updated_at":"2024-11-23T12:37:02.556Z","avatar_url":"https://github.com/IBMStreams.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# streamsx.waterConservation.starterKit   \n\n# Notice\n\n\n## **This starter kit can no longer be deployed since the [Weather Company service is no longer available on IBM Cloud](https://www.ibm.com/cloud/blog/announcements/important-changes-related-to-weather-company-data-for-ibm-cloud).** \n\n\nYou can still modify the code and use its architecture as a reference.\n\n## Overview\n\n![Water Conservation Dashboard](readmeImg/water_conservation_dashboard.png)\n\nWater scarcity is one of the most pressing problems in the world right now.  According to the World Wildlife Fund (WWF), 70% of our planet is covered by water. However, only 3% of it is fresh water, and only one-third of that is available for consumption. Many water systems are stressed due to the growing human population and over-consumption. Agriculture consumes more water than any other source. Much of the water used in agriculture is wasted due to inefficient irrigation systems. To alleviate this problem, many governments impose restrictions on water usage, especially in drought-stricken states like California. However, these bans are difficult to enforce. For example, some people can afford to violate the restrictions and simply pay the fines.\n\nTo improve irrigation efficiency and properly enforce water usage restrictions, this starter kit is a prototype for a smarter, connected sprinkler system.\n\n### Water Conservation Application Architecture\n\nThe starter kit demonstrates the reference architecture of using Apache Edgent and how it can work in conjunction with a centralized analytics system.  \n\n![Water Conservation Application Architecture](readmeImg/water_arch1_edited.jpg)\n\nThis system consists of two main analytics components:\n\n* Analytics on edge devices: We used a Raspberry Pi to simulate a smart sprinkler device. On the device, local soil conditions like moisture level are continuously collected and analyzed using Apache Edgent. When the device detects that the soil is too dry and requires watering, it sends a request to the centralized analytics system for permission to turn on the sprinkler. The smart sprinkler system will not turn on the sprinkler unless it is approved by the centralized analytics system.\n* Centralized streaming analytics system: In the centralized analytics system, we used the Streaming Analytics service to analyze the incoming water requests in real time. To approve a water request, the application checks the weather forecast for the next two days using the Weather Company Data API. If there is not enough precipitation in the forecast, it checks to see if a water ban is currently in effect. The Streams application will approve the water request only if there is not enough precipitation in the forecast and if there is no water ban in effect.\n\nFor rapid application development, we leveraged other IBM Bluemix services. These services handle the infrastructure and connectivity, allowing us to focus on developing the analytics and business logic of the application. For the device to communicate with the centralized analytics system, we used the Watson Internet of Things Platform. This service handles application connectivity for us, allowing the Apache Edgent application to communicate with the IBM Streams application easily via MQTT.\n\nTo visualize the data, we implemented a visualization server using the SDK for Node.js service, and we used React.js to implement a web-based dashboard.\n\nThis smart sprinkler system now enables more efficient water irrigation based on current soil conditions. The prototype only takes the moisture level into account, but the system could be extended to monitor and analyze other important factors like moisture evaporation rate, soil mineral content, or irrigation requirements based on the type of vegetation being planted. Controlling the sprinklers in a centralized manner enabled us to implement business rules for managing water resources and properly enforcing water restrictions when necessary.\n\nSee the [Google+ Hangout Event](https://www.youtube.com/watch?v=Rvc1CqNJkOA) for more detail.\n\n**NOTE:** The jobs in the centralized streaming analytics system are configured to run for one hour only. You can start or stop the jobs manually under the 'Settings' menu.\n\n## Services Used in this Starter Kit\n\n### Analytics on Edge Device\n\nThe [moisture sensing simulator application](com.ibm.streamsx.smartsprinkler.edgent) is written using [Apache Edgent](http://edgent.incubator.apache.org).  The simulator can be run on any workstation.  It can also be run with a moisture sensor and buzzer on a Raspberry Pi.\n\n*Apache Edgent is an effort undergoing Incubation at The Apache Software Foundation (ASF), sponsored by the Incubator.\n\n### Centalized Streaming Analytics System\n\nThe centralized streaming analytics system uses the following Bluemix services:\n\n* [Weather Company Data for IBM Bluemix](https://console.ng.bluemix.net/catalog/services/weather-company-data-for-ibm-bluemix/)\n* [Watson IoT Platform](http://www.ibm.com/cloud-computing/bluemix/internet-of-things/)\n* [Streaming Analytics Service](https://www.ng.bluemix.net/docs/services/StreamingAnalytics/index.html)\n* [SDK for Node.js](https://console.ng.bluemix.net/catalog/starters/sdk-for-nodejs)\n\nAn demonstration of the centralized analytics system is hosted here: [http://waterconservation.mybluemix.net/](http://waterconservation.mybluemix.net/).\n\n## Getting Started\n\n\nTo try out this starter kit:\n\n1.  Deploy the centralized analyltics application onto Bluemix, following the instructions below.\n2.  Follow instructions [here](com.ibm.streamsx.smartsprinkler.edgent/README.md) to set up device configuration file.\n2.  Download a copy of the Apache Edgent application from the [release](https://github.com/IBMStreams/streamsx.waterConservation.starterKit/releases) page.  Run the application on your workstation or on a Raspberry Pi.\n\n## Deploy to Bluemix\n\n### Prerequisites\n\nCreate a [Bluemix](https://bluemix.net/) account.\n\n### Option 1: Automatic Deployment\n\nClick the button below to fork into IBM DevOps Services and deploy your own copy of this application on Bluemix, with a DevOps toolchain already configured.\n\nWe are deploying a number of applications onto Bluemix.  This process will take about 15 minutes to complete.\n\n[![Deploy To Bluemix](https://bluemix.net/deploy/button.png)](https://bluemix.net/deploy?repository=https://github.com/IBMStreams/streamsx.waterConservation.starterKit.git)\n\n### Option 2: Manual Deployment\n\nIn Bluemix:\n  1. Create a Streaming Analytics Service with the name `Streaming-Analytics`\n  1. Create a Weather Company Data Service with the name `Weather-Company-Data`\n  1. Create a Watson IoT Platform Service with the name `Internet-of-Things-Platform`\n\nThen:\n* ```cd nodejs```\n* ```npm install```\n* ```npm run build```\n* ```cd ..```\n* ```cf push -n \u003chost prefix\u003e```\n\n## Deploy locally\n* ```cd nodejs```\n* modify [app/server/config/application-local.js](nodejs/app/server/config/application-local.js), and fill in the bluemix services credentials\n* ```npm install```\n* ```npm start```\n\nBy default, the server starts on localhost:3000\n\n## Running the Apache Edgent Application\n\nRefer to [com.ibm.streamsx.smartsprinkler.edgent/README.md](com.ibm.streamsx.smartsprinkler.edgent/README.md) for further information.\n\n# Project File Structure\n\n```\nroot\n│   manifest.yml (Bluemix deployment configuration file)\n|   README.md (The file you are reading now)\n|   LICENSE.md (License Terms)\n|   copysabs.sh (Scripts for copying streams SAB files into nodejs folder)\n│\n├───.bluemix (Bluemix pipeline configuration file)\n├───readmeImg (Image files for README.md)\n├───com.ibm.streamsx.smartsprinkler.iot (Streams project for connecting to IOT)\n├───com.ibm.streamsx.smartsprinkler.streams (Streams project for making water decisions)\n├───com.ibm.streamsx.smartsprinkler.edgent (Java project for gathering sensor data on Raspberry Pi)\n└───nodejs (Node.js project for dashboard)\n```\n\n# Component Dependencies\n\nThe Java application running on Raspberry Pi require:\n* [Pi4J library](http://pi4j.com)\n* [Edgent library](http://edgent.incubator.apache.org/docs/community)\n\nThe components required by the Node.js app are documented in the [package.json](nodejs/package.json) in the `nodejs` directory.  The list include:\n* async\n* body-parser\n* bunyan\n* chart.js\n* d3\n* express\n* http-proxy\n* http-status-codes\n* lodash\n* material-ui\n* moment\n* multer\n* react\n* react-chartjs\n* react-dom\n* react-sparklines\n* react-tap-event-plugin\n* request\n* socket.io\n* superagent\n* babel-core\n* babel-eslint\n* babel-loader\n* babel-preset-es2015\n* babel-preset-react\n* eslint\n* eslint-loader\n* eslint-plugin-react\n* react-hot-loader\n* webpack\n* webpack-dev-server\n\n# License\n\nThe source code for the app is available under the Apache license, which is found in [LICENSE](LICENSE) in the root of this repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibmstreams%2Fstreamsx.waterconservation.starterkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fibmstreams%2Fstreamsx.waterconservation.starterkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibmstreams%2Fstreamsx.waterconservation.starterkit/lists"}