Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
z2m
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
xAAL
Code
Go
z2m
Commits
1987448d
Commit
1987448d
authored
4 months ago
by
KERDREUX Jerome
Browse files
Options
Downloads
Patches
Plain Diff
Nothing
parent
f23dfab3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gateway.go
+4
-5
4 additions, 5 deletions
gateway.go
with
4 additions
and
5 deletions
gateway.go
+
4
−
5
View file @
1987448d
...
...
@@ -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
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment