Simple Qivivo API to controle temperature using your voice via IFTTT and google assistant / amazon
You need to install these on your server (List of instructions for ubuntu 16.04)
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.2
sudo apt-get install php-pear php7.2-curl php7.2-dev php7.2-gd php7.2-mbstring php7.2-zip php7.2-mysql php7.2-xml
sudo apt-get install apache2
sudo apt-get install git
https://getcomposer.org/download/
Clone the project into your apache project directory
cd /var/www/ && git clone git@github.com:mlamoitte/qivivo_webhook_ifttt.git qivivo
Install dependencies
cd /var/www/qivivo/ && composer install
cp /var/www/qivivo/.env.test /var/www/qivivo/.env
APP_ENV=prod
...
...
API_KEY="YOU_HAVE_TO_GENERATE_ONE"
QIVIVO_USER="YOUR_QIVIVO_ACCOUNT_LOGIN"
QIVIVO_PASSWORD="YOUR_QIVIVO_ACCOUNT_PASSWORD"
If you want to generate an api_key easily you can go to https://codepen.io/corenominal/pen/rxOmMJ
sudo nano /etc/apache2/sites-available/qivivo.conf
Paste these lines
<VirtualHost *:80>
ServerName XXXXXXXX
ServerAdmin YYYYYYYY
DocumentRoot /var/www/qivivo/public/
ErrorLog /var/log/apache2/virtual.host.error.log
CustomLog /var/log/apache2/virtual.host.access.log combined
LogLevel warn
</VirtualHost>
Adapt to your need
XXXXXXXX = yourndd.com
YYYYYYYY = your@email.com
Activate the vHost
sudo a2ensite qivivo.conf
restart apache2
sudo service apache2 restart
You can now post request to yourndd.com/api/qivivo/setTemperature with inside body request
api_key=YOURAPIKEY&temp=WANTEDTEMPERATURE
NB: By default all others urls from yourndd.com will return 403 forbiden only /api/qivivo/setTemperature will return a 200 ok only below parameters
curl -X POST \
https://yourndd.com/api/qivivo/setTemperature \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'cache-control: no-cache' \
-d 'api_key=YOURAPIKEY&temp=20'
I really recommended you to enable https to your domain for security improvement.
Link for ubuntu 16.04
https://certbot.eff.org/lets-encrypt/ubuntuxenial-apache
Other
- Create an account to
- Create an applet
- https://ifttt.com/create
- In this section
select google assistant -> Say a phrase with a number --> Fill the required field with your needs Ex: Put heating to #
- In That section
select webHook -> Make a web request URL https://yourndd.com/api/qivivo/setTemperature Method POST Content type application/x-www-form-urlencoded Body api_key=YOURAPIKEY&temp={{NumberField}}
- https://ifttt.com/create
Same operation than before except replacing google assistant by amazon alexa