fix(gateway): update command topic path to use 'cmd' instead of 'command'
Solve: #28 Signed-off-by: Klagarge <remi@heredero.ch>
This commit is contained in:
@@ -11,7 +11,7 @@ import (
|
|||||||
// Command represents the structure of the command to be published
|
// Command represents the structure of the command to be published
|
||||||
// @Description Command structure for publishing
|
// @Description Command structure for publishing
|
||||||
type Command struct {
|
type Command struct {
|
||||||
Command string `json:"command" example:"MEASURE_NEW" binding:"required"`
|
Command string `json:"command" example:"measure" binding:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary Publish command
|
// @Summary Publish command
|
||||||
@@ -55,7 +55,7 @@ func (gh *Gateway) publishCommand(c *gin.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Publish the command to the MQTT broker
|
// Publish the command to the MQTT broker
|
||||||
topic := user + "/" + room + "/" + device + "/command/" + json.Command
|
topic := user + "/" + room + "/" + device + "/cmd/" + json.Command
|
||||||
token := gh.mqtt.Publish(topic, 1, false, "")
|
token := gh.mqtt.Publish(topic, 1, false, "")
|
||||||
if token.Wait() && token.Error() != nil {
|
if token.Wait() && token.Error() != nil {
|
||||||
return token.Error()
|
return token.Error()
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ const docTemplate = `{
|
|||||||
"properties": {
|
"properties": {
|
||||||
"command": {
|
"command": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"example": "MEASURE_NEW"
|
"example": "measure"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -178,7 +178,7 @@
|
|||||||
"properties": {
|
"properties": {
|
||||||
"command": {
|
"command": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"example": "MEASURE_NEW"
|
"example": "measure"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ definitions:
|
|||||||
description: Command structure for publishing
|
description: Command structure for publishing
|
||||||
properties:
|
properties:
|
||||||
command:
|
command:
|
||||||
example: MEASURE_NEW
|
example: measure
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
- command
|
- command
|
||||||
|
|||||||
Reference in New Issue
Block a user