remove max_topic_length, make base mandatory

This commit is contained in:
Proddy
2022-11-29 21:14:08 +01:00
parent 6b978759ca
commit c9ef0bcd7b
5 changed files with 4 additions and 11 deletions

View File

@@ -72,11 +72,11 @@ export const createSettingsValidator = (settings: Settings) =>
syslog_host: [{ required: true, message: 'Host is required' }, IP_OR_HOSTNAME_VALIDATOR],
syslog_port: [
{ required: true, message: 'Port is required' },
{ type: 'number', min: 0, max: 65535, message: 'Port must be between 0 and 65535' }
{ type: 'number', min: 0, max: 65535, message: 'Invalid Port' }
],
syslog_mark_interval: [
{ required: true, message: 'Mark interval is required' },
{ type: 'number', min: 0, max: 10, message: 'Port must be between 0 and 10' }
{ type: 'number', min: 0, max: 10, message: ' must be between 0 and 10' }
]
}),
...(settings.shower_alert && {

View File

@@ -29,7 +29,6 @@ export interface MqttSettings {
client_id: string;
keep_alive: number;
clean_session: boolean;
max_topic_length: number;
publish_time_boiler: number;
publish_time_thermostat: number;
publish_time_solar: number;

View File

@@ -3,16 +3,13 @@ import { IP_OR_HOSTNAME_VALIDATOR } from './shared';
export const MQTT_SETTINGS_VALIDATOR = new Schema({
host: [{ required: true, message: 'Host is required' }, IP_OR_HOSTNAME_VALIDATOR],
base: { required: true, message: 'Base is required' },
port: [
{ required: true, message: 'Port is required' },
{ type: 'number', min: 0, max: 65535, message: 'Port must be between 0 and 65535' }
{ type: 'number', min: 0, max: 65535, message: 'Invalid Port' }
],
keep_alive: [
{ required: true, message: 'Keep alive is required' },
{ type: 'number', min: 1, max: 86400, message: 'Keep alive must be between 1 and 86400' }
],
max_topic_length: [
{ required: true, message: 'Max topic length is required' },
{ type: 'number', min: 16, max: 1024, message: 'Max topic length must be between 16 and 1024' }
]
});

View File

@@ -154,7 +154,6 @@ void MqttSettings::read(MqttSettings & settings, JsonObject & root) {
root["client_id"] = settings.clientId;
root["keep_alive"] = settings.keepAlive;
root["clean_session"] = settings.cleanSession;
root["max_topic_length"] = settings.maxTopicLength;
// added by proddy for EMS-ESP
root["publish_time_boiler"] = settings.publish_time_boiler;
@@ -186,7 +185,6 @@ StateUpdateResult MqttSettings::update(JsonObject & root, MqttSettings & setting
newSettings.clientId = root["client_id"] | FACTORY_MQTT_CLIENT_ID;
newSettings.keepAlive = root["keep_alive"] | FACTORY_MQTT_KEEP_ALIVE;
newSettings.cleanSession = root["clean_session"] | FACTORY_MQTT_CLEAN_SESSION;
newSettings.maxTopicLength = root["max_topic_length"] | FACTORY_MQTT_MAX_TOPIC_LENGTH;
newSettings.mqtt_qos = root["mqtt_qos"] | EMSESP_DEFAULT_MQTT_QOS;
newSettings.mqtt_retain = root["mqtt_retain"] | EMSESP_DEFAULT_MQTT_RETAIN;

View File

@@ -219,7 +219,6 @@ mqtt_settings = {
client_id: 'ems-esp',
keep_alive: 60,
clean_session: true,
max_topic_length: 128,
publish_time_boiler: 10,
publish_time_thermostat: 10,
publish_time_solar: 10,