mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-28 04:59:52 +01:00
mamnger api updatef=d for mqtt agteway
This commit is contained in:
parent
7ccdbe3c96
commit
24d1688a13
6 changed files with 34 additions and 5 deletions
11
add_mqtt_params.sql
Normal file
11
add_mqtt_params.sql
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
-- Add MQTT configuration parameters to sys_params table
|
||||
-- Replace the values with your actual MQTT broker configuration
|
||||
|
||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark)
|
||||
VALUES (120, 'mqtt.broker', '139.59.7.72', 'string', 1, 'MQTT broker IP address');
|
||||
|
||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark)
|
||||
VALUES (121, 'mqtt.port', '1883', 'string', 1, 'MQTT broker port');
|
||||
|
||||
INSERT INTO `sys_params` (id, param_code, param_value, value_type, param_type, remark)
|
||||
VALUES (122, 'mqtt.signature_key', 'your-secure-signature-key-here', 'string', 1, 'MQTT signature key for authentication');
|
||||
5
check_mqtt_params.sql
Normal file
5
check_mqtt_params.sql
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
-- Check current MQTT-related parameters in sys_params table
|
||||
SELECT * FROM sys_params WHERE param_code LIKE 'mqtt.%';
|
||||
|
||||
-- Check all system parameters to see what's configured
|
||||
SELECT id, param_code, param_value, remark FROM sys_params ORDER BY id;
|
||||
|
|
@ -2,6 +2,11 @@ This is a development document. If you need to deploy the Xiaozhi server, [click
|
|||
|
||||
# Project Introduction
|
||||
|
||||
|
||||
run app
|
||||
|
||||
|
||||
npm run serve
|
||||
manager-api: This project is developed based on the SpringBoot framework.
|
||||
|
||||
When developing, use a code editor and select the `manager-api` folder as the project directory when importing the project.
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public class DeviceReportRespDTO {
|
|||
private Websocket websocket;
|
||||
|
||||
@Schema(description = "MQTT配置")
|
||||
private Mqtt mqtt;
|
||||
private Mqtt mqtt_gateway;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
|
@ -77,6 +77,12 @@ public class DeviceReportRespDTO {
|
|||
@Getter
|
||||
@Setter
|
||||
public static class Mqtt {
|
||||
@Schema(description = "MQTT服务器地址")
|
||||
private String broker;
|
||||
|
||||
@Schema(description = "MQTT服务器端口")
|
||||
private Integer port;
|
||||
|
||||
@Schema(description = "MQTT服务器端点")
|
||||
private String endpoint;
|
||||
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ public class DeviceServiceImpl extends BaseServiceImpl<DeviceDao, DeviceEntity>
|
|||
// Always include MQTT credentials for all devices (both registered and unregistered)
|
||||
DeviceReportRespDTO.Mqtt mqttCredentials = buildMqttCredentials(macAddress);
|
||||
if (mqttCredentials != null) {
|
||||
response.setMqtt(mqttCredentials);
|
||||
response.setMqtt_gateway(mqttCredentials);
|
||||
log.info("Added MQTT credentials to response for device: {}", macAddress);
|
||||
}
|
||||
|
||||
|
|
@ -427,6 +427,8 @@ public class DeviceServiceImpl extends BaseServiceImpl<DeviceDao, DeviceEntity>
|
|||
String password = Base64.getEncoder().encodeToString(signature);
|
||||
|
||||
// Set MQTT credentials
|
||||
mqtt.setBroker(mqttBroker);
|
||||
mqtt.setPort(Integer.parseInt(mqttPort));
|
||||
mqtt.setEndpoint(mqttBroker + ":" + mqttPort);
|
||||
mqtt.setClient_id(clientId);
|
||||
mqtt.setUsername(username);
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@ import opuslib
|
|||
|
||||
# --- Configuration ---
|
||||
|
||||
SERVER_IP = "192.168.1.107" # !!! UPDATE with your server's local IP address !!!
|
||||
OTA_PORT = 8003
|
||||
MQTT_BROKER_HOST = "192.168.1.107" # MQTT gateway IP
|
||||
SERVER_IP = "139.59.7.72" # !!! UPDATE with your server's local IP address !!!
|
||||
OTA_PORT = 8002
|
||||
MQTT_BROKER_HOST = "139.59.7.72" # MQTT gateway IP
|
||||
|
||||
|
||||
MQTT_BROKER_PORT = 1883
|
||||
|
|
|
|||
Loading…
Reference in a new issue