Skip to content
Snippets Groups Projects
Commit 1987448d authored by KERDREUX Jerome's avatar KERDREUX Jerome
Browse files

Nothing

parent f23dfab3
Branches
No related tags found
No related merge requests found
...@@ -61,20 +61,19 @@ func (gw *Gateway) GetZDeviceByTopic(topic string) *Z2MDevice { ...@@ -61,20 +61,19 @@ func (gw *Gateway) GetZDeviceByTopic(topic string) *Z2MDevice {
// If the topic is /bridge/devices it will parse the json and create new devices // If the topic is /bridge/devices it will parse the json and create new devices
// Else it will find the device with the topic and call the HandleMessage // Else it will find the device with the topic and call the HandleMessage
func (gw *Gateway) MQTTHandler(client mqtt.Client, msg mqtt.Message) { func (gw *Gateway) MQTTHandler(client mqtt.Client, msg mqtt.Message) {
// we ignore some topics
if slices.Contains(gw.Config.ignoredTopics, msg.Topic()) {
return
}
// some messages are empty // some messages are empty
if len(msg.Payload()) == 0 { if len(msg.Payload()) == 0 {
return return
} }
// we ignore some topics
if slices.Contains(gw.Config.ignoredTopics, msg.Topic()) {
return
}
// Is it devices definitions ? // Is it devices definitions ?
if msg.Topic() == gw.Config.topic+"/bridge/devices" { if msg.Topic() == gw.Config.topic+"/bridge/devices" {
gw.Z2MParseDevices(msg) gw.Z2MParseDevices(msg)
} else { } else {
zDev := gw.GetZDeviceByTopic(msg.Topic()) zDev := gw.GetZDeviceByTopic(msg.Topic())
// MQTTDumpMsg(msg)
if zDev != nil { if zDev != nil {
zDev.HandleMessage(msg) zDev.HandleMessage(msg)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment