mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-09-13 05:34:34 +00:00
Merge branch 'dev' into dev
This commit is contained in:
@@ -25,6 +25,7 @@ This release is based on the latest Espressif/Arduino core version 3. It brings
|
||||
- "IPv4 nameserver" showed an IPv6 address when IPv6 was in use
|
||||
- HA Discovery warning on Uptime after EMS-ESP boot due to NTP not ready
|
||||
- hc/control setting for UI800 thermostats [#3181](https://github.com/emsesp/EMS-ESP32/discussions/3181)
|
||||
- solar module switches [#3223](https://github.com/emsesp/EMS-ESP32/issues/3223)
|
||||
|
||||
## Changed
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ void MqttSettingsService::loop() {
|
||||
}
|
||||
if (_reconfigureMqtt || (_disconnectedAt && static_cast<uint32_t>(uuid::get_uptime() - _disconnectedAt) >= MQTT_RECONNECTION_DELAY)) {
|
||||
// configure MQTT client
|
||||
if (_reconfigureMqtt) {
|
||||
if (_reconfigureMqtt && _state.enabled) {
|
||||
emsesp::EMSESP::logger().info("Starting MQTT service");
|
||||
}
|
||||
_disconnectedAt = configureMqtt() ? 0 : uuid::get_uptime();
|
||||
@@ -130,6 +130,7 @@ MqttClient * MqttSettingsService::getMqttClient() {
|
||||
void MqttSettingsService::onMqttConnect(bool sessionPresent) {
|
||||
(void)sessionPresent;
|
||||
emsesp::EMSESP::mqtt_.on_connect();
|
||||
_disconnectReason = espMqttClientTypes::DisconnectReason::USER_OK;
|
||||
}
|
||||
|
||||
void MqttSettingsService::onMqttDisconnect(espMqttClientTypes::DisconnectReason reason) {
|
||||
@@ -158,6 +159,9 @@ bool MqttSettingsService::configureMqtt() {
|
||||
emsesp::EMSESP::logger().debug("Disconnecting to configure");
|
||||
#endif
|
||||
_mqttClient->disconnect(true);
|
||||
if (!_state.enabled) {
|
||||
emsesp::EMSESP::logger().info("Stopping MQTT client");
|
||||
}
|
||||
}
|
||||
|
||||
// only connect if WiFi is connected and MQTT is enabled
|
||||
|
||||
+8
-2
@@ -1741,9 +1741,15 @@ void EMSESP::start() {
|
||||
#endif
|
||||
|
||||
// start NVS storage
|
||||
if (!nvs_.begin("ems-esp", false, "nvs1")) { // try bigger nvs partition on 16M flash first
|
||||
nvs_.begin("ems-esp", false, "nvs"); // fallback to small nvs
|
||||
#ifndef EMSESP_STANDALONE
|
||||
if (esp_partition_find(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_NVS, "nvs1")) {
|
||||
nvs_.begin("ems-esp", false, "nvs1");
|
||||
} else {
|
||||
nvs_.begin("ems-esp", false, "nvs"); // fallback to small nvs
|
||||
}
|
||||
#else
|
||||
nvs_.begin("ems-esp", false, "nvs");
|
||||
#endif
|
||||
|
||||
// set valid GPIOs list based on ESP32 chip/platform type
|
||||
system_.set_valid_system_gpios();
|
||||
|
||||
+1
-1
@@ -867,7 +867,7 @@ bool System::loop() {
|
||||
void System::send_info_mqtt() {
|
||||
static uint8_t _connection = 0;
|
||||
uint8_t connection = (EMSESP::network_.ethernet_connected() ? 1 : 0) + (EMSESP::network_.wifi_connected() ? 2 : 0) + (ntp_connected_ ? 4 : 0)
|
||||
+ (EMSESP::network_.has_ipv6() ? 8 : 0);
|
||||
+ (EMSESP::network_.has_ipv6() ? 8 : 0);
|
||||
// check if connection status has changed
|
||||
if (!Mqtt::connected() || connection == _connection) {
|
||||
return;
|
||||
|
||||
@@ -935,7 +935,7 @@ bool Solar::set_heatTransferSystem(const char * value, const int8_t id) {
|
||||
if (!Helpers::value2bool(value, b)) {
|
||||
return false;
|
||||
}
|
||||
write_command(0x358, 5, b ? 0x01 : 0x00, 0x358);
|
||||
write_command(0x358, 5, b ? 0xFF : 0x00); // change is broadcasted
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -945,7 +945,7 @@ bool Solar::set_externalCyl(const char * value, const int8_t id) {
|
||||
if (!Helpers::value2bool(value, b)) {
|
||||
return false;
|
||||
}
|
||||
write_command(0x358, 9, b ? 0x01 : 0x00, 0x358);
|
||||
write_command(0x358, 9, b ? 0xFF : 0x00); // change is broadcasted
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -955,7 +955,7 @@ bool Solar::set_thermalDisinfect(const char * value, const int8_t id) {
|
||||
if (!Helpers::value2bool(value, b)) {
|
||||
return false;
|
||||
}
|
||||
write_command(0x358, 10, b ? 0x01 : 0x00, 0x358);
|
||||
write_command(0x358, 10, b ? 0xFF : 0x00); // change is broadcasted
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -965,7 +965,7 @@ bool Solar::set_heatMetering(const char * value, const int8_t id) {
|
||||
if (!Helpers::value2bool(value, b)) {
|
||||
return false;
|
||||
}
|
||||
write_command(0x358, 14, b ? 0x01 : 0x00, 0x358);
|
||||
write_command(0x358, 14, b ? 0xFF : 0x00); // change is broadcasted
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -978,7 +978,7 @@ bool Solar::set_solarEnabled(const char * value, const int8_t id) {
|
||||
if (flags() == EMSdevice::EMS_DEVICE_FLAG_SM10) {
|
||||
write_command(0x96, 0, b ? 0xFF : 0x00, 0x96);
|
||||
} else {
|
||||
write_command(0x358, 19, b ? 0x01 : 0x00, 0x358);
|
||||
write_command(0x358, 19, b ? 0xFF : 0x00); // change is broadcasted
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user