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

Nothing

parent f23dfab3
No related branches found
No related tags found
No related merge requests found
......@@ -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
// Else it will find the device with the topic and call the HandleMessage
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
if len(msg.Payload()) == 0 {
return
}
// we ignore some topics
if slices.Contains(gw.Config.ignoredTopics, msg.Topic()) {
return
}
// Is it devices definitions ?
if msg.Topic() == gw.Config.topic+"/bridge/devices" {
gw.Z2MParseDevices(msg)
} else {
zDev := gw.GetZDeviceByTopic(msg.Topic())
// MQTTDumpMsg(msg)
if zDev != nil {
zDev.HandleMessage(msg)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment