koffienl / ESPimatic

read/control DS18B20/DHT/IR/Relay from and to Pimatic on ESP8266
35 stars 15 forks source link

ds18b20 update interval #18

Open cm86 opened 7 years ago

cm86 commented 7 years ago

would it be possible to let the update intervals be smaller.

i'm using ESPimatic to control some heater. here the intervals of one minute is much to big. i need something like 1 second or 5 seconds...

thanks

S-Knop commented 7 years ago

You can change it espimatic.ino at line 776.

replace: ds18b20_sendInterval = (ds18b20_interval.toInt() 60000); with: ds18b20_sendInterval = (ds18b20_interval.toInt() 1000);

this wil make the interval you set in second instead of minutes.

I do not know if a interval that fast gives any problems sending data to pimatic haven't tested it.

cm86 commented 7 years ago

And will this edit:

like i understood the code (a little bit) these a two different times ... or isn't it so?

S-Knop commented 7 years ago

I changed it for dht and the interval is almost 3 sec. when sending data to pimatic the code has a small delay.

it is the same time but one is in minutes and other in miliseconds. the esp doesn't know minutes only milliseconds so that line converts minutes to milliseconds.

Yes it changes both.

if (millis() - ds18b20_lastInterval > ds18b20_sendInterval && DS18B20Enabled == "1") { String temp = get_ds18b20(); // Here it gets current temperature String ds18b20_var = HandleEeprom(ds18b20var_Address, "read"); send_data(temp, ds18b20_var); // Here it sends temperature to pimatic ds18b20_lastInterval = millis();
}

srry for my english

cm86 commented 7 years ago

thanks, is working for the first time.

I think i will test intensive next, or the following week. then i usually have to dry some components with the heater

S-Knop commented 7 years ago

you could also look at line 2319.

The reply does not print to serial monitor so you could try to comment it out. dont know if that will give any errors.

Replace

 delay(500);

  // Read all the lines of the reply from server and print them to Serial
  while (client.available()) {
    String line = client.readStringUntil('\r');
    //Serial.print(line);
  }

With

 // delay(500);

 // Read all the lines of the reply from server and print them to Serial
 // while (client.available()) {
 //   String line = client.readStringUntil('\r');
 //   Serial.print(line);
 //  }