mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
Remove the test.mosquitto.org URL in the MQTT settings #829
This commit is contained in:
@@ -24,8 +24,9 @@
|
||||
- Add more bus-ids [#673](https://github.com/emsesp/EMS-ESP32/issues/673)
|
||||
- Use HA connectivity device class for Status, added boot time [#751](https://github.com/emsesp/EMS-ESP32/issues/751)
|
||||
- Add commands for analog sensors outputs
|
||||
- Support for multiple EMS-ESPs with MQTT and HA [[#759](https://github.com/emsesp/EMS-ESP32/issues/759)]
|
||||
- Settings for heatpump silent mode and additional heater [[#802](https://github.com/emsesp/EMS-ESP32/issues/802)] [[#803](https://github.com/emsesp/EMS-ESP32/issues/803)]
|
||||
- Support for multiple EMS-ESPs with MQTT and HA [#759](https://github.com/emsesp/EMS-ESP32/issues/759)
|
||||
- Settings for heatpump silent mode and additional heater [#802](https://github.com/emsesp/EMS-ESP32/issues/802)] [[#803](https://github.com/emsesp/EMS-ESP32/issues/803)
|
||||
- Default MQTT hostname is blank [#829](https://github.com/emsesp/EMS-ESP32/issues/829)
|
||||
|
||||
## Fixed
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ build_flags =
|
||||
|
||||
; Access point settings
|
||||
-D FACTORY_AP_PROVISION_MODE=AP_MODE_DISCONNECTED
|
||||
-D FACTORY_AP_SSID=\"ems-esp\" ; 1-64 characters
|
||||
-D FACTORY_AP_PASSWORD=\"ems-esp-neo\" ; 8-64 characters
|
||||
-D FACTORY_AP_SSID=\"ems-esp\"
|
||||
-D FACTORY_AP_PASSWORD=\"ems-esp-neo\"
|
||||
-D FACTORY_AP_LOCAL_IP=\"192.168.4.1\"
|
||||
-D FACTORY_AP_GATEWAY_IP=\"192.168.4.1\"
|
||||
-D FACTORY_AP_SUBNET_MASK=\"255.255.255.0\"
|
||||
@@ -32,7 +32,7 @@ build_flags =
|
||||
|
||||
; MQTT settings
|
||||
-D FACTORY_MQTT_ENABLED=false
|
||||
-D FACTORY_MQTT_HOST=\"test.mosquitto.org\"
|
||||
-D FACTORY_MQTT_HOST=\"\"
|
||||
-D FACTORY_MQTT_PORT=1883
|
||||
-D FACTORY_MQTT_USERNAME=\"\"
|
||||
-D FACTORY_MQTT_PASSWORD=\"\"
|
||||
|
||||
@@ -4,7 +4,7 @@ import { ValidateFieldsError } from 'async-validator';
|
||||
import { Button, Checkbox, MenuItem, Grid, Typography, InputAdornment } from '@mui/material';
|
||||
import SaveIcon from '@mui/icons-material/Save';
|
||||
|
||||
import { MQTT_SETTINGS_VALIDATOR, validate } from '../../validators';
|
||||
import { createMqttSettingsValidator, validate } from '../../validators';
|
||||
import {
|
||||
BlockFormControlLabel,
|
||||
ButtonRow,
|
||||
@@ -39,7 +39,7 @@ const MqttSettingsForm: FC = () => {
|
||||
const validateAndSubmit = async () => {
|
||||
try {
|
||||
setFieldErrors(undefined);
|
||||
await validate(MQTT_SETTINGS_VALIDATOR, data);
|
||||
await validate(createMqttSettingsValidator(data), data);
|
||||
saveData();
|
||||
} catch (errors: any) {
|
||||
setFieldErrors(errors);
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import Schema from 'async-validator';
|
||||
import { MqttSettings } from '../types';
|
||||
import { IP_OR_HOSTNAME_VALIDATOR } from './shared';
|
||||
|
||||
export const MQTT_SETTINGS_VALIDATOR = new Schema({
|
||||
export const createMqttSettingsValidator = (mqttSettings: MqttSettings) =>
|
||||
new Schema({
|
||||
...(mqttSettings.enabled && {
|
||||
host: [{ required: true, message: 'Host is required' }, IP_OR_HOSTNAME_VALIDATOR],
|
||||
base: { required: true, message: 'Base is required' },
|
||||
port: [
|
||||
@@ -16,4 +19,5 @@ export const MQTT_SETTINGS_VALIDATOR = new Schema({
|
||||
{ required: true, message: 'Heartbeat is required' },
|
||||
{ type: 'number', min: 10, max: 86400, message: 'Heartbeat must be between 10 and 86400' }
|
||||
]
|
||||
})
|
||||
});
|
||||
|
||||
@@ -125,8 +125,8 @@ void MqttSettingsService::configureMqtt() {
|
||||
// disconnect if connected
|
||||
_mqttClient.disconnect();
|
||||
// only connect if WiFi is connected and MQTT is enabled
|
||||
if (_state.enabled && emsesp::EMSESP::system_.network_connected()) {
|
||||
// emsesp::EMSESP::logger().info("Configuring Mqtt client");
|
||||
if (_state.enabled && emsesp::EMSESP::system_.network_connected() && !_state.host.isEmpty()) {
|
||||
// emsesp::EMSESP::logger().info("Configuring MQTT client");
|
||||
_mqttClient.setServer(retainCstr(_state.host.c_str(), &_retainedHost), _state.port);
|
||||
if (_state.username.length() > 0) {
|
||||
_mqttClient.setCredentials(retainCstr(_state.username.c_str(), &_retainedUsername),
|
||||
@@ -140,7 +140,7 @@ void MqttSettingsService::configureMqtt() {
|
||||
_mqttClient.setMaxTopicLength(FACTORY_MQTT_MAX_TOPIC_LENGTH); // hardcode. We don't take this from the settings anymore.
|
||||
_mqttClient.connect();
|
||||
// } else {
|
||||
// emsesp::EMSESP::logger().info("Error configuring Mqtt client");
|
||||
// emsesp::EMSESP::logger().info("Error configuring MQTT client");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef FACTORY_MQTT_HOST
|
||||
#define FACTORY_MQTT_HOST "test.mosquitto.org"
|
||||
#define FACTORY_MQTT_HOST "" // is blank
|
||||
#endif
|
||||
|
||||
#ifndef FACTORY_MQTT_PORT
|
||||
|
||||
Reference in New Issue
Block a user