diff --git a/gateway.go b/gateway.go index 82ca332f2c8e4be359ed75e6c3103dfdeeca8d68..1ca39aee54778f6553baeff564c74de247f8ed21 100644 --- a/gateway.go +++ b/gateway.go @@ -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) }