Commit eebc125f authored by Eric Duminil's avatar Eric Duminil
Browse files

More mqtt params

parent 1c1e5c9c
......@@ -15,11 +15,9 @@
#endif
namespace config {
// Values should be defined in config.h
uint16_t mqtt_sending_interval = MQTT_SENDING_INTERVAL; // [s]
// Values should be defined in config.h or over webconfig
//INFO: Listen to every CO2 sensor which is connected to the server:
// mosquitto_sub -h MQTT_SERVER -t 'CO2sensors/#' -p 443 --capath /etc/ssl/certs/ -u "MQTT_USER" -P "MQTT_PASSWORD" -v
const bool allow_mqtt_commands = ALLOW_MQTT_COMMANDS;
const unsigned long wait_after_fail = 900; // [s] Wait 15 minutes after an MQTT connection fail, before trying again.
}
......
......@@ -8,10 +8,6 @@
# define MQTT_ENCRYPTED true // Old config files might not define it, and encryption was on by default.
#endif
namespace config {
extern uint16_t mqtt_sending_interval; // [s]
}
namespace mqtt {
extern char last_successful_publish[];
extern bool connected;
......
......@@ -106,7 +106,7 @@ namespace web_config {
MQTT_SENDING_INTERVAL).min(0).step(1).defaultValue(300).placeholder("[s]").build();
CheckboxTParameter mqttCommandsParam =
Builder<CheckboxTParameter>("mqtt_commands").label("MQTT commands").defaultValue(false).build();
Builder<CheckboxTParameter>("mqtt_commands").label("MQTT commands").defaultValue(ALLOW_MQTT_COMMANDS).build();
TextTParameter<STRING_LEN> mqttServerParam =
Builder<TextTParameter<STRING_LEN>>("mqtt_server").label("MQTT Server").defaultValue(MQTT_SERVER).build();
......@@ -295,5 +295,7 @@ namespace config {
char *mqtt_user = web_config::mqttUserParam.value();
char *mqtt_password = web_config::mqttPasswordParam.value();
uint16_t &mqtt_port = web_config::mqttPortParam.value();
uint16_t &mqtt_sending_interval = web_config::mqttTimestepParam.value();
bool &allow_mqtt_commands = web_config::mqttCommandsParam.value();
}
......@@ -10,6 +10,8 @@
#endif
namespace config {
//CSV
//TODO: Add use_csv
extern uint16_t &csv_interval; // [s]
// Sensor
......@@ -30,10 +32,13 @@ namespace config {
extern bool &daylight_saving_time; // [true / false]
// MQTT
//TODO: Add use_mqtt
extern char *mqtt_server;
extern char *mqtt_user;
extern char *mqtt_password;
extern uint16_t &mqtt_port;
extern uint16_t &mqtt_sending_interval; // [s]
extern bool &allow_mqtt_commands; // [true / false]
}
namespace web_config {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment