python-selve-new 2.0.54__tar.gz → 2.0.56__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/PKG-INFO +1 -1
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/python_selve_new.egg-info/PKG-INFO +1 -1
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/selve/__init__.py +51 -45
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/setup.py +1 -1
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/LICENSE +0 -0
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/README.md +0 -0
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/python_selve_new.egg-info/SOURCES.txt +0 -0
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/python_selve_new.egg-info/dependency_links.txt +0 -0
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/python_selve_new.egg-info/requires.txt +0 -0
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/python_selve_new.egg-info/top_level.txt +0 -0
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/selve/commands/__init__.py +0 -0
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/selve/commands/command.py +0 -0
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/selve/commands/device.py +0 -0
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/selve/commands/event.py +0 -0
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/selve/commands/group.py +0 -0
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/selve/commands/iveo.py +0 -0
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/selve/commands/param.py +0 -0
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/selve/commands/senSim.py +0 -0
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/selve/commands/sender.py +0 -0
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/selve/commands/sensor.py +0 -0
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/selve/commands/service.py +0 -0
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/selve/device.py +0 -0
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/selve/gateway.py +0 -0
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/selve/group.py +0 -0
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/selve/iveo.py +0 -0
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/selve/senSim.py +0 -0
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/selve/sender.py +0 -0
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/selve/sensor.py +0 -0
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/selve/util/__init__.py +0 -0
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/selve/util/errors.py +0 -0
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/selve/util/protocol.py +0 -0
- {python-selve-new-2.0.54 → python-selve-new-2.0.56}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-selve-new
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.56
|
|
4
4
|
Summary: Python library for interfacing with selve devices using the USB-RF controller. Written completely new.
|
|
5
5
|
Home-page: https://github.com/Kannix2005/python-selve-new
|
|
6
6
|
Author: Stefan Altheimer
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-selve-new
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.56
|
|
4
4
|
Summary: Python library for interfacing with selve devices using the USB-RF controller. Written completely new.
|
|
5
5
|
Home-page: https://github.com/Kannix2005/python-selve-new
|
|
6
6
|
Author: Stefan Altheimer
|
|
@@ -89,7 +89,7 @@ class Selve:
|
|
|
89
89
|
|
|
90
90
|
def _worker(self, selve: Selve):
|
|
91
91
|
# Infinite loop to collect all incoming data
|
|
92
|
-
|
|
92
|
+
selve._LOGGER.debug("Worker started")
|
|
93
93
|
try:
|
|
94
94
|
while True:
|
|
95
95
|
if not selve._pauseWorker:
|
|
@@ -97,20 +97,21 @@ class Selve:
|
|
|
97
97
|
if not selve._pauseReader:
|
|
98
98
|
selve._pauseReaderEvent.clear()
|
|
99
99
|
with selve._readLock:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
100
|
+
if not selve._serial.is_open:
|
|
101
|
+
selve._serial.open()
|
|
102
|
+
if selve._serial.in_waiting > 0:
|
|
103
|
+
msg = ""
|
|
104
|
+
while True:
|
|
105
|
+
response = selve._serial.readline().strip()
|
|
106
|
+
msg += response.decode()
|
|
107
|
+
if response.decode() == '':
|
|
108
|
+
break
|
|
109
|
+
|
|
110
|
+
# do something with the received data
|
|
111
|
+
selve.processResponse(msg)
|
|
112
|
+
|
|
113
|
+
# if msg.rstrip() == b' ':
|
|
114
|
+
selve._LOGGER.debug(f'Received: {msg}')
|
|
114
115
|
else:
|
|
115
116
|
selve._pauseReaderEvent.set()
|
|
116
117
|
selve._LOGGER.debug("Reader stopped")
|
|
@@ -122,9 +123,10 @@ class Selve:
|
|
|
122
123
|
selve._LOGGER.debug('Gateway writing: ' + str(commandstr))
|
|
123
124
|
try:
|
|
124
125
|
with selve._writeLock:
|
|
125
|
-
|
|
126
|
-
selve._serial.
|
|
127
|
-
|
|
126
|
+
if not selve._serial.is_open:
|
|
127
|
+
selve._serial.open()
|
|
128
|
+
selve._serial.write(commandstr)
|
|
129
|
+
selve._serial.flush()
|
|
128
130
|
except Exception as e:
|
|
129
131
|
selve._LOGGER.error("error communicating: " + str(e))
|
|
130
132
|
|
|
@@ -215,7 +217,7 @@ class Selve:
|
|
|
215
217
|
self._pauseWriter = False
|
|
216
218
|
self._pauseWorker = False
|
|
217
219
|
self._stopThread = False
|
|
218
|
-
self.workerTask = threading.Thread(target=self._worker, args=(self, ), daemon=True)
|
|
220
|
+
self.workerTask = threading.Thread(target=self._worker, args=(self, self._writeLock, self._readLock), daemon=True)
|
|
219
221
|
self.workerTask.start()
|
|
220
222
|
|
|
221
223
|
def stopWorker(self):
|
|
@@ -254,11 +256,12 @@ class Selve:
|
|
|
254
256
|
self._LOGGER.debug('Gateway writing: ' + str(commandstr))
|
|
255
257
|
try:
|
|
256
258
|
with self._writeLock:
|
|
257
|
-
|
|
258
|
-
self._serial.
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
259
|
+
if not self._serial.is_open:
|
|
260
|
+
self._serial.open()
|
|
261
|
+
self._serial.write(commandstr)
|
|
262
|
+
self._serial.flush()
|
|
263
|
+
# always sleep after writing
|
|
264
|
+
time.sleep(1)
|
|
262
265
|
except Exception as e:
|
|
263
266
|
self._LOGGER.error("error communicating: " + str(e))
|
|
264
267
|
|
|
@@ -547,6 +550,9 @@ class Selve:
|
|
|
547
550
|
|
|
548
551
|
self.stopWorker()
|
|
549
552
|
|
|
553
|
+
if not self._serial.is_open:
|
|
554
|
+
self._serial.open()
|
|
555
|
+
|
|
550
556
|
#guarantee exclusivity
|
|
551
557
|
#self._serial.reset_input_buffer()
|
|
552
558
|
#self._serial.reset_output_buffer()
|
|
@@ -556,27 +562,27 @@ class Selve:
|
|
|
556
562
|
start_time = time.time()
|
|
557
563
|
while True:
|
|
558
564
|
with self._readLock:
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
565
|
+
if self._serial.in_waiting > 0:
|
|
566
|
+
msg = ""
|
|
567
|
+
while True:
|
|
568
|
+
response = self._serial.readline().strip()
|
|
569
|
+
msg += response.decode()
|
|
570
|
+
if response.decode() == '':
|
|
571
|
+
break
|
|
572
|
+
# if msg.rstrip() == b' ':
|
|
573
|
+
self._LOGGER.debug(f'Received: {msg}')
|
|
574
|
+
self.startWorker()
|
|
575
|
+
|
|
576
|
+
resp = self.processResponse(msg)
|
|
577
|
+
|
|
578
|
+
if (resp == False):
|
|
579
|
+
#something went wrong, try again
|
|
580
|
+
return False
|
|
581
|
+
|
|
582
|
+
if isinstance(resp, ErrorResponse):
|
|
583
|
+
self._LOGGER.error(resp.message)
|
|
584
|
+
# retry
|
|
585
|
+
return False
|
|
580
586
|
|
|
581
587
|
return resp
|
|
582
588
|
# When no data is waiting in the input buffer after 10s we can assume, the message was not correctly sent or no input is necessary
|
|
@@ -15,7 +15,7 @@ with open(path.join(here, 'README.md'), encoding='utf-8') as f:
|
|
|
15
15
|
setup(
|
|
16
16
|
|
|
17
17
|
name='python-selve-new', # Required
|
|
18
|
-
version='2.0.
|
|
18
|
+
version='2.0.56', # Required
|
|
19
19
|
description='Python library for interfacing with selve devices using the USB-RF controller. Written completely new.', # Required
|
|
20
20
|
long_description=long_description, # Optional
|
|
21
21
|
long_description_content_type="text/markdown",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python-selve-new-2.0.54 → python-selve-new-2.0.56}/python_selve_new.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|