python-selve-new 2.1.13__tar.gz → 2.2.1__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.1.13 → python-selve-new-2.2.1}/PKG-INFO +1 -1
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/python_selve_new.egg-info/PKG-INFO +1 -1
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/selve/__init__.py +48 -49
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/setup.py +1 -1
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/LICENSE +0 -0
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/README.md +0 -0
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/python_selve_new.egg-info/SOURCES.txt +0 -0
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/python_selve_new.egg-info/dependency_links.txt +0 -0
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/python_selve_new.egg-info/requires.txt +0 -0
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/python_selve_new.egg-info/top_level.txt +0 -0
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/selve/commands/__init__.py +0 -0
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/selve/commands/command.py +0 -0
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/selve/commands/device.py +0 -0
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/selve/commands/event.py +0 -0
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/selve/commands/group.py +0 -0
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/selve/commands/iveo.py +0 -0
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/selve/commands/param.py +0 -0
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/selve/commands/senSim.py +0 -0
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/selve/commands/sender.py +0 -0
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/selve/commands/sensor.py +0 -0
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/selve/commands/service.py +0 -0
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/selve/device.py +0 -0
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/selve/gateway.py +0 -0
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/selve/group.py +0 -0
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/selve/iveo.py +0 -0
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/selve/senSim.py +0 -0
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/selve/sender.py +0 -0
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/selve/sensor.py +0 -0
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/selve/util/__init__.py +0 -0
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/selve/util/errors.py +0 -0
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/selve/util/protocol.py +0 -0
- {python-selve-new-2.1.13 → python-selve-new-2.2.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-selve-new
|
|
3
|
-
Version: 2.1
|
|
3
|
+
Version: 2.2.1
|
|
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.1
|
|
3
|
+
Version: 2.2.1
|
|
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
|
|
@@ -59,11 +59,11 @@ class Selve:
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
# Flags for enabling reader and writer in the worker thread
|
|
62
|
-
self._pauseReader =
|
|
63
|
-
self._pauseWriter =
|
|
64
|
-
self._pauseWorker =
|
|
65
|
-
self._stopThread =
|
|
66
|
-
|
|
62
|
+
self._pauseReader = asyncio.Event()
|
|
63
|
+
self._pauseWriter = asyncio.Event()
|
|
64
|
+
self._pauseWorker = asyncio.Event()
|
|
65
|
+
self._stopThread = asyncio.Event()
|
|
66
|
+
|
|
67
67
|
# The worker thread
|
|
68
68
|
self.workerTask = None
|
|
69
69
|
|
|
@@ -80,15 +80,15 @@ class Selve:
|
|
|
80
80
|
|
|
81
81
|
self._LOGGER = logger
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
|
|
84
84
|
async def _worker(self):
|
|
85
85
|
# Infinite loop to collect all incoming data
|
|
86
86
|
self._LOGGER.debug("(Selve Worker): " + "Worker started")
|
|
87
|
-
|
|
87
|
+
|
|
88
88
|
try:
|
|
89
89
|
while True:
|
|
90
|
-
if not self._pauseWorker:
|
|
91
|
-
if not self._pauseReader:
|
|
90
|
+
if not self._pauseWorker.is_set():
|
|
91
|
+
if not self._pauseReader.is_set():
|
|
92
92
|
async with self._readLock:
|
|
93
93
|
if not self._serial.is_open:
|
|
94
94
|
self._serial.open()
|
|
@@ -105,9 +105,8 @@ class Selve:
|
|
|
105
105
|
|
|
106
106
|
# if msg.rstrip() == b' ':
|
|
107
107
|
self._LOGGER.debug(f'(Selve Worker): Worker received: {msg}')
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
if not self._pauseWriter:
|
|
108
|
+
|
|
109
|
+
if not self._pauseWriter.is_set():
|
|
111
110
|
if not self.txQ.empty():
|
|
112
111
|
data: Command = await self.txQ.get()
|
|
113
112
|
commandstr = data.serializeToXML()
|
|
@@ -124,11 +123,10 @@ class Selve:
|
|
|
124
123
|
self.txQ.task_done()
|
|
125
124
|
|
|
126
125
|
# always sleep after writing
|
|
127
|
-
await asyncio.sleep(0.2)
|
|
128
|
-
|
|
129
|
-
self._LOGGER.debug("(Selve Worker): " + "Writer stopped")
|
|
126
|
+
#await asyncio.sleep(0.2)
|
|
127
|
+
|
|
130
128
|
await asyncio.sleep(0.01)
|
|
131
|
-
if self._stopThread:
|
|
129
|
+
if self._stopThread.is_set():
|
|
132
130
|
self._LOGGER.debug("(Selve Worker): " + 'Exiting worker loop...')
|
|
133
131
|
break
|
|
134
132
|
return True
|
|
@@ -157,19 +155,19 @@ class Selve:
|
|
|
157
155
|
xonxoff=False,
|
|
158
156
|
rtscts=False,
|
|
159
157
|
dsrdtr=False)
|
|
160
|
-
|
|
158
|
+
|
|
161
159
|
if await self.pingGateway():
|
|
162
160
|
if not fromConfigFlow:
|
|
163
161
|
if discover:
|
|
164
162
|
self._LOGGER.info("Discovering devices")
|
|
165
|
-
await self.discover()
|
|
166
|
-
await self.startWorker()
|
|
163
|
+
await self.discover()
|
|
164
|
+
await self.startWorker()
|
|
167
165
|
return
|
|
168
166
|
except serial.SerialException as e:
|
|
169
167
|
self._LOGGER.debug("Configured port not valid! " + str(e))
|
|
170
168
|
except Exception as e:
|
|
171
169
|
self._LOGGER.error("Unknown exception: " + str(e))
|
|
172
|
-
|
|
170
|
+
|
|
173
171
|
|
|
174
172
|
available_ports = list_ports.comports()
|
|
175
173
|
self._LOGGER.debug("available comports: " + str(available_ports))
|
|
@@ -200,8 +198,8 @@ class Selve:
|
|
|
200
198
|
if not fromConfigFlow:
|
|
201
199
|
if discover:
|
|
202
200
|
self._LOGGER.info("Discovering devices")
|
|
203
|
-
await self.discover()
|
|
204
|
-
await self.startWorker()
|
|
201
|
+
await self.discover()
|
|
202
|
+
await self.startWorker()
|
|
205
203
|
self._port = p.device
|
|
206
204
|
return
|
|
207
205
|
else:
|
|
@@ -210,28 +208,28 @@ class Selve:
|
|
|
210
208
|
else:
|
|
211
209
|
self._LOGGER.error("No gateway on comports found!")
|
|
212
210
|
raise PortError
|
|
213
|
-
|
|
214
|
-
|
|
211
|
+
|
|
212
|
+
|
|
215
213
|
|
|
216
214
|
async def startWorker(self):
|
|
217
215
|
self._LOGGER.debug("Starting worker")
|
|
218
|
-
self._pauseReader = False
|
|
219
|
-
self._pauseWriter = False
|
|
220
|
-
self._pauseWorker = False
|
|
221
|
-
self._stopThread = False
|
|
222
|
-
self._LOGGER.debug("Set variables")
|
|
223
216
|
if self.workerTask is not None:
|
|
224
217
|
self._LOGGER.debug("Running worker detected")
|
|
225
218
|
await self.stopWorker()
|
|
219
|
+
self._pauseReader.clear()
|
|
220
|
+
self._pauseWriter.clear()
|
|
221
|
+
self._pauseWorker.clear()
|
|
222
|
+
self._stopThread.clear()
|
|
223
|
+
self._LOGGER.debug("Set variables")
|
|
226
224
|
self.workerTask = asyncio.create_task(self._worker())
|
|
227
225
|
self._LOGGER.debug("created task")
|
|
228
226
|
|
|
229
227
|
async def stopWorker(self):
|
|
230
228
|
self._LOGGER.debug("Stopping worker")
|
|
231
|
-
self._pauseReader
|
|
232
|
-
self._pauseWriter
|
|
233
|
-
self._pauseWorker
|
|
234
|
-
self._stopThread
|
|
229
|
+
self._pauseReader.set()
|
|
230
|
+
self._pauseWriter.set()
|
|
231
|
+
self._pauseWorker.set()
|
|
232
|
+
self._stopThread.set()
|
|
235
233
|
try:
|
|
236
234
|
if self.workerTask is not None and not self.workerTask.cancelled() and not self.workerTask.done():
|
|
237
235
|
self._LOGGER.debug("Task is still running, waiting with timeout...")
|
|
@@ -247,7 +245,7 @@ class Selve:
|
|
|
247
245
|
# wait for the rx/tx thread to end, these need to be gathered to
|
|
248
246
|
# collect all the exceptions
|
|
249
247
|
self._LOGGER.debug("Preparing for termination")
|
|
250
|
-
self._stopThread
|
|
248
|
+
self._stopThread.set()
|
|
251
249
|
if self.workerTask is not None:
|
|
252
250
|
self.workerTask.cancel()
|
|
253
251
|
await self.workerTask
|
|
@@ -547,7 +545,7 @@ class Selve:
|
|
|
547
545
|
return MethodResponse(methodName, flat_params_list)
|
|
548
546
|
|
|
549
547
|
async def executeCommand(self, command: Command):
|
|
550
|
-
self.
|
|
548
|
+
await self.startWorker()
|
|
551
549
|
self.txQ.put_nowait(command)
|
|
552
550
|
|
|
553
551
|
|
|
@@ -556,7 +554,7 @@ class Selve:
|
|
|
556
554
|
if (resp == False):
|
|
557
555
|
#something went wrong, try again
|
|
558
556
|
resp = await self._executeCommandSyncWithResponse(command)
|
|
559
|
-
|
|
557
|
+
|
|
560
558
|
return resp
|
|
561
559
|
|
|
562
560
|
async def _executeCommandSyncWithResponse(self, command: Command):
|
|
@@ -580,13 +578,13 @@ class Selve:
|
|
|
580
578
|
# if msg.rstrip() == b' ':
|
|
581
579
|
self._LOGGER.debug(f'Received: {msg}')
|
|
582
580
|
await self.startWorker()
|
|
583
|
-
|
|
581
|
+
|
|
584
582
|
resp = await self.processResponse(msg)
|
|
585
|
-
|
|
583
|
+
|
|
586
584
|
if (resp == False):
|
|
587
585
|
#something went wrong, try again
|
|
588
586
|
return False
|
|
589
|
-
|
|
587
|
+
|
|
590
588
|
if isinstance(resp, ErrorResponse):
|
|
591
589
|
self._LOGGER.error(resp.message)
|
|
592
590
|
# retry
|
|
@@ -594,17 +592,17 @@ class Selve:
|
|
|
594
592
|
|
|
595
593
|
return resp
|
|
596
594
|
# 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
|
|
597
|
-
if time.time() - start_time
|
|
598
|
-
time.sleep(0.05)
|
|
599
|
-
else:
|
|
595
|
+
if time.time() - start_time > 10:
|
|
600
596
|
await self.startWorker()
|
|
601
597
|
return False
|
|
602
|
-
|
|
598
|
+
|
|
599
|
+
|
|
603
600
|
|
|
604
601
|
|
|
605
602
|
async def discover(self):
|
|
606
603
|
|
|
607
|
-
self.
|
|
604
|
+
await self.stopWorker()
|
|
605
|
+
await self.setEvents(0,0,0,0,0)
|
|
608
606
|
|
|
609
607
|
if await self.gatewayReady():
|
|
610
608
|
iveoIds: IveoGetIdsResponse = await self.executeCommandSyncWithResponse(IveoGetIds())
|
|
@@ -703,8 +701,9 @@ class Selve:
|
|
|
703
701
|
device.sun2Analog = config.sun2Analog
|
|
704
702
|
device.sun3Analog = config.sun3Analog
|
|
705
703
|
self.addOrUpdateDevice(device, SelveTypes.SENSIM)
|
|
706
|
-
|
|
707
|
-
self.
|
|
704
|
+
|
|
705
|
+
await self.setEvents(1,1,1,1,1)
|
|
706
|
+
await self.startWorker()
|
|
708
707
|
self.list_devices()
|
|
709
708
|
|
|
710
709
|
|
|
@@ -939,7 +938,7 @@ class Selve:
|
|
|
939
938
|
|
|
940
939
|
async def updateCommeoDeviceValuesAsync(self, id: int):
|
|
941
940
|
await self.executeCommand(DeviceGetValues(id))
|
|
942
|
-
|
|
941
|
+
|
|
943
942
|
def updateCommeoDeviceValuesFromResponse(self, id: int, response: DeviceGetValuesResponse):
|
|
944
943
|
dev = self.getDevice(id, SelveTypes.DEVICE)
|
|
945
944
|
dev.name = response.name if response.name else "None"
|
|
@@ -958,12 +957,12 @@ class Selve:
|
|
|
958
957
|
dev.freezingAlarm = response.freezingAlarm if response.freezingAlarm else False
|
|
959
958
|
dev.dayMode = response.dayMode if response.dayMode else False
|
|
960
959
|
self.addOrUpdateDevice(dev, SelveTypes.DEVICE)
|
|
961
|
-
|
|
960
|
+
|
|
962
961
|
def setDeviceValue(self, id: int, value: int, type: SelveTypes):
|
|
963
962
|
dev = self.getDevice(id, type)
|
|
964
963
|
dev.value = value
|
|
965
964
|
self.addOrUpdateDevice(dev, type)
|
|
966
|
-
|
|
965
|
+
|
|
967
966
|
def setDeviceTargetValue(self, id: int, value: int, type: SelveTypes):
|
|
968
967
|
dev = self.getDevice(id, type)
|
|
969
968
|
dev.targetValue = value
|
|
@@ -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.1
|
|
18
|
+
version='2.2.1', # 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.1.13 → python-selve-new-2.2.1}/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
|