Page 2 sur 2
Re: Luxmetre
Publié : 17 avr. 2018, 11:48
par Starbird
Relecture du sujet : Luxmetre
Re: Luxmetre
Citer Titof2375
Message par Titof2375 » 14 avr. 2018, 18:53
moi je n'est rien trouve
Bonjour Titof2375,
Peux tu être plus explicite??? s'il te plait car je ne comprends pas ta réponse.
Re: Luxmetre
Publié : 18 avr. 2018, 10:22
par mike913
Bonjour,
Starbird a écrit :Bonjour,
j'ai commandé et reçu ce jour un VEML 7700 mais il n’envoie aucune information a Domoticz et d’ailleurs quand je vais sur le ESPEasy du Wemos D1 Devices est a 0 LUX.
Je ne peux que programme dans l'ESPEasy du Wemos D1 la device du BH1750 ou TLS 2561 quelqu'un peu-t’il m’indique comment faire?
D’ailleurs y a t'il une solution?
Merci.
Effectivement comme je n'utilise pas ESPEasy je ne savais pas qu'il n' était pas encore pris en compte par ESPEasy.
Personnellement j'utilise l'IDE Arduino pour programmer mes esp. Voici mon programme à flasher sur l' ESP.
Code : Tout sélectionner
/*
LuxUV-2011
date 24/03/2018 Version 2.011
*/
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <VEML7700.h>
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Machine et script
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
String dest = "adresse IP du destinataire";
char Nom[] = "Lumière Ext";
const char* host = "Lolin-07";
char script[] = "LuxUV-2.011";
char sondes[] = "UVLux";
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Paramètres WIFI
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
const char* ssid = "SSID;
const char* password = "Pass Phrase";
HTTPClient http;
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Timers
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
unsigned long CurrentMillis = 0; // Millisseconde courante
unsigned long NextMillis = 0; // Millisseconde courante
#define INTERVAL 60000 ; // 60 secondes
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Config Sondes VEML
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
VEML7700 als;
float lux = 0;
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// PIN Analogique Sonde UV
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
int GUVAPin = A0; //Output from the sensor
int analogValue = 0;
float UV = 0;
int count = 0;
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// SETUP
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void setup()
{
Serial.begin(115200);
delay(10);
// WiFi.mode ( WIFI_STA );
WiFi.begin(ssid, password);
Serial.println ( "" );
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
// on affiche l'adresse IP qui nous a ete attribuee
Serial.println("");
Serial.print("Machine: ");
Serial.print(host);
Serial.print("\t");
Serial.println(WiFi.localIP());
/* envoie des données de démarrage */
String url = dest;
url += "/esp/php/start.php?Host=";
url += host;
url += "&Sondes=";
url += sondes;
url += "&Script=";
url += script;
url += "&Nom=";
url += Nom;
Serial.println(url);
http.begin(url);
http.addHeader("Content-Type", "text/html");
int httpCode = http.GET();
Serial.println(httpCode);
if (httpCode == HTTP_CODE_OK)
{
Serial.print("HTTP response code ");
Serial.println(httpCode);
String response = http.getString();
Serial.println(response);
}
http.end();
/* ICI Configurer les capteurs */
als.begin();
als.setIntegrationTime(VEML7700::ALS_INTEGRATION_50ms);
delay(1000);
NextMillis = millis();
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Boucle principale
// Cette boucle s'exécute à l'infini
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void loop()
{
CurrentMillis = millis() ;
if (CurrentMillis > NextMillis)
{
int analogValue = analogRead(GUVAPin);
float val = 0.05 * analogValue-1;
if ( val < 0 )
{
val = 0;
}
UV = val;
als.setPower(0);
als.setPower(0);
als.setGain(VEML7700::ALS_GAIN_d8);
als.setPower(1);
als.sampleDelay();
als.getALSLux(lux);
delay(500);
// envoie des données
String url = dest;
url += "/esp/php/logs.php?Host=";
url += host;
url += "&Sondes=";
url += sondes;
url += "&Lux=";
url += lux;
url += "&UV=";
url += UV * coef;
url += "&Analog=";
url += analogValue;
Serial.println(url);
http.begin(url);
http.addHeader("Content-Type", "text/html");
int httpCode = http.GET();
/* Serial.println(httpCode);
if (httpCode == HTTP_CODE_OK)
{
Serial.print("HTTP response code ");
Serial.println(httpCode);
String response = http.getString();
Serial.println(response);
} */
http.end();
NextMillis = CurrentMillis + INTERVAL ;
}
}
Il suffit de l' adapter pour qu'il envoie les données à domoticz en remplaçant les lignes:
par String url = "/json.htm?type=command¶m=udevice&idx=12&nvalue=0&svalue=";
plus d'explication sur le site:
https://diyprojects.io/driving-gpio-esp ... m_Domoticz
Cordialement
Re: Luxmetre
Publié : 18 avr. 2018, 11:16
par cyberbob
Ce n'est pas plus facile avec espeasy ? On peut aisément utiliser divers capteurs de toute sorte et notamment les luxmètres.
Re: Luxmetre
Publié : 18 avr. 2018, 12:57
par mike913
Non, avec le VEML7700 on ne peux pas utiliser ESPEasy, car pour l'instant il ne gère pas ce capteur.
Re: Luxmetre
Publié : 27 avr. 2018, 15:41
par Titof2375
Starbird a écrit :Relecture du sujet : Luxmetre
Re: Luxmetre
Citer Titof2375
Message par Titof2375 » 14 avr. 2018, 18:53
moi je n'est rien trouve
Bonjour Titof2375,
Peux tu être plus explicite??? s'il te plait car je ne comprends pas ta réponse.
je n'est rien trouve sur le VEML 7700.
Re: Luxmetre
Publié : 27 avr. 2018, 19:37
par mike913