mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
add multiple_sessions
This commit is contained in:
@@ -162,6 +162,10 @@ const MqttSettingsForm: FC = () => {
|
|||||||
</ValidatedTextField>
|
</ValidatedTextField>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
<BlockFormControlLabel
|
||||||
|
control={<Checkbox name="multiple_instances" checked={data.multiple_instances} onChange={updateFormValue} />}
|
||||||
|
label={LL.MQTT_MULTIPLE_INSTANCES()}
|
||||||
|
/>
|
||||||
<BlockFormControlLabel
|
<BlockFormControlLabel
|
||||||
control={<Checkbox name="clean_session" checked={data.clean_session} onChange={updateFormValue} />}
|
control={<Checkbox name="clean_session" checked={data.clean_session} onChange={updateFormValue} />}
|
||||||
label={LL.MQTT_CLEAN_SESSION()}
|
label={LL.MQTT_CLEAN_SESSION()}
|
||||||
|
|||||||
@@ -247,6 +247,7 @@ const de: Translation = {
|
|||||||
MQTT_INT_MIXER: 'Mischermodule',
|
MQTT_INT_MIXER: 'Mischermodule',
|
||||||
MQTT_QUEUE: 'MQTT Queue',
|
MQTT_QUEUE: 'MQTT Queue',
|
||||||
DEFAULT: 'Standard',
|
DEFAULT: 'Standard',
|
||||||
|
MQTT_MULTIPLE_INSTANCES: 'Enable Multiple Instances of EMS-ESP',
|
||||||
MQTT_CLEAN_SESSION: 'Setze `Clean Session`',
|
MQTT_CLEAN_SESSION: 'Setze `Clean Session`',
|
||||||
MQTT_RETAIN_FLAG: 'Setze `Retain flag` immer',
|
MQTT_RETAIN_FLAG: 'Setze `Retain flag` immer',
|
||||||
INACTIVE: 'Inaktiv',
|
INACTIVE: 'Inaktiv',
|
||||||
|
|||||||
@@ -247,6 +247,7 @@ const en: Translation = {
|
|||||||
MQTT_INT_MIXER: 'Mixer Modules',
|
MQTT_INT_MIXER: 'Mixer Modules',
|
||||||
MQTT_QUEUE: 'MQTT Queue',
|
MQTT_QUEUE: 'MQTT Queue',
|
||||||
DEFAULT: 'Default',
|
DEFAULT: 'Default',
|
||||||
|
MQTT_MULTIPLE_INSTANCES: 'Enable Multiple Instances of EMS-ESP',
|
||||||
MQTT_CLEAN_SESSION: 'Set Clean Session',
|
MQTT_CLEAN_SESSION: 'Set Clean Session',
|
||||||
MQTT_RETAIN_FLAG: 'Always set Retain flag',
|
MQTT_RETAIN_FLAG: 'Always set Retain flag',
|
||||||
INACTIVE: 'Inactive',
|
INACTIVE: 'Inactive',
|
||||||
|
|||||||
@@ -247,6 +247,7 @@ const nl: Translation = {
|
|||||||
MQTT_INT_MIXER: 'Mixer Modules',
|
MQTT_INT_MIXER: 'Mixer Modules',
|
||||||
MQTT_QUEUE: 'MQTT Queue',
|
MQTT_QUEUE: 'MQTT Queue',
|
||||||
DEFAULT: 'Default',
|
DEFAULT: 'Default',
|
||||||
|
MQTT_MULTIPLE_INSTANCES: 'Enable Multiple Instances of EMS-ESP',
|
||||||
MQTT_CLEAN_SESSION: 'Clean Session aan',
|
MQTT_CLEAN_SESSION: 'Clean Session aan',
|
||||||
MQTT_RETAIN_FLAG: 'Retain flag aan',
|
MQTT_RETAIN_FLAG: 'Retain flag aan',
|
||||||
INACTIVE: 'Inactief',
|
INACTIVE: 'Inactief',
|
||||||
|
|||||||
@@ -247,6 +247,7 @@ const no: Translation = {
|
|||||||
MQTT_INT_MIXER: 'Blandeventil',
|
MQTT_INT_MIXER: 'Blandeventil',
|
||||||
MQTT_QUEUE: 'MQTT Queue',
|
MQTT_QUEUE: 'MQTT Queue',
|
||||||
DEFAULT: 'Standard',
|
DEFAULT: 'Standard',
|
||||||
|
MQTT_MULTIPLE_INSTANCES: 'Enable Multiple Instances of EMS-ESP',
|
||||||
MQTT_CLEAN_SESSION: 'Benytt Clean Session',
|
MQTT_CLEAN_SESSION: 'Benytt Clean Session',
|
||||||
MQTT_RETAIN_FLAG: 'Alltid sett Retain flag',
|
MQTT_RETAIN_FLAG: 'Alltid sett Retain flag',
|
||||||
INACTIVE: 'Innaktiv',
|
INACTIVE: 'Innaktiv',
|
||||||
|
|||||||
@@ -247,6 +247,7 @@ const pl: BaseTranslation = {
|
|||||||
MQTT_INT_MIXER: 'Mieszacze',
|
MQTT_INT_MIXER: 'Mieszacze',
|
||||||
MQTT_QUEUE: 'Kolejka MQTT',
|
MQTT_QUEUE: 'Kolejka MQTT',
|
||||||
DEFAULT: '{{Pozostałe|Domyślna|}}',
|
DEFAULT: '{{Pozostałe|Domyślna|}}',
|
||||||
|
MQTT_MULTIPLE_INSTANCES: 'Enable Multiple Instances of EMS-ESP',
|
||||||
MQTT_CLEAN_SESSION: 'Ustawiaj flagę "Clean session"',
|
MQTT_CLEAN_SESSION: 'Ustawiaj flagę "Clean session"',
|
||||||
MQTT_RETAIN_FLAG: 'Ustawiaj flagę "Retain"',
|
MQTT_RETAIN_FLAG: 'Ustawiaj flagę "Retain"',
|
||||||
INACTIVE: 'nieaktywny',
|
INACTIVE: 'nieaktywny',
|
||||||
|
|||||||
@@ -247,6 +247,7 @@ const se: Translation = {
|
|||||||
MQTT_INT_MIXER: 'Blandarventiler',
|
MQTT_INT_MIXER: 'Blandarventiler',
|
||||||
MQTT_QUEUE: 'MQTT Queue',
|
MQTT_QUEUE: 'MQTT Queue',
|
||||||
DEFAULT: 'Standard',
|
DEFAULT: 'Standard',
|
||||||
|
MQTT_MULTIPLE_INSTANCES: 'Enable Multiple Instances of EMS-ESP',
|
||||||
MQTT_CLEAN_SESSION: 'Använd "Clean Session"-flaggan',
|
MQTT_CLEAN_SESSION: 'Använd "Clean Session"-flaggan',
|
||||||
MQTT_RETAIN_FLAG: 'Använd "Always Retain"-flaggan',
|
MQTT_RETAIN_FLAG: 'Använd "Always Retain"-flaggan',
|
||||||
INACTIVE: 'Inaktiv',
|
INACTIVE: 'Inaktiv',
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ export interface MqttSettings {
|
|||||||
client_id: string;
|
client_id: string;
|
||||||
keep_alive: number;
|
keep_alive: number;
|
||||||
clean_session: boolean;
|
clean_session: boolean;
|
||||||
|
multiple_instances: boolean;
|
||||||
publish_time_boiler: number;
|
publish_time_boiler: number;
|
||||||
publish_time_thermostat: number;
|
publish_time_thermostat: number;
|
||||||
publish_time_solar: number;
|
publish_time_solar: number;
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ void MqttSettings::read(MqttSettings & settings, JsonObject & root) {
|
|||||||
root["client_id"] = settings.clientId;
|
root["client_id"] = settings.clientId;
|
||||||
root["keep_alive"] = settings.keepAlive;
|
root["keep_alive"] = settings.keepAlive;
|
||||||
root["clean_session"] = settings.cleanSession;
|
root["clean_session"] = settings.cleanSession;
|
||||||
|
root["multiple_instances"] = settings.multiple_instances;
|
||||||
|
|
||||||
// added by proddy for EMS-ESP
|
// added by proddy for EMS-ESP
|
||||||
root["publish_time_boiler"] = settings.publish_time_boiler;
|
root["publish_time_boiler"] = settings.publish_time_boiler;
|
||||||
@@ -185,6 +186,8 @@ StateUpdateResult MqttSettings::update(JsonObject & root, MqttSettings & setting
|
|||||||
newSettings.clientId = root["client_id"] | FACTORY_MQTT_CLIENT_ID;
|
newSettings.clientId = root["client_id"] | FACTORY_MQTT_CLIENT_ID;
|
||||||
newSettings.keepAlive = root["keep_alive"] | FACTORY_MQTT_KEEP_ALIVE;
|
newSettings.keepAlive = root["keep_alive"] | FACTORY_MQTT_KEEP_ALIVE;
|
||||||
newSettings.cleanSession = root["clean_session"] | FACTORY_MQTT_CLEAN_SESSION;
|
newSettings.cleanSession = root["clean_session"] | FACTORY_MQTT_CLEAN_SESSION;
|
||||||
|
newSettings.multiple_instances = root["multiple_instances"] | FACTORY_MQTT_MULTIPLE_INSTANCES;
|
||||||
|
|
||||||
newSettings.mqtt_qos = root["mqtt_qos"] | EMSESP_DEFAULT_MQTT_QOS;
|
newSettings.mqtt_qos = root["mqtt_qos"] | EMSESP_DEFAULT_MQTT_QOS;
|
||||||
newSettings.mqtt_retain = root["mqtt_retain"] | EMSESP_DEFAULT_MQTT_RETAIN;
|
newSettings.mqtt_retain = root["mqtt_retain"] | EMSESP_DEFAULT_MQTT_RETAIN;
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,10 @@ static String generateClientId() {
|
|||||||
#define FACTORY_MQTT_MAX_TOPIC_LENGTH 128
|
#define FACTORY_MQTT_MAX_TOPIC_LENGTH 128
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef FACTORY_MQTT_MULTIPLE_INSTANCES
|
||||||
|
#define FACTORY_MQTT_MULTIPLE_INSTANCES false
|
||||||
|
#endif
|
||||||
|
|
||||||
class MqttSettings {
|
class MqttSettings {
|
||||||
public:
|
public:
|
||||||
// host and port - if enabled
|
// host and port - if enabled
|
||||||
@@ -75,6 +79,9 @@ class MqttSettings {
|
|||||||
uint16_t keepAlive;
|
uint16_t keepAlive;
|
||||||
bool cleanSession;
|
bool cleanSession;
|
||||||
|
|
||||||
|
// multiple instances
|
||||||
|
bool multiple_instances;
|
||||||
|
|
||||||
// proddy EMS-ESP specific
|
// proddy EMS-ESP specific
|
||||||
String base;
|
String base;
|
||||||
uint16_t publish_time_boiler;
|
uint16_t publish_time_boiler;
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ class DummySettings {
|
|||||||
String username = "";
|
String username = "";
|
||||||
uint16_t keepAlive = 60;
|
uint16_t keepAlive = 60;
|
||||||
bool cleanSession = false;
|
bool cleanSession = false;
|
||||||
|
bool multiple_instances = false;
|
||||||
|
|
||||||
uint16_t publish_time_boiler = 10;
|
uint16_t publish_time_boiler = 10;
|
||||||
uint16_t publish_time_thermostat = 10;
|
uint16_t publish_time_thermostat = 10;
|
||||||
|
|||||||
@@ -219,6 +219,7 @@ mqtt_settings = {
|
|||||||
client_id: 'ems-esp',
|
client_id: 'ems-esp',
|
||||||
keep_alive: 60,
|
keep_alive: 60,
|
||||||
clean_session: true,
|
clean_session: true,
|
||||||
|
multiple_instances: false,
|
||||||
publish_time_boiler: 10,
|
publish_time_boiler: 10,
|
||||||
publish_time_thermostat: 10,
|
publish_time_thermostat: 10,
|
||||||
publish_time_solar: 10,
|
publish_time_solar: 10,
|
||||||
|
|||||||
@@ -1153,6 +1153,7 @@ bool System::command_info(const char * value, const int8_t id, JsonObject & outp
|
|||||||
node["client id"] = settings.clientId;
|
node["client id"] = settings.clientId;
|
||||||
node["keep alive"] = settings.keepAlive;
|
node["keep alive"] = settings.keepAlive;
|
||||||
node["clean session"] = settings.cleanSession;
|
node["clean session"] = settings.cleanSession;
|
||||||
|
node["multiple instances"] = settings.multiple_instances;
|
||||||
node["base"] = settings.base;
|
node["base"] = settings.base;
|
||||||
node["discovery prefix"] = settings.discovery_prefix;
|
node["discovery prefix"] = settings.discovery_prefix;
|
||||||
node["nested format"] = settings.nested_format;
|
node["nested format"] = settings.nested_format;
|
||||||
|
|||||||
Reference in New Issue
Block a user