Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
compact-slowcontrol
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
4
Issues
4
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Peter-Bernd Otte
compact-slowcontrol
Commits
6096b3e0
Commit
6096b3e0
authored
Aug 15, 2019
by
Peter-Bernd Otte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
all prints now in logger
parent
a48c5746
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
python/enocean/enoceanReceiver.py
python/enocean/enoceanReceiver.py
+4
-5
No files found.
python/enocean/enoceanReceiver.py
View file @
6096b3e0
...
...
@@ -74,7 +74,7 @@ while (WatchDogCounter > 0):
while
ser
.
inWaiting
()
>
0
:
charSet
+=
ser
.
read
()
while
len
(
charSet
)
>
0
and
charSet
[
0
]
!=
0x55
:
print
(
"Deleted the following bytes, because they do not start with 0x55: (int)"
,
charSet
.
pop
(
0
)
)
logger
.
warning
(
"Deleted the following bytes, because they do not start with 0x55: (int)"
+
str
(
charSet
.
pop
(
0
))
)
if
len
(
charSet
)
>=
8
:
# At least Sync-byte, Header (4byte), CRC8H, Data (min 1byte) and CRCD is available
pHeader
,
pCRCHeader
=
charSet
[
1
:
5
],
charSet
[
5
]
...
...
@@ -92,15 +92,14 @@ while (WatchDogCounter > 0):
t
=
time
.
mktime
(
t
.
timetuple
())
+
t
.
microsecond
/
1E6
pData
,
pOptData
=
charSet
[
6
:
6
+
pDataLength
],
charSet
[
6
+
pDataLength
:
6
+
pDataLength
+
pOptionalLength
]
print
(
"pPaketType"
,
pPaketType
,
"Data"
,
pData
,
"OptData"
,
pOptData
)
logger
.
info
(
"pPaketType: "
+
str
(
pPaketType
)
+
" Data: "
+
str
(
pData
),
" OptData: "
+
str
(
pOptData
))
# list() converts bytearray into array of int
t
=
datetime
.
now
()
t
=
time
.
mktime
(
t
.
timetuple
())
+
t
.
microsecond
/
1E6
client
.
publish
(
"homie/"
+
args
.
mqtt_client_name
)
+
"/enocean-messages"
,
json
.
dumps
(
client
.
publish
(
"homie/"
+
args
.
mqtt_client_name
+
"/enocean-messages"
,
json
.
dumps
(
{
"type"
:
pPaketType
,
"data"
:
list
(
pData
),
"optData"
:
list
(
pOptData
),
"time"
:
t
}),
qos
=
1
)
else
:
print
(
"Data CRC NOT ok"
)
logger
.
warning
(
"Data CRC NOT ok"
)
# Delete the processed data and propare for next paket to receive
charSet
=
charSet
[
pDataLength
+
pOptionalLength
+
7
:]
...
...
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