Hello I am new with Domoticz.
I have ordered a Wemos D1 mini, but I cannot get through programming.
I use the Linux Mint operating system, and as an upload program uPyCraft.
I would like to read the DHT22 sensor with the Wemos D1 mini with Domotiz.
I want to keep programming at Micropython.
Is there someone who wants to get me started a bit?
Greetz,
Robert
Newbie
Moderator: leecollings
-
- Posts: 3
- Joined: Monday 03 February 2020 20:24
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
-
- Posts: 618
- Joined: Sunday 01 November 2015 22:45
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2023.2
- Location: Twente
- Contact:
Re: Newbie
Bugs bug me.
Re: Newbie
I can second Easy ESP, use the Mega builds from Github (not the R120, that one is legacy).
Easy ESP project has been dormant for some time but recently awoken with new spirit by some amazing developers.
These developers are working hard to restructure the code and project, hopefully they can publish a new RC of RTM release soon.
https://github.com/letscontrolit/ESPEas ... a-20191208
Tip: Buy them a cup of coffee, they really appreciate the gesture
Easy ESP project has been dormant for some time but recently awoken with new spirit by some amazing developers.
These developers are working hard to restructure the code and project, hopefully they can publish a new RC of RTM release soon.
https://github.com/letscontrolit/ESPEas ... a-20191208
Tip: Buy them a cup of coffee, they really appreciate the gesture

Check these howto's: https://sancla.com
-
- Posts: 3
- Joined: Monday 03 February 2020 20:24
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Newbie
I have the Wemos D1 mini with the DHT22 sensor working.
I used the Arduino IDE, and I found the code on Github
The sensor indicates incorrect values in Domoticz.
The temperature is 10.4 degrees Celsius, while it is 21 degrees.
I tested the sensor with an Arduino, and it works correctly.
I suspect it's in the code, but I can't find out.
Someone an idea where to look?
Greetings Robert
I used the Arduino IDE, and I found the code on Github
The sensor indicates incorrect values in Domoticz.
The temperature is 10.4 degrees Celsius, while it is 21 degrees.
I tested the sensor with an Arduino, and it works correctly.
I suspect it's in the code, but I can't find out.
Someone an idea where to look?
Greetings Robert
Re: Newbie
Hi Robert,
I assume you are using the easy esp code...
I also assume that the hardware setup is correct as you have been able to verify this as stated.
What is the temperature on the easy esp interface, is that correct?
Did you correctly configure the Celsius/Fahrenheit options in Domoticz?
I assume you are using the easy esp code...
I also assume that the hardware setup is correct as you have been able to verify this as stated.
What is the temperature on the easy esp interface, is that correct?
Did you correctly configure the Celsius/Fahrenheit options in Domoticz?
Check these howto's: https://sancla.com
-
- Posts: 3
- Joined: Monday 03 February 2020 20:24
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Newbie
Here is my EPS-code in Arduino IDE.
The setting in Domoticz are Celsius degrees.
#include <ESP8266WiFi.h>
#include <DHT.h>
// Domoticz settings.
const char* server = "***.***.*.*"; //IP address from your Domoticz.
const int port = 8080; //Port number of your Domoticz.
const char* authcode = "***********************";// Your base64 login username:password decodebase64.com.
const int sensorid = 1; // Replace with your sensor ID,
const int sleeptime = 1000;// Set the delay between updates 1sec = 1000.
// Wifi settings.
const char* ssid = "********"; // Your ssid.
const char* password = "**********************"; // Your Password.
WiFiClient client;
// DHT sensor settings.
//#define DHTTYPE DHT11 // DHT 11.
#define DHTTYPE DHT22 // DHT 22.
#define DHTPIN 2 // What pin the DHT is connected to.
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(115200);
delay(10);
Serial.println();
WiFi.mode(WIFI_STA);
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("Service started");
Serial.println(WiFi.localIP());
}
void loop() {
delay(2000);
float h = dht.readHumidity();
float t = dht.readTemperature();
float f = dht.readTemperature(true);
if (isnan(h) || isnan(t) || isnan(f)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
if (!client.connect(server, port)) {
Serial.println("connection failed");
return;
}
int s = 0; //Humidity status.
if ( h > 70 ) {
s = 3;
} else if ( h < 40 ) {
s = 2;
} else if ( h > 40 || h < 70 ) {
s = 1;
}
String url = "/json.htm?type=command¶m=udevice&idx=";
url += sensorid;
url += "&nvalue=0&svalue=";
url += String(t, 2);
url += ";";
url += String(h, 2);
url += ";";
url += (s);
Serial.print("URL: ");
Serial.println(url);
client.print(String("GET ") + url + " HTTP/1.1\r\n" +
"Host: " + server + "\r\n" +
//"Authorization: Basic " + authcode + "\r\n" +
"User-Agent: ESP8266\r\n" +
"Connection: close\r\n\r\n");
Serial.print("Temperature: ");
Serial.print(t);
Serial.print(" degrees Celcius Humidity: ");
Serial.print(h);
Serial.println("% send to Domoticz");
while (client.connected()) {
String line = client.readStringUntil('\n');
if (line == "\r") {
break;
}
}
String line = client.readStringUntil('\n');
Serial.println("Feedback from Domoticz:");
Serial.println("==========");
Serial.println(line);
Serial.println("==========");
Serial.println("closing connection");
client.stop();
Serial.println("Waiting");
delay(sleeptime);
}
The setting in Domoticz are Celsius degrees.
#include <ESP8266WiFi.h>
#include <DHT.h>
// Domoticz settings.
const char* server = "***.***.*.*"; //IP address from your Domoticz.
const int port = 8080; //Port number of your Domoticz.
const char* authcode = "***********************";// Your base64 login username:password decodebase64.com.
const int sensorid = 1; // Replace with your sensor ID,
const int sleeptime = 1000;// Set the delay between updates 1sec = 1000.
// Wifi settings.
const char* ssid = "********"; // Your ssid.
const char* password = "**********************"; // Your Password.
WiFiClient client;
// DHT sensor settings.
//#define DHTTYPE DHT11 // DHT 11.
#define DHTTYPE DHT22 // DHT 22.
#define DHTPIN 2 // What pin the DHT is connected to.
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(115200);
delay(10);
Serial.println();
WiFi.mode(WIFI_STA);
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("Service started");
Serial.println(WiFi.localIP());
}
void loop() {
delay(2000);
float h = dht.readHumidity();
float t = dht.readTemperature();
float f = dht.readTemperature(true);
if (isnan(h) || isnan(t) || isnan(f)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
if (!client.connect(server, port)) {
Serial.println("connection failed");
return;
}
int s = 0; //Humidity status.
if ( h > 70 ) {
s = 3;
} else if ( h < 40 ) {
s = 2;
} else if ( h > 40 || h < 70 ) {
s = 1;
}
String url = "/json.htm?type=command¶m=udevice&idx=";
url += sensorid;
url += "&nvalue=0&svalue=";
url += String(t, 2);
url += ";";
url += String(h, 2);
url += ";";
url += (s);
Serial.print("URL: ");
Serial.println(url);
client.print(String("GET ") + url + " HTTP/1.1\r\n" +
"Host: " + server + "\r\n" +
//"Authorization: Basic " + authcode + "\r\n" +
"User-Agent: ESP8266\r\n" +
"Connection: close\r\n\r\n");
Serial.print("Temperature: ");
Serial.print(t);
Serial.print(" degrees Celcius Humidity: ");
Serial.print(h);
Serial.println("% send to Domoticz");
while (client.connected()) {
String line = client.readStringUntil('\n');
if (line == "\r") {
break;
}
}
String line = client.readStringUntil('\n');
Serial.println("Feedback from Domoticz:");
Serial.println("==========");
Serial.println(line);
Serial.println("==========");
Serial.println("closing connection");
client.stop();
Serial.println("Waiting");
delay(sleeptime);
}
Re: Newbie
I think you got a different easy esp source then we did. Easy esp is a complete gui with webinterface to make it very easy to program your wemos...
This is the correct link:
https://www.letscontrolit.com/wiki/index.php/ESPEasy
This is the correct link:
https://www.letscontrolit.com/wiki/index.php/ESPEasy
Check these howto's: https://sancla.com
Who is online
Users browsing this forum: No registered users and 1 guest