Merge branch 'main' into cud
This commit is contained in:
commit
abfa59f7da
|
@ -32,6 +32,7 @@ WebServer otaserver(80);
|
||||||
#endif
|
#endif
|
||||||
bool standalone = true;
|
bool standalone = true;
|
||||||
char MQTT_BASE_TOPIC[20];
|
char MQTT_BASE_TOPIC[20];
|
||||||
|
char AVAILABILITY_TOPIC[40];
|
||||||
uint8_t base_topic_length = 0;
|
uint8_t base_topic_length = 0;
|
||||||
char STATE_REQUEST_TOPIC[40];
|
char STATE_REQUEST_TOPIC[40];
|
||||||
bool MQTT_USE_AUTH = false;
|
bool MQTT_USE_AUTH = false;
|
||||||
|
@ -237,6 +238,7 @@ void loop()
|
||||||
*/
|
*/
|
||||||
void eeprom_retrieve_init()
|
void eeprom_retrieve_init()
|
||||||
{
|
{
|
||||||
|
|
||||||
// EEPROM Data Retrival
|
// EEPROM Data Retrival
|
||||||
#ifdef ENABLE_CLIMATE_MODULE
|
#ifdef ENABLE_CLIMATE_MODULE
|
||||||
ac_mode = ESPMega_FRAM.read8(EEPROM_ADDRESS_AC_MODE);
|
ac_mode = ESPMega_FRAM.read8(EEPROM_ADDRESS_AC_MODE);
|
||||||
|
@ -320,6 +322,8 @@ void eeprom_retrieve_init()
|
||||||
strcat(PWM_VALUE_TOPIC, "/pwm/00/value");
|
strcat(PWM_VALUE_TOPIC, "/pwm/00/value");
|
||||||
memcpy(INPUTS_TOPIC, MQTT_BASE_TOPIC, 20);
|
memcpy(INPUTS_TOPIC, MQTT_BASE_TOPIC, 20);
|
||||||
strcat(INPUTS_TOPIC, "/input/00");
|
strcat(INPUTS_TOPIC, "/input/00");
|
||||||
|
memcpy(AVAILABILITY_TOPIC, MQTT_BASE_TOPIC, 20);
|
||||||
|
strcat(AVAILABILITY_TOPIC, "/availability");
|
||||||
#ifdef ENABLE_ANALOG_MODULE
|
#ifdef ENABLE_ANALOG_MODULE
|
||||||
memcpy(ADC_COMMAND_TOPIC, MQTT_BASE_TOPIC, 20);
|
memcpy(ADC_COMMAND_TOPIC, MQTT_BASE_TOPIC, 20);
|
||||||
strcat(ADC_COMMAND_TOPIC, "/adc/00/set/state");
|
strcat(ADC_COMMAND_TOPIC, "/adc/00/set/state");
|
||||||
|
@ -567,13 +571,14 @@ void mqtt_connect()
|
||||||
Serial.print("MQTT not connected, connecting . . .\n");
|
Serial.print("MQTT not connected, connecting . . .\n");
|
||||||
lcd_send_stop_bit();
|
lcd_send_stop_bit();
|
||||||
if (MQTT_USE_AUTH)
|
if (MQTT_USE_AUTH)
|
||||||
mqtt.connect(HOSTNAME, MQTT_USERNAME, MQTT_PASSWORD);
|
mqtt.connect(HOSTNAME, MQTT_USERNAME, MQTT_PASSWORD, AVAILABILITY_TOPIC, 0, true, "offline");
|
||||||
else
|
else
|
||||||
mqtt.connect(HOSTNAME);
|
mqtt.connect(HOSTNAME, AVAILABILITY_TOPIC, 0, true, "offline");
|
||||||
if (mqtt.connected())
|
if (mqtt.connected())
|
||||||
{
|
{
|
||||||
mqtt_subscribe();
|
mqtt_subscribe();
|
||||||
Serial.print("MQTT connected\n");
|
Serial.print("MQTT connected\n");
|
||||||
|
mqtt.publish(AVAILABILITY_TOPIC, "online", true);
|
||||||
lcd_send_stop_bit();
|
lcd_send_stop_bit();
|
||||||
publish_pwm_states();
|
publish_pwm_states();
|
||||||
publish_input_states();
|
publish_input_states();
|
||||||
|
|
Loading…
Reference in New Issue