Coder Social home page Coder Social logo

zredlined / quietcool-aws Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 48 KB

Project to connect Quietcool Stealth whole house-fan Wifi controller to AWS IoT Core and Alexa via Raspberry Pi

License: MIT License

Python 91.50% Shell 8.50%
aws aws-lambda aws-iot-python aws-iot-device-sdk-python raspberry-pi quietcool alexa-skills-kit python3 iot-device

quietcool-aws's Introduction

quietcool-aws

Project to connect Quietcool Stealth whole house-fan Wifi controller to AWS and Alexa

Setup instructions

The setup instructions below get you up and running on a Raspberry Pi running Debian (NOOBS Raspbian)

Install Node.js typescript Quietcool Server

This server talks to the Quietcool WiFi controller via COAP (constrained appliation protocol)

First, we need to setup Node.js on the Raspberry Pi

# Install node.js binaries for ARMv7 (confirm right distro with uname -m)
mkdir src; cd src;
wget https://nodejs.org/dist/v8.12.0/node-v8.12.0-linux-armv7l.tar.xz
tar -xJf node-v8.12.0-linux-armv7l.tar.xz
cd node-v8.12.0-linux-armv7l/
cp -Rf * /usr/local

sudo apt-get install nodejs, npm
sudo npm install ts-node -g

Install the quietcool-server

cd ..;mkdir dev;cd dev;mkdir js; cd js
git clone https://github.com/stabbylambda/quietcool-server.git
cd quietcool-server
sudo npm install
echo "ts-node ./src/index.ts" > start.sh
sudo chmod u+x start.sh

Setup and install quietcool-aws

cd ../..;mkdir python3;cd python3
git clone https://github.com/zredlined/quietcool-aws
cd quietcool-aws
mkdir certs # copy your thing certificates from AWS and the root-CA.crt here

Launch Quietcool-AWS

(Ensure your certificate/IoT thing have appropriate IoT permissions) pip3 install -r requirements.txt

printf "\nRunning pub/sub iot thing application...\n"
python3 quietcool_aws/shadow_listener_quietcool.py \
    -e XXXXXXXX-ats.iot.us-west-2.amazonaws.com \
    -r ./certs/root-CA.crt \
    -c ./certs/QuietcoolThing.cert.pem \
    -k ./certs/QuietcoolThing.private.key \
    -n QuietcoolThing \
    -id quietcool-thing-python-abacabb

Interested in testing updates live before connecting to Alexa?

python quietcool_aws/shadow_controller_quietcool.py \
    -e XXXXXXXXX-ats.iot.us-west-2.amazonaws.com \
    -r ./certs/root-CA.crt \
    -c ./certs/QuietcoolThing.cert.pem \
    -k ./certs/QuietcoolThing.private.key \
    -n QuietcoolThing \
    -id quietcool-controller-python-abacabb

Install Quietcool-server and Quietcool-AWS as services on Raspberry Pi

Create a systemctl service for the Quietcool AWS IoT Core Python client

sudo vi /etc/systemd/system/quietcool-aws.service

Copy in the following text (and modify AWS endpoint to match your IoT Core endpoint =)

[Unit]
Description=Quietcool AWS server
After=multi-user.target

[Service]
Type=simple
Restart=always
RestartSec=3
User=pi
WorkingDirectory=/home/pi/dev/python3/quietcool-aws/
ExecStart=/usr/bin/python3 /home/pi/dev/python3/quietcool-aws/quietcool_aws/shadow_listener_quietcool.py \
    -e XXXXXXXX-ats.iot.us-west-2.amazonaws.com \
    -r ./certs/root-CA.crt \
    -c ./certs/QuietcoolThing.cert.pem \
    -k ./certs/QuietcoolThing.private.key \
    -n QuietcoolThing \
    -id quietcool-thing-python-abacabb

[Install]
WantedBy=multi-user.target

Create a systemctl service for the Quietcool COAP server (Node.js Typescript)

sudo vi /etc/systemd/system/quietcool-aws.service

Copy in the following text

[Unit]
Description=Quietcool COAP server
After=multi-user.target

[Service]
Type=simple
Restart=always
RestartSec=3
User=pi
WorkingDirectory=/home/pi/dev/js/quietcool-server/
ExecStart=/usr/local/bin/ts-node /home/pi/dev/js/quietcool-server/src/index.ts

[Install]
WantedBy=multi-user.target

Set permissions to initialize each service on startup as systemctl daemons

# setup quietcool aws
sudo chmod 644 /etc/systemd/system/quietcool-aws.service
chmod +x /home/pi/dev/python3/quietcool-aws/quietcool_aws/shadow_listener_quietcool.py
sudo systemctl daemon-reload
sudo systemctl enable quietcool-aws.service
sudo systemctl start quietcool-aws.service
sudo systemctl status quietcool-aws.service

# setup quietcool coap
sudo chmod 644 /etc/systemd/system/quietcool-service.service
chmod +x /home/pi/dev/js/quietcool-server/src/index.ts
sudo systemctl daemon-reload
sudo systemctl enable quietcool-service.service
sudo systemctl start quietcool-service.service
sudo systemctl status quietcool-service.service

Setting up your Alexa application using Alexa Skills Kit

Instructions comming soon!

quietcool-aws's People

Contributors

zredlined avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.