Installation
Temps 5-10min avec une connection fibre
Telecharger Gladys sur le site , ainsi que etcher
selectionner image zip puis le « drive » la carte micro sd
rendez vous sur votre browser http://gladys.local/installation , Gladys wi then install all the necessary for you
connect to your raspberry pi , donload network scanner and connect to your wifi .
In my house for instance its 192.168.1.99
ssh pi@192.168.1.99The authenticity of host ’192.168.1.99 (192.168.1.99)’ can’t be established.ECDSA key fingerprint is SHA256:xxxxxxxYvQTxxxxxxxxXgibtw.Are you sure you want to continue connecting (yes/no)? yes
default password raspberry
Linux gladys 4.14.30-v7+ #1102 SMP Mon Mar 26 16:45:49 BST 2018 armv7l
The programs included with the Debian GNU/Linux system are free software;the exact distribution terms for each program are described in theindividual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extentpermitted by applicable law.Last login: Sun Apr 8 12:51:13 2018 from 192.168.0.23
SSH is enabled and the default password for the ‘pi’ user has not been changed.This is a security risk – please login as the ‘pi’ user and type ‘passwd’ to set a new password.
Previous install remove installated ssh key
ssh-keygen -f « /root/.ssh/known_hosts » -R 192.168.1.99
source for further details on ssh connection https://the-raspberry.com/ssh-raspberry-pi
Update your Gladys install
/home/pi/rpi-update.sh
Install 433-868Mhz
if you want to DIY for cheap take an adruino uno and follow this tutorial.
If you want to buy a full built in device Buy RF Player RF1000 or a RfxCom
https://www.aeq-web.com/arduino-10mw-cc1101-ism-rf-transceiver/?lang=en
Install Heating
JST ZH 1.5mm 3-Pin Femelle
DS18B20 de la société DALLAS
http://www.touteladomotique.com/index.php?option=com_content&view=article&id=1820:fabriquer-une-sonde-de-temperature-pour-un-micromodule-qubino&catid=82:diy&Itemid=87
https://community.gladysproject.com/t/zwave-qubino-fil-pilote-pilotage-xiaomi-sensor/3664/41
Objectif Code une box Qubino
https://jsfiddle.net/LePetitGeek/803e2ud3/
GUI
mettre a disposition des utilisateurs le fait de pouvoir passer un mode a autre facilement
https://github.com/GladysProject/Gladys/blob/master/views/boxs/device-room.ejs
<div class="box-body ng-cloak"> <div ng-show="vm.selectRoom" class="ng-cloak"> <p>Choose the room you want to display in this box:</p> <div class="row"> <div class="col-xs-offset-2 col-xs-6"> <select ng-model="vm.selectedRoomId" class="form-control"> <option ng-repeat="room in vm.rooms" value="{{room.id}}">{{room.name}}</option> </select> </div> <div class="col-xs-2"> <button class="btn btn-success btn-flat" ng-click="vm.selectRoomId(vm.selectedRoomId);">Save</button> </div> </div> </div> <div ng-show="!vm.selectRoom"> <div class="table-responsive"> <table class="table"> <tbody> <tr ng-show="type.display" ng-repeat="type in vm.room.deviceTypes" class="ng-cloak"> <td> <span ng-show="{{type.deviceTypeName != null}}">{{type.deviceTypeName}}</span> <span ng-show="{{type.deviceTypeName == null}}">{{type.name}} <span ng-show="{{type.type != 'binary' && type.type.length}}"> - {{type.type}}</span></span> </td> <td> <!-- If the deviceType is a sensor, display last data --> <div ng-show="type.sensor == 1 && type.type != 'binary'">{{type.lastValue }} {{type.unit}}</div> <div ng-show="type.sensor == 1 && type.type == 'binary'"> <i ng-show="type.lastValue == 1" class="fa fa-circle" aria-hidden="true"></i> <i ng-show="type.lastValue == 0" class="fa fa-circle-o" aria-hidden="true"></i> </div> <!-- If the deviceType is not a sensor and is not a binary, display input field --> <form class="form-inline" ng-show="!type.sensor && type.type != 'binary'" > <slider id="blue" ng-model="type.lastValue" min="type.min" step="1" max="type.max" value="type.lastValue" ng-model-options='{ debounce: 100 }' ng-change="vm.changeValue(type, type.lastValue);" ></slider> </form> <!-- If the deviceType is not a sensor and is a binary, display toogle --> <div class="toogle" ng-click="vm.changeValue(type, !type.lastValue);"> <input type="checkbox" ng-show="!type.sensor && type.type == 'binary'" ng-model="type.lastValue" ng-true-value="1" ng-false-value="0" class="toogle-checkbox toogle-blue" /> <label class="toogle-label" for="mytoogle" ng-show="!type.sensor && type.type == 'binary'"></label> </div> </td> </tr> </tbody> </table> </div> </div> </div> </div>
Au niveau du modele
gladys.utils.sql(‘ SELECT device,type,category,tag,sensor,unit, min, max,lastValue FROM devicetype ‘)
.then((rows) => { console.log(rows); }) .catch((err) => { console.log(err); });Reponse dans pm2 logs
0|gladys | [ RowDataPacket { 0|gladys | device: 1, 0|gladys | type: 'zwave', 0|gladys | category: null, 0|gladys | tag: null, 0|gladys | sensor: 0, 0|gladys | unit: null, 0|gladys | min: 0, 0|gladys | max: 99, 0|gladys | lastValue: null } ]
Scripting sur Gladys
architecturalement parlant Gladys est bati sur une api /core et expose son model de donnée sur api/models
pour recuperer par exemple les event avec user associe on peut faire
gladys.utils.sql(' SELECT datetime,value,user FROM event ') .then((rows) => { console.log(rows); }) .catch((err) => { console.log(err); });
Appel aux module
C’est un peu pareil, par exemple prenons le module weather en lisant la doc ; la then => correspond a la promise donc au retour de api , sino ca plante
var options = { latitude: 45, longitude: 45 }; gladys.weather.get(options) .then((result) =>{ console.log(result.temperature); console.log(result.weather); console.log(result.humidity); }) .catch(console.log);
https://howtomechatronics.com/tutorials/arduino/arduino-wireless-communication-nrf24l01-tutorial/
Gladys gateway
La grande nouveauté ! La gateway clé en main gladys depuis extérieur
I noticed there was a main problem with Gladys: It’s easy to access your Raspberry Pi installation when you are at home, but when you are outside it’s hard to make Gladys publicly accessible without having security issues: bot trying to hack your Raspberry Pi, that kind of creepy stuff.
So I thought about it, and decided to build the Gladys Gateway: The first End-To-End Encrypted Gateway for Home Automation. It’s a web base UI accessible at gateway.gladysproject.com that allows you to control your Gladys instance from anywhere in the world, without having to open your local network to the public, so your Raspberry Pi stays safe.
https://gateway.gladysproject.com/login