Update espmega_iot_core.cpp
This commit is contained in:
parent
cc418fa74c
commit
eed04d8795
|
@ -24,6 +24,8 @@ const char MQTT_USERNAME[] = "username";
|
|||
const char MQTT_PASSWORD[] = "password";
|
||||
#endif
|
||||
uint8_t utc_offset = 7;
|
||||
float current_room_temp = 0;
|
||||
float current_room_humid = 0;
|
||||
|
||||
// Inputs
|
||||
#define VINT_COUNT 16
|
||||
|
@ -742,17 +744,20 @@ void publish_env_state()
|
|||
switch (errorCode)
|
||||
{
|
||||
case DHTLIB_OK:
|
||||
mqtt.publish(String(AC_ROOM_TEMPERATURE_TOPIC), String(env_sensor.getTemperature()));
|
||||
current_room_humid = env_sensor.getHumidity();
|
||||
current_room_temp = env_sensor.getTemperature();
|
||||
mqtt.publish(String(AC_ROOM_TEMPERATURE_TOPIC), String(current_room_temp));
|
||||
mqtt_client.loop();
|
||||
mqtt.publish(String(AC_HUMIDITY_TOPIC), String(env_sensor.getHumidity()));
|
||||
mqtt.publish(String(AC_HUMIDITY_TOPIC), String(current_room_humid));
|
||||
mqtt_client.loop();
|
||||
if(lcd_current_page==4) {
|
||||
if (lcd_current_page == 4)
|
||||
{
|
||||
Serial.print("roomtemp.txt=\"");
|
||||
Serial.print(env_sensor.getTemperature());
|
||||
Serial.print(current_room_temp);
|
||||
Serial.print("C\"");
|
||||
lcd_send_stop_bit();
|
||||
Serial.print("roomhumid.txt=\"");
|
||||
Serial.print(env_sensor.getHumidity());
|
||||
Serial.print(current_room_humid);
|
||||
Serial.print("%\"");
|
||||
lcd_send_stop_bit();
|
||||
}
|
||||
|
@ -818,6 +823,14 @@ void lcd_refresh()
|
|||
}
|
||||
break;
|
||||
case 4:
|
||||
Serial.print("roomtemp.txt=\"");
|
||||
Serial.print(current_room_temp);
|
||||
Serial.print("C\"");
|
||||
lcd_send_stop_bit();
|
||||
Serial.print("roomhumid.txt=\"");
|
||||
Serial.print(current_room_humid);
|
||||
Serial.print("%\"");
|
||||
lcd_send_stop_bit();
|
||||
if (ac_mode != 2)
|
||||
panel.writeStr("temp.txt", String(ac_temperature) + "C");
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue