Front web app for visualization of sensors data in dashobards. Data are fetched from the API deployed by aws-iot-sensors-infra.
The project compiles a static website using Jinja.
Configure a new Python environment:
$ python3 -m venv .venv $ source venv/bin/activate (.venv)$ pip install -r requirements.txt
In src/script.js, edit the apiUrl
variable to match your API URL. Then, run the following command to generate the static pages:
(.venv)$ python gen_site.py
Tip
|
You might also want to change the sensorIds variables in src/motion.js and src/environment.js, before generating the website, depending on how you confiured your IoT devices.
|
Files are generated in the dist folder and can be tested by launching a local web server, for example with:
(.venv)$ cd dist (.venv)$ python -m http.server
To deploy the website in an existing S3 bucket configured with public access and as a website, such as the website bucket created by aws-iot-sensors-infra, run:
$ aws s3 sync --delete dist s3://<BUCKET_NAME>
Note
|
If using this project with aws-iot-sensors-infra, beware that only the motion sensors page should work. The API URL for the Environment page does not exist and can be implemented in aws-iot-sensors-infra as an exercise without having to modify aws-iot-sensors-front. |