Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
E
ems_collector
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ZZH
ems_collector
Commits
2989168c
You need to sign in or sign up before continuing.
Commit
2989168c
authored
Apr 27, 2026
by
ZZH
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add sta map info 2026-4-27 16:26
parent
111596bd
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
506 additions
and
10 deletions
+506
-10
constants.py
src/ems_water_grp/constants.py
+496
-0
meter_3rd.py
src/ems_water_grp/meter_3rd.py
+10
-10
No files found.
src/ems_water_grp/constants.py
View file @
2989168c
This diff is collapsed.
Click to expand it.
src/ems_water_grp/meter_3rd.py
View file @
2989168c
...
...
@@ -66,13 +66,13 @@ class Meter3rdForward:
try
:
msg_str
=
payload
.
decode
(
"utf-8"
)
data
=
json
.
loads
(
msg_str
)
ci
d
=
data
.
get
(
"fId"
)
if
ci
d
:
self
.
d_last_msg
[
ci
d
]
=
msg_str
fI
d
=
data
.
get
(
"fId"
)
if
fI
d
:
self
.
d_last_msg
[
fI
d
]
=
msg_str
except
Exception
as
e
:
logger
.
error
(
f
"Decode msg:{payload} error: {e}"
)
async
def
parse_and_forward
(
self
,
c
id
,
raw_payload
):
async
def
parse_and_forward
(
self
,
f
id
,
raw_payload
):
""" 重新封装消息,推送至EMQX """
try
:
d_pyds
=
{}
...
...
@@ -81,9 +81,9 @@ class Meter3rdForward:
for
item
in
data
[
"items"
]:
try
:
scada_id
=
item
[
"n"
]
if
scada_id
in
SCADA_FIELDS_MAP
[
c
id
]
.
keys
():
tmp
=
SCADA_FIELDS_MAP
[
c
id
][
scada_id
]
mid
=
tmp
[
"sid"
]
if
scada_id
in
SCADA_FIELDS_MAP
[
f
id
]
.
keys
():
tmp
=
SCADA_FIELDS_MAP
[
f
id
][
scada_id
]
cid
,
mid
=
tmp
[
"cid"
],
tmp
[
"sid"
]
tag
=
{
tmp
[
"field"
]:
item
[
"v"
]}
if
mid
in
d_pyds
:
d_pyds
[
mid
][
"images"
][
0
][
"tags"
]
.
update
(
tag
)
...
...
@@ -112,9 +112,9 @@ class Meter3rdForward:
cur_batch
=
dict
(
self
.
d_last_msg
)
self
.
d_last_msg
.
clear
()
for
c
id
,
raw_msg
in
cur_batch
.
items
():
if
c
id
in
SCADA_FIELDS_MAP
:
await
self
.
parse_and_forward
(
c
id
,
raw_msg
)
for
f
id
,
raw_msg
in
cur_batch
.
items
():
if
f
id
in
SCADA_FIELDS_MAP
:
await
self
.
parse_and_forward
(
f
id
,
raw_msg
)
except
Exception
as
e
:
logger
.
error
(
f
"Processing loop error: {e}"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment