﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tag Capteur - Constellation</title>
	<atom:link href="https://developer.myconstellation.io/tag/capteur/feed/" rel="self" type="application/rss+xml" />
	<link>https://developer.myconstellation.io/tag/capteur/</link>
	<description>Votre plateforme d&#039;interconnexion</description>
	<lastBuildDate>Thu, 13 Jun 2019 14:35:03 +0000</lastBuildDate>
	<language>fr-FR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.0.11</generator>

<image>
	<url>https://developer.myconstellation.io/wp-content/uploads/2016/02/256x256-e1457476015859.png</url>
	<title>Tag Capteur - Constellation</title>
	<link>https://developer.myconstellation.io/tag/capteur/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Créer une boite aux lettres connectée avec Constellation</title>
		<link>https://developer.myconstellation.io/showcases/creer-une-boite-aux-lettres-connectee-constellation/</link>
					<comments>https://developer.myconstellation.io/showcases/creer-une-boite-aux-lettres-connectee-constellation/#respond</comments>
		
		<dc:creator><![CDATA[Sebastien Warin]]></dc:creator>
		<pubDate>Wed, 27 Sep 2017 10:29:50 +0000</pubDate>
				<category><![CDATA[Showcases]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Capteur]]></category>
		<category><![CDATA[PushBullet]]></category>
		<category><![CDATA[Constellation]]></category>
		<category><![CDATA[smartphone]]></category>
		<category><![CDATA[Consumer]]></category>
		<category><![CDATA[Cordova]]></category>
		<category><![CDATA[Ionic]]></category>
		<category><![CDATA[IoT]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[ESP8266]]></category>
		<category><![CDATA[StateObject]]></category>
		<category><![CDATA[ESP]]></category>
		<category><![CDATA[MessageCallback]]></category>
		<guid isPermaLink="false">https://developer.myconstellation.io/?p=5519</guid>

					<description><![CDATA[<p>Projet réalisé par Judith Caroff, Jeanne Leclercq, Luc Fermaut, Pierre Hourdé, Jean-Baptiste Lavoine et Victorien Renault. Introduction Étudiants en 3ème année à l’ISEN-Lille, nous avons eu l’idée de développer une boîte aux lettres connectée en utilisant la plateforme Constellation. En</p>
<p>The post <a rel="nofollow" href="https://developer.myconstellation.io/showcases/creer-une-boite-aux-lettres-connectee-constellation/">Créer une boite aux lettres connectée avec Constellation</a> appeared first on <a rel="nofollow" href="https://developer.myconstellation.io">Constellation</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><em>Projet réalisé par Judith Caroff, Jeanne Leclercq, Luc Fermaut, Pierre Hourdé, Jean-Baptiste Lavoine et Victorien Renault.</em></p>
<h2>Introduction</h2>
<p>Étudiants en 3<sup>ème</sup> année à l’ISEN-Lille, nous avons eu l’idée de développer une boîte aux lettres connectée en utilisant la plateforme Constellation.</p>
<p>En réalisant ce projet, nous voulions proposer une solution de boîte aux lettres connectée à un prix raisonnable et possédant une interface fluide pour améliorer l’expérience de l’utilisateur. Pour cela, nous avons acheté des composants peu coûteux à placer sur notre boîte aux lettres, et développé une application Ionic.</p>
<p align="center"><a href="https://developer.myconstellation.io/wp-content/uploads/2017/09/Schma-de-prsentation.png"><img class="colorbox-5519"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="Schéma de fonctionnement global de notre boîte aux lettres" src="https://developer.myconstellation.io/wp-content/uploads/2017/09/Schma-de-prsentation_thumb.png" alt="Schéma de fonctionnement global de notre boîte aux lettres" width="450" height="225" border="0" /></a></p>
<p>Notre boîte aux lettres est connectée à la plateforme Constellation par le biais d’un ESP8266, vous pouvez le connecter facilement à votre Constellation en suivant <a href="https://developer.myconstellation.io/getting-started/connecter-un-arduino-ou-un-esp8266-constellation/">cette documentation sur le site Constellation</a>.</p>
<p>Nous détectons ensuite la présence de courriers à l’aide de capteurs à ultrasons.</p>
<p>Avec un lecteur de cartes NFC, nous contrôlons l’accès à notre boîte aux lettres. Celui-ci nous permet de savoir qui a ouvert la boîte aux lettres et donc d’envoyer les bonnes informations à notre Constellation. Le lecteur NFC nous permet également de vérifier qu’une carte ou qu’un badge a les autorisations nécessaires afin de commander l’ouverture via un servo-moteur.</p>
<p>L’application, développée avec le framework ionic nous permet d’offrir une interface utilisateur ergonomique. En la connectant à Constellation, l’utilisateur a accès à toutes les informations nécessaires très facilement.</p>
<h2>La boîte aux lettres connectée</h2>
<p><i>Prérequis : Avoir connecté l’ESP8266 à Constellation.</i></p>
<h3>Composants utilisés</h3>
<p>Pour connecter notre boîte aux lettres à Constellation, nous avons utilisé :</p>
<ul>
<li>Un ESP8266 D1 Mini (8€ sur Amazon)</li>
<li>Des capteurs à ultrasons HC SR04 (3€ sur Amazon)</li>
<li>Un lecteur de cartes NFC (8€ sur Amazon)</li>
<li>Un servo-moteur (6€ sur eBay)</li>
</ul>
<p>Voici la correspondance pour définir les différents pins avec cet ESP :</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top">D0</td>
<td valign="top">D1</td>
<td valign="top">D2</td>
<td valign="top">D3</td>
<td valign="top">D4</td>
<td valign="top">D5</td>
<td valign="top">D6</td>
<td valign="top">D7</td>
<td valign="top">D8</td>
<td valign="top">RX</td>
<td valign="top">TX</td>
</tr>
<tr>
<td valign="top">16</td>
<td valign="top">5</td>
<td valign="top">4</td>
<td valign="top">0</td>
<td valign="top">2</td>
<td valign="top">14</td>
<td valign="top">12</td>
<td valign="top">13</td>
<td valign="top">15</td>
<td valign="top">3</td>
<td valign="top">1</td>
</tr>
</tbody>
</table>
<h3>Etape 1 : Détecter la présence d’une lettre grâce à un capteur ultrason</h3>
<p><i>Nos capteurs fonctionnent avec une alimentation de 5V</i><i></i></p>
<p>Les capteurs à ultrasons nous permettent de mesurer une distance en créant une impulsion sur une des broches. Grâce à cette mesure, nous pouvons détecter une variation de la distance lorsqu’un courrier et inséré dans la boîte aux lettres. Nous envoyons alors l’information à Constellation grâce à un MessageCallback.</p>
<p align="center"><a href="https://developer.myconstellation.io/wp-content/uploads/2017/09/capteur-ultrason.jpg"><img class="colorbox-5519"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="Capteur ultrason" src="https://developer.myconstellation.io/wp-content/uploads/2017/09/capteur-ultrason_thumb.jpg" alt="Capteur ultrason" width="300" height="136" border="0" /></a></p>
<p>Relier le capteur à notre ESP est assez simple, notre capteur à ultrasons possède 4 branches, chacune branchée sur un pin de notre ESP.</p>
<p>Ci-dessous, les correspondances entre les branches du capteur à ultrasons et les pins de l’ESP8266 :</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="63%">
<p style="text-align: left;">Branche du capteur à ultrasons</p>
</td>
<td valign="top" width="36%">Pin de l’ESP8266</td>
</tr>
<tr>
<td valign="top" width="63%">VCC</td>
<td valign="top" width="36%">5V</td>
</tr>
<tr>
<td valign="top" width="63%">GND</td>
<td valign="top" width="36%">GND</td>
</tr>
<tr>
<td valign="top" width="63%">TRIG</td>
<td valign="top" width="36%">D4</td>
</tr>
<tr>
<td valign="top" width="63%">ECHO</td>
<td valign="top" width="36%">D3</td>
</tr>
</tbody>
</table>
<p style="text-align: center;" align="center"><a href="https://developer.myconstellation.io/wp-content/uploads/2017/09/Module-ultrasons.png"><img class="colorbox-5519"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="Module à ultrasons connecté à notre ESP8266" src="https://developer.myconstellation.io/wp-content/uploads/2017/09/Module-ultrasons_thumb.png" alt="Module à ultrasons connecté à notre ESP8266" width="354" height="205" border="0" /></a></p>
<p style="text-align: left;">Dans notre code, nous configurons les pins dans le setup afin de préparer l’impulsion.</p>
<p></p><pre class="crayon-plain-tag">void setup() {
   pinMode(TRIGGER, OUTPUT);
   digitalWrite(TRIGGER, LOW); //La broche TRIGGER doit être à LOW au repos
   pinMode(ECHO, INPUT);
   Serial.begin(9600);
 }</pre><p></p>
<p style="text-align: left;">Nous envoyons ensuite de façon continue des impulsions pour savoir si un obstacle est présent puis, s’il y en a un, nous envoyons un Message Callback.</p>
<p></p><pre class="crayon-plain-tag">void loop() {    
    /* 1. Lance une mesure de distance en envoyant une impulsion HIGH de 10 µs sur la broche TRIGGER */
   digitalWrite(TRIGGER, HIGH);
   delayMicroseconds(10);
   digitalWrite(TRIGGER, LOW);
   
   /* 2. Mesure le temps entre l'envoi de l'impulsion ultrasonore et son écho (s'il existe) */
   long measure = pulseIn(ECHO, HIGH);                
                                                                                 
   /* 3. Calcul la distance à partir du temps mesuré */
   long distanceMeasured = measure *vitesse ;
  
   /* 4. Envoie d'un MessageCallback à Constellation si on rentre dans le if */ 
   if(distanceMeasured &lt; defaultValue){
     constellation.sendMessage(Package, "Brain", "message");
   }
}</pre><p></p>
<p style="text-align: center;"><img loading="lazy" class="size-full wp-image-5527 aligncenter colorbox-5519" src="https://developer.myconstellation.io/wp-content/uploads/2017/09/video1-2-gap.jpg" data-gif="https://developer.myconstellation.io/wp-content/uploads/2017/09/video1-2.gif" alt="" width="196" height="350" /></p>
<h3 style="text-align: left;">Etape 2 : Gérer les accès à la boîte aux lettres grâce à un lecteur de carte NFC</h3>
<p style="text-align: left;">Dans cette partie, nous allons envoyer un Message Callback à Constellation grâce à l’ID du badge NFC détecté par notre lecteur de cartes.</p>
<p style="text-align: left;">Cela nous permettra par la suite de gérer les autorisations d’accès à la boîte aux lettres, de contrôler l’ouverture par notre servo-moteur, et d’avertir l’utilisateur qu’un colis a été livré ou que le courrier a été récupéré. Nous devrons donc enregistrer les différents utilisateurs en renseignant leur ID de badge et leur statut (facteur ou utilisateur).</p>
<p style="text-align: left;">Voici le câblage réalisé pour cette partie entre le NFC et l’ESP :</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="49%">Branche du NFC</td>
<td valign="top" width="50%">Pin de l’ESP8266</td>
</tr>
<tr>
<td valign="top" width="49%">RST</td>
<td valign="top" width="50%">D1</td>
</tr>
<tr>
<td valign="top" width="49%">SDA(SS)</td>
<td valign="top" width="50%">D2</td>
</tr>
<tr>
<td valign="top" width="49%">MOSI</td>
<td valign="top" width="50%">D7</td>
</tr>
<tr>
<td valign="top" width="49%">MISO</td>
<td valign="top" width="50%">D6</td>
</tr>
<tr>
<td valign="top" width="49%">SCK</td>
<td valign="top" width="50%">D5</td>
</tr>
<tr>
<td valign="top" width="49%">GND</td>
<td valign="top" width="50%">GND</td>
</tr>
<tr>
<td valign="top" width="49%">3.3 V</td>
<td valign="top" width="50%">3.3 V</td>
</tr>
</tbody>
</table>
<p style="text-align: center;"><a href="https://developer.myconstellation.io/wp-content/uploads/2017/09/Lecteur-NFC.png"><img class="colorbox-5519"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="Lecteur NFC connecté à notre ESP8266" src="https://developer.myconstellation.io/wp-content/uploads/2017/09/Lecteur-NFC_thumb.png" alt="Lecteur NFC connecté à notre ESP8266" width="354" height="183" border="0" /></a></p>
<p style="text-align: left;">Il faut commencer par télécharger la bibliothèque suivante :</p>
<p style="text-align: center;" align="center"><a href="https://developer.myconstellation.io/wp-content/uploads/2017/09/bibliothque-arduino-1.png"><img class="colorbox-5519"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="bibliothèque arduino 1" src="https://developer.myconstellation.io/wp-content/uploads/2017/09/bibliothque-arduino-1_thumb.png" alt="bibliothèque arduino 1" width="354" height="71" border="0" /></a></p>
<p style="text-align: left;">Voici ensuite la fonction nécessaire à l’envoi d’un Message Callback lorsque nous captons un nouveau badge.</p>
<p></p><pre class="crayon-plain-tag">void NFC() {
    // Regarde s'il y a une nouvelle carte, s'il n'y en a pas on quitte la fonction
    if ( ! mfrc522.PICC_IsNewCardPresent()) {
        return;
    }
    // S'il n'arrive pas à lire la carte on quitte la fonction
    if ( ! mfrc522.PICC_ReadCardSerial()) {
        return;
    }
    char sochar[256]; // 256 correspond à un octet
    String UID= dump_byte_array(mfrc522.uid.uidByte, mfrc522.uid.size); 
    /* Permet de transformer un tableau de bit en String */
    UID.toCharArray(sochar, 256);
    constellation.sendMessage(Package, "Brain", "Authorisation", sochar); /* envoie un message Callback du package Brain appelé Authorisation*/
}</pre><p></p>
<h3 style="text-align: left;">Etape 3 : Ouvrir et fermer la porte grâce à un servo-moteur</h3>
<p style="text-align: left;">Le servomoteur va nous servir à commander notre verrou. Ce dernier va donc s’abonner à un State Object nous donnant l’état de la porte (verrouillée ou déverrouillée). Ainsi, lorsque notre lecteur NFC captera un ID autorisé, notre State Object changera, ainsi que l’état de verrouillage de la porte.</p>
<p style="text-align: left;">Voici les branchements qui relient notre moteur à l’ESP :</p>
<table class=" aligncenter" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="59%">PIN DU MOTEUR</td>
<td valign="top" width="40%">Pin de l’ESP8266</td>
</tr>
<tr>
<td valign="top" width="59%">5 V (câble orange)</td>
<td valign="top" width="40%">5 V</td>
</tr>
<tr>
<td valign="top" width="59%">GND (câble marron)</td>
<td valign="top" width="40%">GND</td>
</tr>
<tr>
<td valign="top" width="59%">Commande (câble jaune)</td>
<td valign="top" width="40%">D8</td>
</tr>
</tbody>
</table>
<p style="text-align: left;">Avant d’utiliser le code ci-dessous, il faut vérifier que vous avez bien installé les bibliothèques suivantes :</p>
<p style="text-align: center;" align="center"><a href="https://developer.myconstellation.io/wp-content/uploads/2017/09/bibliothque-arduino-2.png"><img class="colorbox-5519"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="bibliothèque arduino 2" src="https://developer.myconstellation.io/wp-content/uploads/2017/09/bibliothque-arduino-2_thumb.png" alt="bibliothèque arduino 2" width="354" height="128" border="0" /></a></p>
<p style="text-align: left;">Dans le Setup ci-dessous, nous nous abonnons à un StateObject qui nous permet d’ouvrir et de fermer la porte lorsqu’il change d’état.</p>
<p></p><pre class="crayon-plain-tag">void setup() {
    monServo.attach(15); // Définit le moteur au D8
    monServo.write(0); // ServoMoteur à sa position initiale
    constellation.registerStateObjectLink("*", "Brain", "Porte_ouverte", [](JsonObject&amp; so) {
     delay(100); // délai afin d'attendre la connexion à  Constellation
     if (so["Value"]== true){   
       monServo.write(90);  // Position de la porte ouverte
       }
 
    if (so["Value"]== false){
       monServo.write(0);   // Position de la porte fermée
       }
       delay(3000); // attendre au minimum 3 secs avant que la porte ne change d'état.
   });  
 }</pre><p></p>
<p style="text-align: center;"><img loading="lazy" class="alignnone size-full wp-image-5528 aligncenter colorbox-5519" src="https://developer.myconstellation.io/wp-content/uploads/2017/09/video2-2-gap.jpg" data-gif="https://developer.myconstellation.io/wp-content/uploads/2017/09/video2-2.gif" alt="" width="196" height="350" /></p>
<h3 style="text-align: left;">Etape 4 : Synchroniser toutes nos parties avec un package Constellation</h3>
<p style="text-align: left;">Vous pouvez retrouver notre code complet pour la boîte aux lettres sur GitHub pour plus de précision (<a href="https://l.facebook.com/l.php?u=https%3A%2F%2Fgithub.com%2FSqyluck%2FBoite-aux-lettres-connectee&amp;h=ATO-A7kid-AyGmrtD0hCDSOEWcwWMsyF8aAuEcrDY3b1Q9b-_NEMOnsJ9DOWADshjfo8FwRAmqfoT5MoHe3RwBJ1U_2af1vgeNd_XHbk_4LNVdA4-AYBgC-v6mcC5YakbL12cgMSWJFFBA">https://github.com/Sqyluck/Boite-aux-lettres-connectee</a>).</p>
<p style="text-align: left;">Il est ensuite nécessaire de créer un package Constellation, qui va nous permettre de traiter toutes les données de nos différents éléments.</p>
<p style="text-align: left;">→ Voici les différents Message Callbacks créent dans le package afin de répondre à nos besoins.</p>
<p style="text-align: center;" align="center"><a href="https://developer.myconstellation.io/wp-content/uploads/2017/09/Message-Callbacks.png"><img class="colorbox-5519"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="Message Callbacks" src="https://developer.myconstellation.io/wp-content/uploads/2017/09/Message-Callbacks_thumb.png" alt="Message Callbacks" width="354" height="357" border="0" /></a></p>
<p style="text-align: left;">→ Voici la liste des State Objects générés par le package pour permettre l’affichage de nos données dans l’application et l’envoi d’ordre au servomoteur via l’ESP8266.</p>
<p style="text-align: center;" align="center"><a href="https://developer.myconstellation.io/wp-content/uploads/2017/09/State-Objects.png"><img class="colorbox-5519"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="State Objects" src="https://developer.myconstellation.io/wp-content/uploads/2017/09/State-Objects_thumb.png" alt="State Objects" width="354" height="166" border="0" /></a></p>
<h3 style="text-align: left;">Etape 5 : Fabrication de la boîte aux lettres</h3>
<p style="text-align: left;">Nous avons utilisé des planches en bois afin de réaliser notre boîte aux lettres. Nous avons vissé les planches entre elles, puis nous avons fixé nos éléments sous le toit de la boîte.</p>
<p style="text-align: center;" align="center"><a href="https://developer.myconstellation.io/wp-content/uploads/2017/09/Visuel-boite-au-lettre-extrieur.jpg"><img class="colorbox-5519"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="Visuel boite au lettre extérieur" src="https://developer.myconstellation.io/wp-content/uploads/2017/09/Visuel-boite-au-lettre-extrieur_thumb.jpg" alt="Visuel boite au lettre extérieur" width="254" height="310" border="0" /></a></p>
<p style="text-align: center;" align="center"><a href="https://developer.myconstellation.io/wp-content/uploads/2017/09/Visuel-boite-au-lettre-composants.jpg"><img class="colorbox-5519"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="Visuel boite au lettre composants" src="https://developer.myconstellation.io/wp-content/uploads/2017/09/Visuel-boite-au-lettre-composants_thumb.jpg" alt="Visuel boite au lettre composants" width="223" height="244" border="0" /></a> <a href="https://developer.myconstellation.io/wp-content/uploads/2017/09/Visuel-boite-au-lettre-intrieur.jpg"><img class="colorbox-5519"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="Visuel boite au lettre intérieur" src="https://developer.myconstellation.io/wp-content/uploads/2017/09/Visuel-boite-au-lettre-intrieur_thumb.jpg" alt="Visuel boite au lettre intérieur" width="207" height="244" border="0" /></a></p>
<p style="text-align: center;" align="center"><a href="https://developer.myconstellation.io/wp-content/uploads/2017/09/Schma-composants.png"><img class="colorbox-5519"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="Schéma composants" src="https://developer.myconstellation.io/wp-content/uploads/2017/09/Schma-composants_thumb.png" alt="Schéma composants" width="450" height="232" border="0" /></a></p>
<h2 style="text-align: left;">L’interface utilisateur</h2>
<p style="text-align: left;"><i>Prérequis : disposer de Node.js et de npm</i></p>
<h3 style="text-align: left;">Etape 1 : Créer une application avec ionic</h3>
<p style="text-align: left;">Afin de réaliser notre interface utilisateur, nous avons décidé dans un premier temps de développer notre application avec Ionic 2 dans Visual Studio. Mais avec cette méthode nous étions obligé de développer notre application en langage typescript ce qui était plus compliqué pour connecter l’application à la plateforme Constellation. Nous avons donc décidé d’utiliser Ionic 1 afin de développer notre application en javascript et de la connecter plus facilement.</p>
<p style="text-align: left;">Avant de commencer, il faut lancer l’installation de Ionic 1 depuis l’invite de commande :</p>
<p></p><pre class="crayon-plain-tag">npm install – g cordova ionic</pre><p></p>
<p style="text-align: left;"><i>(Attention : cette commande ne fonctionnera pas si vous ne disposez pas auparavant de node.js et de npm)</i><i></i></p>
<p style="text-align: left;">Une fois que nous nous sommes placé dans le dossier dans lequel nous souhaitons développer notre application, nous pouvons utiliser la commande suivante pour lancer la création d’un nouveau projet.</p>
<p></p><pre class="crayon-plain-tag">ionic start myApp tabs --type ionic1</pre><p></p>
<p style="text-align: left;"><i>(Nous venons ici de créer un nouveau projet ionic 1 de type tabs intitulé myApp)</i></p>
<p style="text-align: left;">Dans l’invite de commande, placez-vous dans le dossier de l’application (en utilisant la commande cd).</p>
<p style="text-align: left;">La commande ionic serve permet d’exécuter l’application dans un navigateur.</p>
<p style="text-align: left;">Lorsque le projet est créé, vous devez éditer vos différentes pages (par ex. sur Notepad++). Les fichiers à modifier se trouvent dans le dossier « www » :</p>
<ul style="text-align: left;">
<li>Le fichier index.html</li>
<li>Les fichiers .html appartenant au dossier “templates” → C’est ici que vous pouvez modifier le contenu de chaque page de votre application.</li>
<li>Le fichier app.js dans le dossier “js” → Vous devez définir votre constellation à cet endroit.</li>
<li>Le fichier controllers.js dans le dossier “js” → Chaque controller est associé à une page html. Vous pouvez utiliser les variables et les fonctions définies dans ces pages grâce aux “Scopes”.</li>
</ul>
<h3 style="text-align: left;">Etape 2 : Visualiser notre application sur un smartphone</h3>
<p style="text-align: left;">Si vous souhaitez utiliser votre application sur votre smartphone, vous pouvez utiliser l’application “ionic view” disponible sur l’App Store et Google Play. Cette application vous permettra de visualiser directement l’application que vous êtes en train de développer sur votre smartphone.</p>
<p style="text-align: left;">Une fois l’application installée, vous devez ensuite vous rendre <a href="https://apps.ionic.io/apps/">sur ce site</a>, créer un compte, puis cliquez sur “New App”. Il ne vous reste plus qu’à faire le lien avec votre application et l’envoyer sur votre appareil. Pour cela, dans le dossier de votre application, utilisez les deux commandes suivantes dans votre invite de commande</p>
<p></p><pre class="crayon-plain-tag">ionic link 
ionic upload</pre><p></p>
<p style="text-align: left;">Ouvrez ensuite ionic view et visualisez votre application.</p>
<p style="text-align: left;">Vous pouvez également, après avoir branché votre téléphone et avoir activé le mode debug, utiliser la commande cordova run android afin de simuler directement votre application sur votre téléphone android.</p>
<h3 style="text-align: left;">Etape 3 : Connecter notre application à constellation</h3>
<p style="text-align: left;">Afin de connecter notre application à la plateforme constellation, nous allons modifier le fichier app.js ainsi que le index.html.</p>
<p style="text-align: left;">Pour cela, nous allons importer les bibliothèques suivantes dans le fichier index.html :</p>
<ul style="text-align: left;">
<li>jquery-2.2.4.min.js</li>
<li>jquery.signalr-2.2.1.min.js</li>
<li>Constellation-1.8.1.min.js</li>
<li>ngConstellation-1.8.1.min.js</li>
</ul>
<p style="text-align: left;">Les librairies sont disponibles sur cette <a href="http://cdn.myconstellation.io/js/">page</a>. Nous vous conseillons de créer un dossier intitulé constellation dans le dossier « lib » et d’y enregistrer ces différentes bibliothèques.</p>
<p style="text-align: left;">Il ne vous restera plus qu’à ajouter les lignes de code suivantes dans le fichier index.html :</p>
<p></p><pre class="crayon-plain-tag">&lt;script type="text/javascript" src="lib/constellation/jquery-2.2.4.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="lib/constellation/jquery.signalr-2.2.1.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="lib/constellation/Constellation-1.8.1.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="lib/constellation/ngConstellation-1.8.1.min.js"&gt;&lt;/script&gt;</pre><p></p>
<p style="text-align: left;">Puis nous allons ajouter le code suivant à notre fichier app.js :</p>
<p style="text-align: left;">1. Modifier la ligne angular.module, y ajouter ‘ngConstellation’ comme ci-dessous :</p>
<p></p><pre class="crayon-plain-tag">angular.module('starter', ['ionic', 'starter.controllers', 'ngConstellation'])</pre><p></p>
<p style="text-align: left;">2. Modifier la fonction .run, y ajouter $rootScope et constellationConsumer :</p>
<p></p><pre class="crayon-plain-tag">.run(function($ionicPlatform, $rootScope, constellationConsumer)</pre><p></p>
<p style="text-align: left;">3. Ajouter le code suivant dans la fonction .run :</p>
<p></p><pre class="crayon-plain-tag">constellationConsumer.initializeClient("http://192.168.43.171:8088", "123456789", "Application Ionic");
    constellationConsumer.onConnectionStateChanged(function (change) {
        if (change.newState === $.signalR.connectionState.connected) {
            console.log("Connecté à constellation");
            $rootScope.isConnected = true;
        }
    });
    constellationConsumer.connect();
    $rootScope.constellation = constellationConsumer;</pre><p></p>
<p style="text-align: left;">Vous pouvez maintenant vérifier que vous êtes bien connecté à votre constellation en regardant dans votre console (f12 dans votre navigateur).</p>
<h3 style="text-align: left;">Etape 4 : Connecter notre application à la boîte aux lettres</h3>
<p style="text-align: left;">Un certain nombre de State Objects et de Message Callbacks ont été réalisés dans notre package constellation afin de traiter nos différentes informations (ce package est disponible sur gitHub).</p>
<p style="text-align: left;">Le rôle de notre application ici est simplement de s’abonner aux State Objects et d’envoyer des messages Callbacks à notre constellation.</p>
<p style="text-align: left;">→ <b>Exemple de récupération d’un State Object</b> :</p>
<p style="text-align: left;">Les StateObjects se récupèrent dans le fichier app.js, à l’endroit où nous avons défini notre constellation. Voici un exemple de code correspondant à notre State Object « Users » :</p>
<p></p><pre class="crayon-plain-tag">//State Object Utilisateurs
constellationConsumer.registerStateObjectLink("*", "Brain", "Users", "*", function(so) {
    $rootScope.Users = so.Value;
    $rootScope.$apply();
});</pre><p></p>
<p style="text-align: left;">Pour afficher nos utlisateurs, il nous suffit maintenant, dans notre page html d’utiliser le code suivant :</p>
<p></p><pre class="crayon-plain-tag">&lt;ion-item ng-repeat="user in Users"&gt;
  &lt;h2&gt;{{user.firstName}} {{user.name}}&lt;/h2&gt;
  &lt;p&gt;{{user.client ? "client":"facteur"}}&lt;/p&gt;
&lt;/ion-item&gt;</pre><p></p>
<p style="text-align: left;">→ <b>Exemple d’envoi d’un message Callback</b> :</p>
<p style="text-align: left;">Les messages Callbacks s’envoient dans le fichier controllers.js. Voici l’exemple de code pour le Message Callback « DeleteUser » :</p>
<p></p><pre class="crayon-plain-tag">//Message CallBack DeleteUser
$scope.name = $stateParams.name
$scope.firstName = $stateParams.firstName;
$scope.deleteUser = function() {
    var deleteUser = $ionicPopup.confirm({
      title: 'Supprimer cet utilisateur',
      template: 'Etes vous sur de vouloir supprimer cet utilisateur ?'
    });
    deleteUser.then(function(res) {
      if(res) {
          $rootScope.constellation.sendMessage({ Scope: 'Package', Args: ['Brain'] }, 'DeleteUser', [$scope.firstName, $scope.name ]);
          $state.go('tab.utilisateurs');
          console.log('deleted');
      } 
      else {
          console.log('do nothing');
      }
    });
};</pre><p></p>
<p style="text-align: left;">Dans notre page html, on appelle maintenant la fonction créée dans notre controller.js dans un bouton par exemple :</p>
<p></p><pre class="crayon-plain-tag">&lt;button ng-click="deleteUser()"&gt;Supprimer cet utilisateur&lt;/button&gt;</pre><p></p>
<p style="text-align: left;">En vous servant de cette base, vous pouvez réaliser une application vous permettant de recevoir un message sur votre application lorsque vous recevez un courrier ou un colis mais aussi d’ajouter ou de supprimer des accès à la boite aux lettres.</p>
<p style="text-align: center;"><img loading="lazy" class="alignnone size-full wp-image-5530 aligncenter colorbox-5519" src="https://developer.myconstellation.io/wp-content/uploads/2017/09/video3-2-gap.jpg" data-gif="https://developer.myconstellation.io/wp-content/uploads/2017/09/video3-2.gif" alt="" width="196" height="350" /></p>
<p style="text-align: left;">Il est également possible de réutiliser des packages existants, par exemple, nous nous sommes servis du package PushBullet afin de recevoir des notifications sur notre smartphone.</p>
<p style="text-align: left;">Voici un aperçu de notre application ionic :</p>
<p style="text-align: center;" align="center"><a href="https://developer.myconstellation.io/wp-content/uploads/2017/09/notifications.png"><img class="colorbox-5519"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="notifications" src="https://developer.myconstellation.io/wp-content/uploads/2017/09/notifications_thumb.png" alt="notifications" width="150" height="295" border="0" /></a><a href="https://developer.myconstellation.io/wp-content/uploads/2017/09/paramtres.png"><img class="colorbox-5519"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="paramètres" src="https://developer.myconstellation.io/wp-content/uploads/2017/09/paramtres_thumb.png" alt="paramètres" width="150" height="295" border="0" /></a><a href="https://developer.myconstellation.io/wp-content/uploads/2017/09/utilisateurs.png"><img class="colorbox-5519"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="utilisateurs" src="https://developer.myconstellation.io/wp-content/uploads/2017/09/utilisateurs_thumb.png" alt="utilisateurs" width="150" height="295" border="0" /></a></p>
<p>The post <a rel="nofollow" href="https://developer.myconstellation.io/showcases/creer-une-boite-aux-lettres-connectee-constellation/">Créer une boite aux lettres connectée avec Constellation</a> appeared first on <a rel="nofollow" href="https://developer.myconstellation.io">Constellation</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://developer.myconstellation.io/showcases/creer-une-boite-aux-lettres-connectee-constellation/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Créer un capteur de température, humidité et luminosité connecté</title>
		<link>https://developer.myconstellation.io/tutorials/creer-un-capteur-de-temperature-humidite-et-luminosite-connecte/</link>
					<comments>https://developer.myconstellation.io/tutorials/creer-un-capteur-de-temperature-humidite-et-luminosite-connecte/#respond</comments>
		
		<dc:creator><![CDATA[Sebastien Warin]]></dc:creator>
		<pubDate>Wed, 10 May 2017 15:55:52 +0000</pubDate>
				<category><![CDATA[Tutoriels]]></category>
		<category><![CDATA[StateObject]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[AngularJS]]></category>
		<category><![CDATA[ESP8266]]></category>
		<category><![CDATA[Capteur]]></category>
		<category><![CDATA[DHT11]]></category>
		<guid isPermaLink="false">https://developer.myconstellation.io/?p=4588</guid>

					<description><![CDATA[<p>Dans ce tutoriel créons un capteur de température, d’humidité et de luminosité connecté avec une page Web de visualisation des données en temps réel. Prérequis Un Arduino connecté ou un ESP8266 Des capteurs (DHT11 pour l’humidité et la température, un TSL2561</p>
<p>The post <a rel="nofollow" href="https://developer.myconstellation.io/tutorials/creer-un-capteur-de-temperature-humidite-et-luminosite-connecte/">Créer un capteur de température, humidité et luminosité connecté</a> appeared first on <a rel="nofollow" href="https://developer.myconstellation.io">Constellation</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Dans ce tutoriel créons un capteur de température, d’humidité et de luminosité connecté avec une page Web de visualisation des données en temps réel.</p>
<p align="center"><a href="https://developer.myconstellation.io/wp-content/uploads/2017/05/image-52.png"><img loading="lazy" class=" colorbox-4588" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="Capteur connecté" src="https://developer.myconstellation.io/wp-content/uploads/2017/05/image_thumb-52.png" alt="Capteur connecté" width="399" height="248" border="0" /></a><a href="https://developer.myconstellation.io/wp-content/uploads/2017/05/image-55.png"><img loading="lazy" class=" colorbox-4588" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="image" src="https://developer.myconstellation.io/wp-content/uploads/2017/05/image_thumb-55.png" alt="image" width="271" height="248" border="0" /></a></p>
<h3>Prérequis</h3>
<ul>
<li>Un Arduino connecté ou un ESP8266</li>
<li>Des capteurs (DHT11 pour l’humidité et la température, un TSL2561 pour la luminosité par exemple)</li>
<li>Un serveur Constellation</li>
</ul>
<h3>Etape 1 : le montage</h3>
<p>Ici nous utiliserons un D1 Mini Pro (ESP8266) avec un capteur DHT11 combinant la mesure de la température et de l’humidité ainsi qu&rsquo;un capteur TSL2561 pour la luminosité.</p>
<p>Les deux capteurs seront alimentés en 3,3v par la D1 Mini.</p>
<p>Le TSL2561 dispose d’une interface I²C (SDA et SDL qu’on connectera sur D1 et D2) et le DHT11 n’a besoin que d’une entrée digitale (qu’on connectera sur D3).</p>
<h3>Etape 2 : la programmation</h3>
<p>Pour démarrer vous devez dans Constellation déclarer une sentinelle associée à une clé d’accès et un package virtuel. Ici notre ESP8266 est représenté par la sentinelle nommée “ESP8266” et le package virtuel se nomme “MySensor”.</p>
<p>Dans l’Arduino IDE, nous créons un nouveau projet à partir du Starter Kit Constellation pour ESP8266 dans lequel nous allons définir le nom de notre réseau Wifi (SSID) ainsi que sa clé d’accès  puis nous configurerons le client Constellation en spécifiant l’identité de notre package virtuel, sa clé d’accès et l’adresse/port de notre serveur Constellation :</p>
<p></p><pre class="crayon-plain-tag">// ESP8266 Wifi
#include &lt;ESP8266WiFi.h&gt;
char ssid[] = "MON SSID";
char password[] = "macléWifi!!!!";

// Constellation client
Constellation&lt;WiFiClient&gt; constellation("X.X.X.X", 8088, "ESP8266", "MySensor", "xxxxxxxxxxxxxxxxx")</pre><p></p>
<p>Encore une fois si tout cela est nouveau pour vous, je vous recommande <a href="/getting-started/connecter-un-arduino-ou-un-esp8266-constellation/">de suivre ce guide d’introduction à l’API Constellation pour Arduino/ESP8266</a>.</p>
<p>Lancez maintenant le « gestionnaire de bibliothèque » (menu <i>Croquis &gt; Inclure une bibliothèque &gt; Gérer les bibliothèques</i>) et installez les bibliothèques suivantes :</p>
<ul>
<li>Adafruit Unified Sensor (par Adafruit)</li>
<li>DHT Sensor library (par Adafruit)</li>
<li>Adafruit TSL2561 (par Adafruit)</li>
</ul>
<p>Une fois les librairies installées, ajoutez en entête de votre code :</p>
<p></p><pre class="crayon-plain-tag">#include &lt;Adafruit_TSL2561_U.h&gt;
#include &lt;DHT_U.h&gt;
#include &lt;Wire.h&gt;</pre><p></p>
<p>Déclarez ensuite, juste après la déclaration du client Constellation, le capteur TSL2561 et le DHT11 par les lignes :</p>
<p></p><pre class="crayon-plain-tag">DHT_Unified dht(D3, DHT11);
Adafruit_TSL2561_Unified tsl(TSL2561_ADDR_FLOAT);</pre><p></p>
<p>Déclarez également un entier pour définir l’intervalle de temps (en ms) entre deux mesures que nous fixons à 10 secondes par défaut :</p>
<p></p><pre class="crayon-plain-tag">int interval = 10000; //ms</pre><p></p>
<p>Dans la méthode « <em>setup()</em> » configurez les I/O utilisés par l’I²C (D1 et D2 dans notre cas) :</p>
<p></p><pre class="crayon-plain-tag">Wire.begin(D1, D2);</pre><p></p>
<p>Initialisez ensuite le capteur DHT11 par la ligne :</p>
<p></p><pre class="crayon-plain-tag">dht.begin();</pre><p></p>
<p>Puis le capteur TSL2561 :</p>
<p></p><pre class="crayon-plain-tag">if(!tsl.begin())
{
  Serial.print("No TSL2561 detected!");
  while(1);
}
tsl.enableAutoRange(true);
tsl.setIntegrationTime(TSL2561_INTEGRATIONTIME_13MS);</pre><p></p>
<p>Toujours dans la méthode «<em> setup</em> », récupérons les settings de notre package sur Constellation et affectons le setting « Interval » si défini sur Constellation (autrement c’est la valeur de 10 secondes déclarée ci-dessus qui sera utilisée) :</p>
<p></p><pre class="crayon-plain-tag">JsonObject&amp; settings = constellation.getSettings();
if(settings.containsKey("Interval")) {
  interval = settings["Interval"].as&lt;int&gt;();
}</pre><p></p>
<p>Pour finir dans la boucle principale, nous allons prendre les mesures de nos capteurs et publier trois StateObjects avec une durée de vie de deux fois l’intervalle de temps :</p>
<p></p><pre class="crayon-plain-tag">void loop(void) {
  constellation.loop();
  static int lastBeat = 0;
  if(millis() - lastBeat &gt; interval) {
    lastBeat = millis();
    sensors_event_t event;
    // Luminosité
    tsl.getEvent(&amp;event);
    if (event.light) {
      constellation.pushStateObject("Light", event.light, interval * 2);
    }  
    // Temperature
    dht.temperature().getEvent(&amp;event);
    if (!isnan(event.temperature)) {
      constellation.pushStateObject("Temperature", event.temperature, interval * 2);
    }
    // Humidité
    dht.humidity().getEvent(&amp;event);
    if (!isnan(event.relative_humidity)) {
      constellation.pushStateObject("Humidity", event.relative_humidity, interval * 2);
    }
  }
}</pre><p></p>
<p><strong>Et voilà votre capteur connecté est prêt !</strong></p>
<p>Il ne reste plus qu’à téléverser votre programme et ouvrir votre Console Constellation pour constater qu’il est bien opérationnel :</p>
<p align="center"><a href="https://developer.myconstellation.io/wp-content/uploads/2017/05/image-53.png"><img class="colorbox-4588"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" src="https://developer.myconstellation.io/wp-content/uploads/2017/05/image_thumb-53.png" alt="image" width="404" height="149" border="0" /></a></p>
<p>Ouvrez maintenant le <a href="/constellation-platform/constellation-console/stateobjects-explorer/">StateObject Explorer</a> et rechercher le terme “MySensor” :</p>
<p align="center"><a href="https://developer.myconstellation.io/wp-content/uploads/2017/05/image-54.png"><img class="colorbox-4588"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" src="https://developer.myconstellation.io/wp-content/uploads/2017/05/image_thumb-54.png" alt="image" width="404" height="154" border="0" /></a></p>
<p>On retrouve bien, en temps réel, les trois mesures réalisées par notre ESP8266. N’hésitez pas à ouvrir ces StateObjects et cliquez sur « Subscribe » pour voir les mesures en temps réel dans la Console Constellation.</p>
<h3>Etape 3 : Une page Web pour afficher votre capteur en temps réel</h3>
<p>Créons maintenant une page Web pour afficher en temps réel les mesures de notre capteur connecté. Pour cela créez un fichier HTML sur votre poste avec une structure HTML de base.</p>
<p>Dans les entêtes ajoutez les scripts suivants :</p>
<p></p><pre class="crayon-plain-tag">&lt;script type="text/javascript" src="https://code.jquery.com/jquery-2.2.4.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/signalr/jquery.signalr-2.2.1.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="https:/cdn.myconstellation.io/js/Constellation-1.8.1.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="https://cdn.myconstellation.io/js/ngConstellation-1.8.1.min.js"&gt;&lt;/script&gt;</pre><p></p>
<p>Sur la balise &lt;html&gt; ajoutez l’attribut :</p>
<p></p><pre class="crayon-plain-tag">ng-app="MyDemoApp"</pre><p></p>
<p>Et sur la balise &lt;body&gt; ajoutez l’attribut :</p>
<p></p><pre class="crayon-plain-tag">ng-controller="MyController"</pre><p></p>
<p>Dans le corps de votre page, placez les valeurs vos StateObjects où bon vous semble. Par exemple :</p>
<p></p><pre class="crayon-plain-tag">&lt;div&gt;
    Temperature: &lt;p&gt;{{Temperature}}°C&lt;/p&gt;
    Humidity: &lt;p&gt;{{Humidity}}%&lt;/p&gt;
    Light: &lt;p&gt;{{Light}} lux&lt;/p&gt;
&lt;/div&gt;</pre><p></p>
<p>Pour finir ajoutez le script suivant dans votre page (dans une balise &lt;script&gt;):</p>
<p></p><pre class="crayon-plain-tag">var myDemoApp = angular.module('MyDemoApp', ['ngConstellation']);
myDemoApp.controller('MyController', ['$scope', 'constellationConsumer', function ($scope, constellation) {

  constellation.initializeClient("http://localhost:8088", "clé d'accès constellation", "MySensor WebPage");

    constellation.onConnectionStateChanged(function (change) {
      if (change.newState === $.signalR.connectionState.connected) {

        constellation.registerStateObjectLink("*", "MySensor", "*", "*", function (so) {
          $scope.$apply(function () {
           $scope[so.Name] = so.Value;
          });
        });
      }
    });

    constellation.connect();
  }]);</pre><p></p>
<p>N’oubliez pas de définir l’adresse de votre Constellation ainsi que la clé d’accès pour vous connecter à votre Constellation lors de l’appel de la méthode « constellation.initializeClient »</p>
<p><b>Vous obtenez en quelques minutes une page Web permettant d’afficher en temps réel les mesures de température, d’humidité et de luminosité réalisées par votre ESP8266 !</b></p>
<p align="center"><a href="https://developer.myconstellation.io/wp-content/uploads/2017/05/image-55.png"><img class="colorbox-4588"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="image" src="https://developer.myconstellation.io/wp-content/uploads/2017/05/image_thumb-55.png" alt="image" width="404" height="369" border="0" /></a></p>
<h3>Etape 4 (optionnelle) : créer un package .NET pour exploiter les données du capteur</h3>
<p>La page Web réalisée ci-dessus permet d’afficher en temps réel les valeurs de vos StateObjects.</p>
<p>Si maintenant vous souhaitez récupérer la valeur de ces StateObject dans un programme pour réagir en fonction de certaines valeurs (par exemple alerter si T° trop froide ou allumer des lumières si la luminosité est trop faible) ou bien tout simplement enregistrer ces valeurs dans un fichier, une base de données ou un service de cloud, suivez la suite.</p>
<p>Pour cet exemple, réalisons un programme en C#. On part du principe que vous avez installé Visual Studio et <a href="/getting-started/installer-constellation/">le SDK Constellation depuis le « Web Platform Installer »</a>.</p>
<p>Créez alors un nouveau projet de type « Constellation Package Console » :</p>
<p align="center"><a href="https://developer.myconstellation.io/wp-content/uploads/2017/05/image-56.png"><img class="colorbox-4588"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="image" src="https://developer.myconstellation.io/wp-content/uploads/2017/05/image_thumb-56.png" alt="image" width="404" height="266" border="0" /></a></p>
<p>Dans votre classe, ajoutez simplement des propriétés pour chaque StateObject avec l’attribut « StateObjectLink » pour lier ces propriétés .NET aux StateObjects de votre capteur (servez-vous du snippet « stateobjectlink »).</p>
<p>Par exemple pour inclure le StateObject « Light » dans notre classe C# :</p>
<p></p><pre class="crayon-plain-tag">[StateObjectLink("MySensor", "Light")]
public StateObjectNotifier Light { get; set; }</pre><p></p>
<p>Vous pouvez maintenant afficher sa valeur à tout moment, par exemple :</p>
<p></p><pre class="crayon-plain-tag">PackageHost.WriteInfo($"Luminosité {this.Light.Value.LastUpdate} = {this.Light.DynamicValue} lux");</pre><p></p>
<p>La propriété « Light » de votre classe contiendra toujours la dernière valeur du StateObject connu dans votre Constellation.</p>
<p>Vous pouvez donc manipuler la valeur mesurée par votre ESP8266 dans votre code C# comme une simple propriété .NET de votre code.</p>
<p>Vous pouvez également vous abonner à chaque mise à jour du StateObject pour déclencher une action grâce à l’évènement « ValueChanged » :</p>
<p></p><pre class="crayon-plain-tag">this.Light.ValueChanged += (s, e) =&gt;
{
    PackageHost.WriteInfo($"Nouvelle mesure à {this.Light.Value.LastUpdate} = {this.Light.DynamicValue} lux");
};</pre><p></p>
<p align="center"><a href="https://developer.myconstellation.io/wp-content/uploads/2017/05/image-57.png"><img class="colorbox-4588"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" title="image" src="https://developer.myconstellation.io/wp-content/uploads/2017/05/image_thumb-57.png" alt="image" width="404" height="206" border="0" /></a></p>
<p>The post <a rel="nofollow" href="https://developer.myconstellation.io/tutorials/creer-un-capteur-de-temperature-humidite-et-luminosite-connecte/">Créer un capteur de température, humidité et luminosité connecté</a> appeared first on <a rel="nofollow" href="https://developer.myconstellation.io">Constellation</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://developer.myconstellation.io/tutorials/creer-un-capteur-de-temperature-humidite-et-luminosite-connecte/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Rfxcom : captez vos sondes RF et pilotez des équipements Somfy</title>
		<link>https://developer.myconstellation.io/package-library/rfxcom/</link>
					<comments>https://developer.myconstellation.io/package-library/rfxcom/#comments</comments>
		
		<dc:creator><![CDATA[Constellation Documentation Agent]]></dc:creator>
		<pubDate>Wed, 26 Oct 2016 12:56:21 +0000</pubDate>
				<category><![CDATA[Packages]]></category>
		<category><![CDATA[RFY]]></category>
		<category><![CDATA[Package]]></category>
		<category><![CDATA[LaCrosse]]></category>
		<category><![CDATA[Capteur]]></category>
		<category><![CDATA[Oregon]]></category>
		<category><![CDATA[Sonde]]></category>
		<category><![CDATA[RF]]></category>
		<category><![CDATA[433]]></category>
		<category><![CDATA[RFXcom]]></category>
		<category><![CDATA[X10]]></category>
		<category><![CDATA[Somfy]]></category>
		<guid isPermaLink="false">https://developer.myconstellation.io/?p=3499</guid>

					<description><![CDATA[<p>Le package Rfxcom vous permet d’interagir avec l’émetteur/récepteur RFXCOM USB. Actuellement, le package en version 1.0 supporte : Les sondes de température (Oregon THR128/138, THC138, THC238/268, THN132, THWR288, THRN122, THN122, AW129/131, THWR800, RTHN318, La Crosse TX2, TX3, TX4, TX17, WS2300,</p>
<p>The post <a rel="nofollow" href="https://developer.myconstellation.io/package-library/rfxcom/">Rfxcom : captez vos sondes RF et pilotez des équipements Somfy</a> appeared first on <a rel="nofollow" href="https://developer.myconstellation.io">Constellation</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Le package Rfxcom vous permet d’interagir avec l’émetteur/récepteur RFXCOM USB.</p>
<p align="center"><a href="https://developer.myconstellation.io/wp-content/uploads/2016/10/image-128.png"><img class="colorbox-3499"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; padding-right: 0px; border: 0px;" title="image" src="https://developer.myconstellation.io/wp-content/uploads/2016/10/image_thumb-118.png" alt="image" width="150" height="247" border="0" /></a></p>
<p align="left">Actuellement, le package en version 1.0 supporte :</p>
<ul>
<li>Les sondes de température (Oregon THR128/138, THC138, THC238/268, THN132, THWR288, THRN122, THN122, AW129/131, THWR800, RTHN318, La Crosse TX2, TX3, TX4, TX17, WS2300, TS15C, Viking 02811, RUBiCSON, TFA 30.3133)</li>
<li>Les sondes de température et d’humidité  (Oregon THGN122/123, THGN132, THGR122/228/238/268, THGR810, THGN800, THGR810, RTGR328, THGR328, WTGR800, THGR918/928, THGRN228, THGN500, TFA TS34C, Cresta, WT260,WT260H,WT440H,WT450,WT450H, Viking 02035,02038, Rubicson, EW109)</li>
<li>L’envoi de commande RFY (pour le pilotage des périphérique Somfy)</li>
</ul>
<p>Le code source est disponible sur : <a title="https://github.com/myconstellation/constellation-packages/tree/master/Rfxcom" href="https://github.com/myconstellation/constellation-packages/tree/master/Rfxcom">https://github.com/myconstellation/constellation-packages/tree/master/Rfxcom</a></p>
<h3>Installation</h3>
<p>Depuis le “Online Package Repository” de votre Console Constellation, déployez le package Rfxcom :</p>
<p align="center"><a href="https://developer.myconstellation.io/wp-content/uploads/2016/10/image-129.png"><img class="colorbox-3499"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; padding-right: 0px; border-width: 0px;" title="image" src="https://developer.myconstellation.io/wp-content/uploads/2016/10/image_thumb-119.png" alt="image" width="354" height="217" border="0" /></a></p>
<p>Une fois le package télécharger votre repository local, sélectionnez la sentinelle sur laquelle déployer le package.</p>
<p>Pour finir, sur la page de Settings, vous devez obligatoirement définir le port COM sur lequel est connecté votre RFXcom :</p>
<p align="center"><a href="https://developer.myconstellation.io/wp-content/uploads/2016/10/image-130.png"><img class="colorbox-3499"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; padding-right: 0px; border: 0px;" title="image" src="https://developer.myconstellation.io/wp-content/uploads/2016/10/image_thumb-120.png" alt="image" width="350" height="281" border="0" /></a></p>
<p align="left">Vous pouvez également déployer ce package manuellement dans la configuration de votre Constellation :</p>
<p></p><pre class="crayon-plain-tag">&lt;package name="Rfxcom"&gt;
  &lt;settings&gt;
    &lt;setting key="PortName" value="COM3" /&gt;
  &lt;/settings&gt;
&lt;/package&gt;</pre><p></p>
<h3>Détails du package</h3>
<h4>Les Settings</h4>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td valign="top" width="10"><u>Nom</u></td>
<td valign="top" width="10"><u>Type</u></td>
<td valign="top" width="10"><u>Détail</u></td>
<td valign="top" width="478"><u>Description</u></td>
</tr>
<tr>
<td valign="top" width="10"><strong>PortName</strong></td>
<td valign="top" width="10">String</td>
<td valign="top" width="10">Obligatoire</td>
<td valign="top" width="478">Le nom du port COM du RFXcom (ex: COM1)</td>
</tr>
<tr>
<td valign="top" width="10"><strong>Verbose</strong></td>
<td valign="top" width="10">Boolean</td>
<td valign="top" width="10">Optionnel<br />
Par défaut : false</td>
<td valign="top" width="478">Indique si le package écrit tous les messages qu’il reçoit dans les logs Constellation</td>
</tr>
<tr>
<td valign="top" width="10"><strong>ProtocolsEnabled</strong></td>
<td valign="top" width="10">String</td>
<td valign="top" width="10">Optionnel</td>
<td valign="top" width="478">Liste des protocoles RF à activer (sépéré par des virgules). Exemple : “Oregon,X10”. Voir la liste <a href="http://www.rfxcom.com/WebRoot/StoreNL2/Shops/78165469/MediaGallery/Downloads/RFXtrx_User_Guide_-_FR.pdf">ici</a> à la page 8.</td>
</tr>
<tr>
<td valign="top" width="10"><strong>ForwardRawMessageToGroup</strong></td>
<td valign="top" width="10">String</td>
<td valign="top" width="10">Optionnel</td>
<td valign="top" width="478">Indique le nom du groupe dans lequel transférer les messages reçu.</td>
</tr>
<tr>
<td valign="top" width="10"><strong>SensorStateObjectLifetime</strong></td>
<td valign="top" width="10">Int32</td>
<td valign="top" width="10">Optionnel<br />
Par défaut : 300</td>
<td valign="top" width="478">Durée de vie en seconde pour les StateObjects publiés.</td>
</tr>
<tr>
<td valign="top" width="10"><strong>StateObjectCustomNames</strong></td>
<td valign="top" width="10">JsonObject</td>
<td valign="top" width="10">Optionnel</td>
<td valign="top" width="478">Par défaut chaque StateObject est nommé par le type et numéro de série du capteur. Vous pouvez personnaliser le nom avec ce setting.</td>
</tr>
</tbody>
</table>
<h5>Personnaliser les noms des StateObjects</h5>
<p>Le package publie un StateObject pour chaque capteur qu’il recoit. Chaque StateObject est composé du type de capteur (par exemple : “Temperature”) et de son identifiant.</p>
<p>Par exemple pour un capteur de température Oregon THR128 avec l’ID “21762”, le StateObject le représentant se nommera “TemperatureHumiditySensor_21762”.</p>
<p>Pour personnaliser les noms des StatObjects publiés vous pouvez définir un objet JSON dans le setting “<strong>StateObjectCustomNames</strong>” en indiquant le nom du capteur et son nom de StateObject :</p>
<p></p><pre class="crayon-plain-tag">{
  "SensorName": "CustomName",
  "SensorName2": "CustomName2"
}</pre><p></p>
<p>Voici par exemple la personnalisation de plusieurs sondes Oregon :</p>
<p></p><pre class="crayon-plain-tag">{
    "TemperatureHumiditySensor_21762": "Capteur Bureau",
    "TemperatureHumiditySensor_64001": "Capteur Salle de bain",
    "TemperatureHumiditySensor_62468": "Capteur Buanderie",
    "TemperatureSensor_22529": "Temperature Chambre 3",
    "TemperatureSensor_36866": "Temperature Entrée",
    "TemperatureSensor_19716": "Temperature Cellier"
}</pre><p></p>
<p align="center"><a href="https://developer.myconstellation.io/wp-content/uploads/2016/10/image-131.png"><img class="colorbox-3499"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; padding-right: 0px; border: 0px;" title="image" src="https://developer.myconstellation.io/wp-content/uploads/2016/10/image_thumb-121.png" alt="image" width="350" height="213" border="0" /></a></p>
<p>Ainsi le capteur “TemperatureHumiditySensor_21762” est représenté dans la Constellation par le StateObject nommé “Capteur Bureau”.</p>
<p>Soyez particulièrement vigilant sur le fait que l’identifiant peut changer si le capteur n’a plus d’energie pendant plusieurs secondes (ce qui peut arriver lors du changement de pile). Il faudra alors mettre à jour la table de mapping pour que votre capteur conserve son nom de StateObject.</p>
<h4>Les StateObjects</h4>
<p>Vous retrouverez autant de StateObjects que de trame de capteur RF  :</p>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td valign="top" width="10"><u>Nom</u></td>
<td valign="top" width="10"><u>Type</u></td>
<td valign="top" width="446"><u>Description</u></td>
</tr>
<tr>
<td valign="top" width="10"><strong>RFXCOM</strong></td>
<td valign="top" width="10">RfxCom.Device</td>
<td valign="top" width="446">Représente l’état du périphérique RFXcom (nom, version, protocole activée, etc..)</td>
</tr>
<tr>
<td valign="top" width="10"><strong>&lt;&lt; nom du capteur ou ID &gt;&gt;</strong></td>
<td valign="top" width="10">RfxCom.TemperatureSensor</td>
<td valign="top" width="446">Représente l’état d’un capteur 0x50 (température)</td>
</tr>
<tr>
<td valign="top" width="10"><strong>&lt;&lt; nom du capteur ou ID &gt;&gt;</strong></td>
<td valign="top" width="10">RfxCom.TemperatureHumiditySensor</td>
<td valign="top" width="446">Représente l’état d’un capteur 0x52(température et humidité)</td>
</tr>
</tbody>
</table>
<p align="center"><a href="https://developer.myconstellation.io/wp-content/uploads/2016/10/image-132.png"><img class="colorbox-3499"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; padding-right: 0px; border: 0px;" title="image" src="https://developer.myconstellation.io/wp-content/uploads/2016/10/image_thumb-122.png" alt="image" width="350" height="152" border="0" /></a></p>
<h4 align="left">Les MessageCallbacks</h4>
<p>Le package expose 4 MessageCallbacks :</p>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td valign="top" width="10"><u>Nom</u></td>
<td valign="top" width="141"><u>Réponse (saga)</u></td>
<td valign="top" width="407"><u>Description</u></td>
</tr>
<tr>
<td valign="top" width="10"><strong>RefreshStatus</strong></td>
<td valign="top" width="141"><em>Aucune</em></td>
<td valign="top" width="407">Rafraichit le statuts du RFXcom.</td>
</tr>
<tr>
<td valign="top" width="10"><strong>SendMessage</strong></td>
<td valign="top" width="141"><em>Aucune</em></td>
<td valign="top" width="407">Envoi un message en RF.</td>
</tr>
<tr>
<td valign="top" width="10"><strong>SendRFYCommand</strong></td>
<td valign="top" width="141"><em>Aucune</em></td>
<td valign="top" width="407">Envoi une commande RFY (pour les équipements Somfy).</td>
</tr>
<tr>
<td valign="top" width="10"><strong>SetProtocols</strong></td>
<td valign="top" width="141"><em>Aucune</em></td>
<td valign="top" width="407">Défini la liste des protocoles RF à activer (voir la liste <a href="http://www.rfxcom.com/WebRoot/StoreNL2/Shops/78165469/MediaGallery/Downloads/RFXtrx_User_Guide_-_FR.pdf">ici</a> à la page 8).</td>
</tr>
</tbody>
</table>
<h3 align="center"><a href="https://developer.myconstellation.io/wp-content/uploads/2016/10/image-133.png"><img class="colorbox-3499"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; padding-right: 0px; border: 0px;" title="image" src="https://developer.myconstellation.io/wp-content/uploads/2016/10/image_thumb-123.png" alt="image" width="350" height="206" border="0" /></a></h3>
<h3 align="left">Quelques exemples</h3>
<ul>
<li>Afficher les données de vos capteurs de température sur une page Web</li>
<li>Envoyer une notification d’urgence en cas de de température trop haute depuis un package C#</li>
<li>Piloter une prise Somfy depuis une page Web ou une application mobile multi-plateforme</li>
</ul>
<p>The post <a rel="nofollow" href="https://developer.myconstellation.io/package-library/rfxcom/">Rfxcom : captez vos sondes RF et pilotez des équipements Somfy</a> appeared first on <a rel="nofollow" href="https://developer.myconstellation.io">Constellation</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://developer.myconstellation.io/package-library/rfxcom/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>NetAtmo : vos capteurs NetAtmo dans votre Constellation</title>
		<link>https://developer.myconstellation.io/package-library/netatmo/</link>
					<comments>https://developer.myconstellation.io/package-library/netatmo/#comments</comments>
		
		<dc:creator><![CDATA[Constellation Documentation Agent]]></dc:creator>
		<pubDate>Fri, 21 Oct 2016 15:23:47 +0000</pubDate>
				<category><![CDATA[Packages]]></category>
		<category><![CDATA[CO²]]></category>
		<category><![CDATA[Package]]></category>
		<category><![CDATA[Meteo]]></category>
		<category><![CDATA[NetAtmo]]></category>
		<category><![CDATA[Capteur]]></category>
		<category><![CDATA[Temperature]]></category>
		<category><![CDATA[Humidité]]></category>
		<category><![CDATA[Pression]]></category>
		<guid isPermaLink="false">https://developer.myconstellation.io/?p=3355</guid>

					<description><![CDATA[<p>Le package NetAtmo permet de connecter votre station météo NetAtmo dans Constellation. La version actuelle du package ne gère que les stations météo et modules associées et non les autres objets NetAtmo tel que le thermostat ou la caméra Welcome.</p>
<p>The post <a rel="nofollow" href="https://developer.myconstellation.io/package-library/netatmo/">NetAtmo : vos capteurs NetAtmo dans votre Constellation</a> appeared first on <a rel="nofollow" href="https://developer.myconstellation.io">Constellation</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Le package NetAtmo permet de connecter votre station météo NetAtmo dans Constellation.</p>
<p>La version actuelle du package ne gère que les stations météo et modules associées et non les autres objets NetAtmo tel que le thermostat ou la caméra Welcome.</p>
<p align="center"><a href="http://www.netatmo.com"><img class="colorbox-3355"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; padding-right: 0px; border-width: 0px;" title="image" src="https://developer.myconstellation.io/wp-content/uploads/2016/10/image-89.png" alt="image" width="240" height="167" border="0" /></a></p>
<p align="left">Le code source de ce package est en ligne sur : <a href="https://github.com/myconstellation/constellation-packages/tree/master/NetAtmo">https://github.com/myconstellation/constellation-packages/tree/master/NetAtmo</a></p>
<h3>Installation</h3>
<h4>Prérequis : créer une application NetAtmo</h4>
<p>Pour pouvoir utiliser le service NetAtmo vous devez créer un compte développeur sur : <a title="https://dev.netatmo.com/" href="https://dev.netatmo.com/">https://dev.netatmo.com/</a></p>
<p align="center"><a href="https://developer.myconstellation.io/wp-content/uploads/2016/10/image-90.png"><img class="colorbox-3355"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; padding-right: 0px; border-width: 0px;" title="image" src="https://developer.myconstellation.io/wp-content/uploads/2016/10/image_thumb-82.png" alt="image" width="350" height="270" border="0" /></a></p>
<p>Une fois inscrit, créer une application en cliquant sur “Create an app” :</p>
<p align="center"><a href="https://developer.myconstellation.io/wp-content/uploads/2016/10/image-91.png"><img class="colorbox-3355"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; padding-right: 0px; border-width: 0px;" title="image" src="https://developer.myconstellation.io/wp-content/uploads/2016/10/image_thumb-83.png" alt="image" width="350" height="270" border="0" /></a></p>
<p align="left">Entrez les informations pour votre connecteur :</p>
<p align="center"><a href="https://developer.myconstellation.io/wp-content/uploads/2016/10/image-92.png"><img class="colorbox-3355"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; padding-right: 0px; border-width: 0px;" title="image" src="https://developer.myconstellation.io/wp-content/uploads/2016/10/image_thumb-84.png" alt="image" width="350" height="270" border="0" /></a></p>
<p align="left">Puis en enregistrant, vous obtiendrez un peu plus bas sur cette page, le “Client ID” et “Client Secret” de votre application NetAtmo qui servira pour la configuration du package Constellation :</p>
<p align="center"><a href="https://developer.myconstellation.io/wp-content/uploads/2016/10/image-93.png"><img class="colorbox-3355"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; padding-right: 0px; border-width: 0px;" title="image" src="https://developer.myconstellation.io/wp-content/uploads/2016/10/image_thumb-85.png" alt="image" width="350" height="270" border="0" /></a></p>
<h4>Installation du package Constellation</h4>
<p>Depuis le “Online Package Repository” de votre Console Constellation, déployez le package NetAtmo :</p>
<p align="center"><a href="https://developer.myconstellation.io/wp-content/uploads/2016/10/image-94.png"><img class="colorbox-3355"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; padding-right: 0px; border-width: 0px;" title="image" src="https://developer.myconstellation.io/wp-content/uploads/2016/10/image_thumb-86.png" alt="image" width="350" height="216" border="0" /></a></p>
<p>Une fois le package télécharger votre repository local, sélectionnez la sentinelle sur laquelle déployer le package.</p>
<p>Pour finir, sur la page de Settings, vous devez définir différents paramètres :</p>
<ul>
<li><u>Netatmo.ClientId</u> : le “Client ID” de votre application NetAtmo créée précédemment</li>
<li><u>Netatmo.ClientSecret</u> : le “Client Secret” de votre application NetAtmo créée précédemment</li>
<li><u>Netatmo.Username</u> : votre utilisateur NetAtmo</li>
<li><u>Netatmo.Password</u> : votre mot de passe NetAtmo pour l’utilisateur utilisé</li>
</ul>
<p align="center"><a href="https://developer.myconstellation.io/wp-content/uploads/2016/10/image-95.png"><img class="colorbox-3355"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; padding-right: 0px; border-width: 0px;" title="image" src="https://developer.myconstellation.io/wp-content/uploads/2016/10/image_thumb-87.png" alt="image" width="350" height="264" border="0" /></a></p>
<p align="left">Vous pouvez aussi redéfinir le setting “RefreshInterval” qui représente l’intervalle de temps en seconde de rafraichissement des données de votre station météo sur le service NetAtmo. Par défaut ce paramètre est fixé à 300 secondes soit 5 minutes. Notez par ailleurs que votre station météo NetAtmo remonte ses mesures toutes les 5 minutes.</p>
<p>Bien entendu vos  pouvez également déployer ce package manuellement dans la configuration de votre Constellation :</p>
<p></p><pre class="crayon-plain-tag">&lt;package name="NetAtmo"&gt;
  &lt;settings&gt;
    &lt;setting key="Netatmo.ClientId" value="xxxxxx" /&gt;
    &lt;setting key="Netatmo.ClientSecret" value="xxxxx" /&gt;
    &lt;setting key="Netatmo.Username" value="xxx@xxx.com" /&gt;
    &lt;setting key="Netatmo.Password" value="xxxxxx" /&gt;
  &lt;/settings&gt;
&lt;/package&gt;</pre><p></p>
<h3>Détails du package</h3>
<h4>Les Settings</h4>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td valign="top" width="10"><u>Nom</u></td>
<td valign="top" width="10"><u>Type</u></td>
<td valign="top" width="10"><u>Détail</u></td>
<td valign="top" width="456"><u>Description</u></td>
</tr>
<tr>
<td valign="top" width="10"><strong>Netatmo.ClientId</strong></td>
<td valign="top" width="10">String</td>
<td valign="top" width="10">Obligatoire</td>
<td valign="top" width="456">Client ID de l’application NetAtmo associée</td>
</tr>
<tr>
<td valign="top" width="10"><strong>Netatmo.ClientSecret</strong></td>
<td valign="top" width="10">String</td>
<td valign="top" width="10">Obligatoire</td>
<td valign="top" width="456">Client Secret de l’application NetAtmo associée</td>
</tr>
<tr>
<td valign="top" width="10"><strong>Netatmo.Username</strong></td>
<td valign="top" width="10">String</td>
<td valign="top" width="10">Obligatoire</td>
<td valign="top" width="456">Nom d’utilisateur du compte NetAtmo</td>
</tr>
<tr>
<td valign="top" width="10"><strong>Netatmo.Password</strong></td>
<td valign="top" width="10">String</td>
<td valign="top" width="10">Obligatoire</td>
<td valign="top" width="456">Mot de passe de l’utilisateur NetAtmo</td>
</tr>
<tr>
<td valign="top" width="10"><strong>RefreshInterval</strong></td>
<td valign="top" width="10">Int32</td>
<td valign="top" width="10">Optionnel<br />
Par défaut : 300</td>
<td valign="top" width="456">Intervalle de temps en seconde d’interrogation du service NetAtmo</td>
</tr>
</tbody>
</table>
<h4>Les StateObjects</h4>
<p>Vous retrouverez autant de StateObjects que vous avez de mesures pour chaque modules connectés à votre station. Ces StateObjects sont mis à jour pour l’intervalle défini dans la configuration (toutes les 5 minutes par défaut).</p>
<p>Par exemple</p>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td valign="top" width="10"><u>Nom</u></td>
<td valign="top" width="10"><u>Type</u></td>
<td valign="top" width="446"><u>Description</u></td>
</tr>
<tr>
<td valign="top" width="10"><strong>&lt;&lt; nom de la station &gt;&gt;.Info</strong></td>
<td valign="top" width="10">NetAtmo.Device</td>
<td valign="top" width="446">Description de la station NetAtmo (IP, firmware, modules attachés, qualité du Wifi, etc..)</td>
</tr>
<tr>
<td valign="top" width="10"><strong>&lt;&lt; nom du module&gt;&gt;.Info</strong></td>
<td valign="top" width="10">NetAtmo.Module</td>
<td valign="top" width="446">Description du module NetAtmo (ID, firmware, état RF, niveau de batterie, etc..)</td>
</tr>
<tr>
<td valign="top" width="10"><strong>&lt;&lt; nom du module/station&gt;&gt;.Temperature</strong></td>
<td valign="top" width="10">NetAtmo.TemperatureMeasurement</td>
<td valign="top" width="446">Mesure de la température</td>
</tr>
<tr>
<td valign="top" width="10"><strong>&lt;&lt; nom du module/station&gt;&gt;.Humidity</strong></td>
<td valign="top" width="10">NetAtmo.HumidityMeasurement</td>
<td valign="top" width="446">Mesure de l’humidité relative</td>
</tr>
<tr>
<td valign="top" width="10"><strong>&lt;&lt; nom du module/station&gt;&gt;.Rain</strong></td>
<td valign="top" width="10">NetAtmo.RainMeasurement</td>
<td valign="top" width="446">Mesure de la pluie</td>
</tr>
<tr>
<td valign="top" width="10"><strong>&lt;&lt; nom du module/station&gt;&gt;.CarbonDioxide</strong></td>
<td valign="top" width="10">NetAtmo.CarbonDioxideMeasurement</td>
<td valign="top" width="446">Mesure du CO²</td>
</tr>
<tr>
<td valign="top" width="10"><strong>&lt;&lt; nom du module/station&gt;&gt;.Noise</strong></td>
<td valign="top" width="10">NetAtmo.NoiseMeasurement</td>
<td valign="top" width="446">Mesure du niveau sonore</td>
</tr>
<tr>
<td valign="top" width="10"><strong>&lt;&lt; nom du module/station&gt;&gt;.Pressure</strong></td>
<td valign="top" width="10">NetAtmo.PressureMeasurement</td>
<td valign="top" width="446">Mesure de la pression atmosphérique</td>
</tr>
</tbody>
</table>
<p align="center"><a href="https://developer.myconstellation.io/wp-content/uploads/2016/10/image-96.png"><img class="colorbox-3355"  loading="lazy" style="background-image: none; padding-top: 0px; padding-left: 0px; padding-right: 0px; border: 0px;" title="image" src="https://developer.myconstellation.io/wp-content/uploads/2016/10/image_thumb-88.png" alt="image" width="350" height="220" border="0" /></a></p>
<h4 align="left">Les MessageCallbacks</h4>
<p>Ce package n’expose pas de MessageCallback.</p>
<h3 align="left">Quelques exemples</h3>
<ul>
<li>Notifier l’utilisateur si il pleut alors qu’une fenetre est restée ouverte</li>
<li>Afficher les mesures des modules NetAtmo dans une application graphique pour Windows (WPF)</li>
<li>Afficher la qualité de l’air sur une matrice de LED pilotée par un Arduino/ESP</li>
<li>Piloter le thermostat Nest depuis une autre pièce en fonction de la température d’un module NetAtmo</li>
</ul>
<p>The post <a rel="nofollow" href="https://developer.myconstellation.io/package-library/netatmo/">NetAtmo : vos capteurs NetAtmo dans votre Constellation</a> appeared first on <a rel="nofollow" href="https://developer.myconstellation.io">Constellation</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://developer.myconstellation.io/package-library/netatmo/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Mise en cache de page à l’aide de Disk: Enhanced 

Served from: developer.myconstellation.io @ 2026-01-23 01:57:53 by W3 Total Cache
-->