Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Python-MQTT Library
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WZL-IQS-Public
Internet of Things
Python-MQTT Library
Commits
0a1bf3d3
Commit
0a1bf3d3
authored
5 years ago
by
Matthias Bodenbenner
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of
https://git-ce.rwth-aachen.de/wzl-mq-ms/forschung-lehre/digital-mars/mqtt
parents
1e2027fb
1344d5b3
No related branches found
No related tags found
No related merge requests found
Pipeline
#12429
failed
5 years ago
Stage: environment
Stage: deploy
Stage: restart
Stage: notify
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
.gitlab-ci.yml
+2
-1
2 additions, 1 deletion
.gitlab-ci.yml
influx_translator.py
+5
-3
5 additions, 3 deletions
influx_translator.py
with
8 additions
and
4 deletions
.gitignore
+
1
−
0
View file @
0a1bf3d3
...
@@ -111,3 +111,4 @@ venv.bak/
...
@@ -111,3 +111,4 @@ venv.bak/
*.1
*.1
*.2
*.2
*.3
*.3
.vscode/settings.json
This diff is collapsed.
Click to expand it.
.gitlab-ci.yml
+
2
−
1
View file @
0a1bf3d3
...
@@ -28,7 +28,8 @@ Copy To Container:
...
@@ -28,7 +28,8 @@ Copy To Container:
-
taskkill /FI "WINDOWTITLE eq $env:UUID"
-
taskkill /FI "WINDOWTITLE eq $env:UUID"
-
Remove-Item -Recurse -Force -Path E:\apps\$env:UUID\*
-
Remove-Item -Recurse -Force -Path E:\apps\$env:UUID\*
-
Copy-Item * -Destination E:\apps\$env:UUID\ -Recurse
-
Copy-Item * -Destination E:\apps\$env:UUID\ -Recurse
-
Copy-Item $env:SECRETS\$env:UUID\config.json -Destination E:\apps\$env:UUID\
# - Copy-Item $env:SECRETS\$env:UUID\config.json -Destination E:\apps\$env:UUID\
-
fsutil hardlink create E:\apps\$env:UUID\config.json $env:SECRETS\$env:UUID\config.json
Restart
:
Restart
:
...
...
This diff is collapsed.
Click to expand it.
influx_translator.py
+
5
−
3
View file @
0a1bf3d3
...
@@ -140,7 +140,7 @@ class MQTT2InfluxDB:
...
@@ -140,7 +140,7 @@ class MQTT2InfluxDB:
# reconnect then subscriptions will be renewed.
# reconnect then subscriptions will be renewed.
for
topic
in
self
.
topic_list_db
:
for
topic
in
self
.
topic_list_db
:
# print(topic)
# print(topic)
client
.
subscribe
(
topic
+
"
/#
"
)
client
.
subscribe
(
topic
+
"
/#
"
,
1
)
def
on_message
(
self
,
client
,
userdata
,
msg
):
def
on_message
(
self
,
client
,
userdata
,
msg
):
...
@@ -174,7 +174,9 @@ class MQTT2InfluxDB:
...
@@ -174,7 +174,9 @@ class MQTT2InfluxDB:
logger
.
debug
(
"
### CONTENT DICT ###
\n
"
+
str
(
payload_dict
))
logger
.
debug
(
"
### CONTENT DICT ###
\n
"
+
str
(
payload_dict
))
self
.
to_database
(
topic
=
msg
.
topic
,
payload
=
payload_dict
)
self
.
to_database
(
topic
=
msg
.
topic
,
payload
=
payload_dict
)
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
error
(
e
)
logger
.
error
(
f
'
{
e
}
-
{
msg
.
topic
}
:
{
msg
.
payload
.
decode
(
"
utf-8
"
)
}
'
)
# logger.error(msg.topic)
# logger.error(msg.payload.decode("utf-8"))
logger
.
info
(
str
(
1000
*
(
time
.
perf_counter
()
-
starttime
))
+
"
ms
"
)
logger
.
info
(
str
(
1000
*
(
time
.
perf_counter
()
-
starttime
))
+
"
ms
"
)
def
to_database
(
self
,
topic
,
payload
):
def
to_database
(
self
,
topic
,
payload
):
...
@@ -207,7 +209,7 @@ class MQTT2InfluxDB:
...
@@ -207,7 +209,7 @@ class MQTT2InfluxDB:
[
[
self
.
topic_list_db
[
topic_list
[
0
]],
self
.
topic_list_db
[
topic_list
[
0
]],
{
{
"
measurement
"
:
measurement
,
"
measurement
"
:
measurement
.
lower
()
,
"
tags
"
:
tags
,
"
tags
"
:
tags
,
"
fields
"
:
fields
,
"
fields
"
:
fields
,
"
time
"
:
payload
[
"
timestamp
"
],
"
time
"
:
payload
[
"
timestamp
"
],
...
...
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