|
@@ -1470,16 +1470,7 @@ void Statemachine::act(void) {
|
1470
|
1470
|
debug.println("ms");
|
1471
|
1471
|
|
1472
|
1472
|
#if defined(PLATFORM_ESP)
|
1473
|
|
- bool success = wifi_write_database(time_to_fill, "calibrated_filling", -1);
|
1474
|
|
- if (!success) {
|
1475
|
|
- debug.print("Error writing to InfluxDB ");
|
1476
|
|
- debug.print(INFLUXDB_HOST);
|
1477
|
|
- debug.print(":");
|
1478
|
|
- debug.print(INFLUXDB_PORT);
|
1479
|
|
- debug.print("/");
|
1480
|
|
- debug.print(INFLUXDB_DATABASE);
|
1481
|
|
- debug.println("/calibrated_filling");
|
1482
|
|
- }
|
|
1473
|
+ wifi_write_database(time_to_fill, "calibrated_filling", -1);
|
1483
|
1474
|
#endif // PLATFORM_ESP
|
1484
|
1475
|
}
|
1485
|
1476
|
|
|
@@ -1637,18 +1628,9 @@ void Statemachine::act(void) {
|
1637
|
1628
|
debug.print(String(time_to_water));
|
1638
|
1629
|
debug.println("ms");
|
1639
|
1630
|
|
1640
|
|
- #if defined(PLATFORM_ESP)
|
1641
|
|
- bool success = wifi_write_database(time_to_water, "calibrated_watering", selected_plants.getFirstSet() + 1);
|
1642
|
|
- if (!success) {
|
1643
|
|
- debug.print("Error writing to InfluxDB ");
|
1644
|
|
- debug.print(INFLUXDB_HOST);
|
1645
|
|
- debug.print(":");
|
1646
|
|
- debug.print(INFLUXDB_PORT);
|
1647
|
|
- debug.print("/");
|
1648
|
|
- debug.print(INFLUXDB_DATABASE);
|
1649
|
|
- debug.println("/calibrated_watering");
|
1650
|
|
- }
|
1651
|
|
- #endif // PLATFORM_ESP
|
|
1631
|
+#if defined(PLATFORM_ESP)
|
|
1632
|
+ wifi_write_database(time_to_water, "calibrated_watering", selected_plants.getFirstSet() + 1);
|
|
1633
|
+#endif // PLATFORM_ESP
|
1652
|
1634
|
}
|
1653
|
1635
|
}
|
1654
|
1636
|
|
|
@@ -1917,29 +1899,11 @@ void Statemachine::switch_to(States s) {
|
1917
|
1899
|
if ((old_state == auto_plant_run) || (old_state == fillnwater_plant_run)) {
|
1918
|
1900
|
for (int i = 0; i < plants.countPlants(); i++) {
|
1919
|
1901
|
if (selected_plants.isSet(i)) {
|
1920
|
|
- bool success = wifi_write_database(runtime / 1000, "plant", i + 1);
|
1921
|
|
- if (!success) {
|
1922
|
|
- debug.print("Error writing to InfluxDB ");
|
1923
|
|
- debug.print(INFLUXDB_HOST);
|
1924
|
|
- debug.print(":");
|
1925
|
|
- debug.print(INFLUXDB_PORT);
|
1926
|
|
- debug.print("/");
|
1927
|
|
- debug.print(INFLUXDB_DATABASE);
|
1928
|
|
- debug.println("/plant");
|
1929
|
|
- }
|
|
1902
|
+ wifi_write_database(runtime / 1000, "plant", i + 1);
|
1930
|
1903
|
}
|
1931
|
1904
|
}
|
1932
|
1905
|
} else if (old_state == auto_fert_run) {
|
1933
|
|
- bool success = wifi_write_database(runtime / 1000, "fertilizer", selected_id);
|
1934
|
|
- if (!success) {
|
1935
|
|
- debug.print("Error writing to InfluxDB ");
|
1936
|
|
- debug.print(INFLUXDB_HOST);
|
1937
|
|
- debug.print(":");
|
1938
|
|
- debug.print(INFLUXDB_PORT);
|
1939
|
|
- debug.print("/");
|
1940
|
|
- debug.print(INFLUXDB_DATABASE);
|
1941
|
|
- debug.println("/fertilizer");
|
1942
|
|
- }
|
|
1906
|
+ wifi_write_database(runtime / 1000, "fertilizer", selected_id);
|
1943
|
1907
|
}
|
1944
|
1908
|
#endif // PLATFORM_ESP
|
1945
|
1909
|
} else if (s == menu_pumps) {
|
|
@@ -1995,16 +1959,7 @@ void Statemachine::switch_to(States s) {
|
1995
|
1959
|
|
1996
|
1960
|
#if defined(PLATFORM_ESP)
|
1997
|
1961
|
unsigned long runtime = stop_time - start_time;
|
1998
|
|
- bool success = wifi_write_database(runtime / 1000, "fertilizer", selected_id);
|
1999
|
|
- if (!success) {
|
2000
|
|
- debug.print("Error writing to InfluxDB ");
|
2001
|
|
- debug.print(INFLUXDB_HOST);
|
2002
|
|
- debug.print(":");
|
2003
|
|
- debug.print(INFLUXDB_PORT);
|
2004
|
|
- debug.print("/");
|
2005
|
|
- debug.print(INFLUXDB_DATABASE);
|
2006
|
|
- debug.println("/fertilizer");
|
2007
|
|
- }
|
|
1962
|
+ wifi_write_database(runtime / 1000, "fertilizer", selected_id);
|
2008
|
1963
|
#endif // PLATFORM_ESP
|
2009
|
1964
|
} else if (s == menu_valves) {
|
2010
|
1965
|
String a = String(F("(Input 1 to ")) + String(plants.countPlants() + 1) + String(F(")"));
|
|
@@ -2060,16 +2015,7 @@ void Statemachine::switch_to(States s) {
|
2060
|
2015
|
#if defined(PLATFORM_ESP)
|
2061
|
2016
|
unsigned long runtime = stop_time - start_time;
|
2062
|
2017
|
if (selected_id <= plants.countPlants()) {
|
2063
|
|
- bool success = wifi_write_database(runtime / 1000, "plant", selected_id);
|
2064
|
|
- if (!success) {
|
2065
|
|
- debug.print("Error writing to InfluxDB ");
|
2066
|
|
- debug.print(INFLUXDB_HOST);
|
2067
|
|
- debug.print(":");
|
2068
|
|
- debug.print(INFLUXDB_PORT);
|
2069
|
|
- debug.print("/");
|
2070
|
|
- debug.print(INFLUXDB_DATABASE);
|
2071
|
|
- debug.println("/plant");
|
2072
|
|
- }
|
|
2018
|
+ wifi_write_database(runtime / 1000, "plant", selected_id);
|
2073
|
2019
|
}
|
2074
|
2020
|
#endif // PLATFORM_ESP
|
2075
|
2021
|
} else if (s == menu_aux) {
|