kopia lustrzana https://github.com/martin-ger/esp_mqtt
longer mqtt_id
rodzic
325923773f
commit
2d613c3f90
|
@ -4,3 +4,5 @@ build/
|
||||||
.settings/
|
.settings/
|
||||||
.DS_Store
|
.DS_Store
|
||||||
include/user_config.local.h
|
include/user_config.local.h
|
||||||
|
scripts/script.demo
|
||||||
|
scripts/script.timers
|
||||||
|
|
Plik binarny nie jest wyświetlany.
Plik binarny nie jest wyświetlany.
|
@ -1,2 +1,2 @@
|
||||||
7163ff45862ab01f061e256cd16ad1e083fe8df0 0x00000.bin
|
834399a6fc66a609ab06b6ac58e0e371d853d256 0x00000.bin
|
||||||
92fdb9a489a04461351fff59ac94adc618a3d17d 0x10000.bin
|
bad4fb09c6ac1b86e06de459e570fe3aee8186e0 0x10000.bin
|
||||||
|
|
32
user/cli.c
32
user/cli.c
|
@ -909,8 +909,8 @@ void ICACHE_FLASH_ATTR console_handle_command(struct espconn *pespconn) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(tokens[1], "broker_user") == 0) {
|
if (strcmp(tokens[1], "broker_user") == 0) {
|
||||||
os_strncpy(config.mqtt_broker_user, tokens[2], 32);
|
os_strncpy(config.mqtt_broker_user, tokens[2], sizeof(config.mqtt_broker_user));
|
||||||
config.mqtt_broker_user[31] = '\0';
|
config.mqtt_broker_user[sizeof(config.mqtt_broker_user)-1] = '\0';
|
||||||
os_sprintf_flash(response, "Broker username set\r\n");
|
os_sprintf_flash(response, "Broker username set\r\n");
|
||||||
goto command_handled;
|
goto command_handled;
|
||||||
}
|
}
|
||||||
|
@ -919,8 +919,8 @@ void ICACHE_FLASH_ATTR console_handle_command(struct espconn *pespconn) {
|
||||||
if (os_strcmp(tokens[2], "none") == 0) {
|
if (os_strcmp(tokens[2], "none") == 0) {
|
||||||
config.mqtt_broker_password[0] = '\0';
|
config.mqtt_broker_password[0] = '\0';
|
||||||
} else {
|
} else {
|
||||||
os_strncpy(config.mqtt_broker_password, tokens[2], 32);
|
os_strncpy(config.mqtt_broker_password, tokens[2], sizeof(config.mqtt_broker_password));
|
||||||
config.mqtt_broker_password[31] = '\0';
|
config.mqtt_broker_password[sizeof(config.mqtt_broker_password)-1] = '\0';
|
||||||
}
|
}
|
||||||
os_sprintf_flash(response, "Broker password set\r\n");
|
os_sprintf_flash(response, "Broker password set\r\n");
|
||||||
goto command_handled;
|
goto command_handled;
|
||||||
|
@ -993,8 +993,8 @@ void ICACHE_FLASH_ATTR console_handle_command(struct espconn *pespconn) {
|
||||||
#endif
|
#endif
|
||||||
#ifdef NTP
|
#ifdef NTP
|
||||||
if (strcmp(tokens[1], "ntp_server") == 0) {
|
if (strcmp(tokens[1], "ntp_server") == 0) {
|
||||||
os_strncpy(config.ntp_server, tokens[2], 32);
|
os_strncpy(config.ntp_server, tokens[2], sizeof(config.ntp_server));
|
||||||
config.ntp_server[31] = 0;
|
config.ntp_server[sizeof(config.ntp_server)-1] = '\0';
|
||||||
ntp_set_server(config.ntp_server);
|
ntp_set_server(config.ntp_server);
|
||||||
os_sprintf(response, "NTP server set to %s\r\n", config.ntp_server);
|
os_sprintf(response, "NTP server set to %s\r\n", config.ntp_server);
|
||||||
goto command_handled;
|
goto command_handled;
|
||||||
|
@ -1036,16 +1036,16 @@ void ICACHE_FLASH_ATTR console_handle_command(struct espconn *pespconn) {
|
||||||
#endif
|
#endif
|
||||||
#ifdef DNS_RESP
|
#ifdef DNS_RESP
|
||||||
if (strcmp(tokens[1], "dns_name") == 0) {
|
if (strcmp(tokens[1], "dns_name") == 0) {
|
||||||
os_strncpy(config.broker_dns_name, tokens[2], 32);
|
os_strncpy(config.broker_dns_name, tokens[2], sizeof(config.broker_dns_name));
|
||||||
config.mqtt_host[31] = 0;
|
config.mqtt_host[sizeof(config.broker_dns_name)-1] = '\0';
|
||||||
os_sprintf_flash(response, "DNS name set\r\n");
|
os_sprintf_flash(response, "DNS name set\r\n");
|
||||||
goto command_handled;
|
goto command_handled;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef MQTT_CLIENT
|
#ifdef MQTT_CLIENT
|
||||||
if (strcmp(tokens[1], "mqtt_host") == 0) {
|
if (strcmp(tokens[1], "mqtt_host") == 0) {
|
||||||
os_strncpy(config.mqtt_host, tokens[2], 32);
|
os_strncpy(config.mqtt_host, tokens[2], sizeof(config.mqtt_host));
|
||||||
config.mqtt_host[31] = 0;
|
config.mqtt_host[sizeof(config.mqtt_host)-1] = '\0';
|
||||||
os_sprintf_flash(response, "MQTT host set\r\n");
|
os_sprintf_flash(response, "MQTT host set\r\n");
|
||||||
goto command_handled;
|
goto command_handled;
|
||||||
}
|
}
|
||||||
|
@ -1063,22 +1063,22 @@ void ICACHE_FLASH_ATTR console_handle_command(struct espconn *pespconn) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(tokens[1], "mqtt_user") == 0) {
|
if (strcmp(tokens[1], "mqtt_user") == 0) {
|
||||||
os_strncpy(config.mqtt_user, tokens[2], 32);
|
os_strncpy(config.mqtt_user, tokens[2], sizeof(config.mqtt_user));
|
||||||
config.mqtt_user[31] = 0;
|
config.mqtt_user[sizeof(config.mqtt_user)-1] = '\0';
|
||||||
os_sprintf_flash(response, "MQTT user set\r\n");
|
os_sprintf_flash(response, "MQTT user set\r\n");
|
||||||
goto command_handled;
|
goto command_handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(tokens[1], "mqtt_password") == 0) {
|
if (strcmp(tokens[1], "mqtt_password") == 0) {
|
||||||
os_strncpy(config.mqtt_password, tokens[2], 32);
|
os_strncpy(config.mqtt_password, tokens[2], sizeof(config.mqtt_password));
|
||||||
config.mqtt_password[31] = 0;
|
config.mqtt_password[sizeof(config.mqtt_password)-1] = '\0';
|
||||||
os_sprintf_flash(response, "MQTT password set\r\n");
|
os_sprintf_flash(response, "MQTT password set\r\n");
|
||||||
goto command_handled;
|
goto command_handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(tokens[1], "mqtt_id") == 0) {
|
if (strcmp(tokens[1], "mqtt_id") == 0) {
|
||||||
os_strncpy(config.mqtt_id, tokens[2], 32);
|
os_strncpy(config.mqtt_id, tokens[2], sizeof(config.mqtt_id));
|
||||||
config.mqtt_id[31] = 0;
|
config.mqtt_id[sizeof(config.mqtt_id)-1] = '\0';
|
||||||
os_sprintf_flash(response, "MQTT id set\r\n");
|
os_sprintf_flash(response, "MQTT id set\r\n");
|
||||||
goto command_handled;
|
goto command_handled;
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,13 +87,13 @@ int ICACHE_FLASH_ATTR config_load(sysconfig_p config) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
os_printf("\r\nConfig found and loaded\r\n");
|
os_printf("\r\nConfig found and loaded\r\n");
|
||||||
spi_flash_read(base_address * SPI_FLASH_SEC_SIZE, (uint32 *) config, sizeof(sysconfig_t));
|
spi_flash_read(base_address * SPI_FLASH_SEC_SIZE, (uint32 *) config, sizeof(sysconfig_t));
|
||||||
if (config->length != sizeof(sysconfig_t)) {
|
if (config->length != sizeof(sysconfig_t)) {
|
||||||
os_printf("Length Mismatch, probably old version of config, loading defaults\r\n");
|
os_printf("Length Mismatch, probably old version of config, loading defaults\r\n");
|
||||||
config_load_default(config);
|
config_load_default(config);
|
||||||
config_save(config);
|
config_save(config);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ typedef struct
|
||||||
|
|
||||||
uint8_t mqtt_user[32]; // Username for broker login, "none" if empty
|
uint8_t mqtt_user[32]; // Username for broker login, "none" if empty
|
||||||
uint8_t mqtt_password[32]; // Password for broker login
|
uint8_t mqtt_password[32]; // Password for broker login
|
||||||
uint8_t mqtt_id[32]; // MQTT clientId
|
uint8_t mqtt_id[48]; // MQTT clientId
|
||||||
#endif
|
#endif
|
||||||
#ifdef NTP
|
#ifdef NTP
|
||||||
uint8_t ntp_server[32]; // IP or hostname of the MQTT broker, "none" if empty
|
uint8_t ntp_server[32]; // IP or hostname of the MQTT broker, "none" if empty
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef _USER_CONFIG_
|
#ifndef _USER_CONFIG_
|
||||||
#define _USER_CONFIG_
|
#define _USER_CONFIG_
|
||||||
|
|
||||||
#define ESP_UBROKER_VERSION "V2.0.7"
|
#define ESP_UBROKER_VERSION "V2.0.8"
|
||||||
|
|
||||||
#define WIFI_SSID "ssid"
|
#define WIFI_SSID "ssid"
|
||||||
#define WIFI_PASSWORD "password"
|
#define WIFI_PASSWORD "password"
|
||||||
|
|
Ładowanie…
Reference in New Issue