Hi everyone.
One of the developer tools in Chrome should show you the page source.
Good luck
<!DOCTYPE HTML>
<html>
<head></head><body><h1>ESP8266 - Temperature and Humidity</h1><h3>Temperature in Celsius:
22.92
*C</h3><h3>Temperature in Fahrenheit:
73.25
*F</h3><h3>Humidity:
51.40
%</h3><h3>
</body></html>
/html/body/h3[2]
Pieter has been in touch to suggest that it looks like your HTML has an error in it, which might be causing a problem.
Apparently, the last <h3> shouldn't be there.
He said that with the <h3> tag removed, the XPath query you created works fine on this test site :-
http://www.freeformatter.com/xpath-tester.html
I also found a page the refers to an option to export XML from your ESP8266 device, is it any use to you?
With the aim of removing the redundant <h3> tag?
Does your ESP8266 offer a template that you could edit?
Is this your weather station?
https://www.hackster.io/13699/autonomous-weather-station-with-esp8266-90f8b3
I'd be interested to know more about your weather station.
Thanks,
Stuart
I don't want to create another one post, so I will reply here. Sorry for my English, it is not my mother tongue.
I started to build my smart house about 3 months ago. It's made on RaZberry+Z-Way Server+OpenRemote. Main target is to create an automated climate control system. I've started with temperature and humidity control. For that I've got ESP8266 NodeMCU+DHT22 sensor:
// Including the ESP8266 WiFi library
#include <ESP8266WiFi.h>#include "DHT.h"
// Uncomment one of the lines below for whatever DHT sensor type you're using!//#define DHTTYPE DHT11 // DHT 11//#define DHTTYPE DHT21 // DHT 21 (AM2301)#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321
// Replace with your network detailsconst char* ssid = "yourWiFiname";const char* password = "WiFipassword";
// Web Server on port 80WiFiServer server(80);
// DHT Sensorconst int DHTPin = 2;// Initialize DHT sensor.DHT dht(DHTPin, DHTTYPE);
// Temporary variablesstatic char celsiusTemp[7];static char fahrenheitTemp[7];static char humidityTemp[7];
// only runs once on bootvoid setup() { // Initializing serial port for debugging purposes Serial.begin(115200); delay(10);
dht.begin(); // Connecting to WiFi network 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"); // Starting the web server server.begin(); Serial.println("Web server running. Waiting for the ESP IP..."); delay(10000); // Printing the ESP IP address Serial.println(WiFi.localIP());}
// runs over and over againvoid loop() { // Listenning for new clients WiFiClient client = server.available(); if (client) { Serial.println("New client"); // bolean to locate when the http request ends boolean blank_line = true; while (client.connected()) { if (client.available()) { char c = client.read(); if (c == '\n' && blank_line) { // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor) float h = dht.readHumidity(); // Read temperature as Celsius (the default) float t = dht.readTemperature(); // Read temperature as Fahrenheit (isFahrenheit = true) float f = dht.readTemperature(true); // Check if any reads failed and exit early (to try again). if (isnan(h) || isnan(t) || isnan(f)) { Serial.println("Failed to read from DHT sensor!"); strcpy(celsiusTemp,"Failed"); strcpy(fahrenheitTemp, "Failed"); strcpy(humidityTemp, "Failed"); } else{ // Computes temperature values in Celsius + Fahrenheit and Humidity float hic = dht.computeHeatIndex(t, h, false); dtostrf(hic, 6, 2, celsiusTemp); float hif = dht.computeHeatIndex(f, h); dtostrf(hif, 6, 2, fahrenheitTemp); dtostrf(h, 6, 2, humidityTemp); // You can delete the following Serial.print's, it's just for debugging purposes Serial.print("Humidity: "); Serial.print(h); Serial.print(" %\t Temperature: "); Serial.print(t); Serial.print(" *C "); Serial.print(f); Serial.print(" *F\t Heat index: "); Serial.print(hic); Serial.print(" *C "); Serial.print(hif); Serial.print(" *F"); Serial.print("Humidity: "); Serial.print(h); Serial.print(" %\t Temperature: "); Serial.print(t); Serial.print(" *C "); Serial.print(f); Serial.print(" *F\t Heat index: "); Serial.print(hic); Serial.print(" *C "); Serial.print(hif); Serial.println(" *F"); } client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println("Connection: close"); client.println(); // your actual web page that displays temperature and humidity client.println("<!DOCTYPE HTML>"); client.println("<html>"); client.println("<head></head><body><h1>ESP8266 - Temperature and Humidity</h1><h3> "); client.println(celsiusTemp); client.println("</h3><h3> "); client.println(fahrenheitTemp); client.println("</h3><h3> "); client.println(humidityTemp); client.println("</h3>"); client.println("</body></html>"); break; } if (c == '\n') { // when starts reading a new line blank_line = true; } else if (c != '\r') { // when finds a character on the current line blank_line = false; } } } // closing the client connection delay(1); client.stop(); Serial.println("Client disconnected."); }}
I'll definitely add that project to my wish list.
I've been thinking of adding a humidity sensor to my bathroom and linking it to an extraction fan.
If you read every part of this thread you should find exactly what you're looking for.
If you run into trouble, post the source from the webpage (as detailed in this thread) and I'm sure someone will come up with something that will help.
Cheers,
Stuart
Any suggestions on how to get the data in openremote?
Bart
I'll confess that I haven't used the TCP/IP commands yet....
However...
There is a polling interval option at the bottom :-)
So, I suggest you just put a value in there :-)
You'll have to double check the how-to, but I think the default measurement is seconds.
I saw 'polling interval' referred to in other protocols and I think you can define the interval in milliseconds, seconds, minutes or hours.
Give it a try and let us know how you get on.
Good luck,
Stuart
Well, i tried the polling interval with different times but nothing is happening. The strange thing is that if i set up a tcpip connection in openremote nothing happens until i use a separate TCPIP client test utility on my laptop to see if the espis sending data, the dat is received by the test program but in openremote as well.