python-selve-new 1.1.5__tar.gz → 1.1.6__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.
Files changed (27) hide show
  1. {python-selve-new-1.1.5 → python_selve_new-1.1.6}/PKG-INFO +5 -1
  2. {python-selve-new-1.1.5 → python_selve_new-1.1.6}/python_selve_new.egg-info/PKG-INFO +5 -1
  3. {python-selve-new-1.1.5 → python_selve_new-1.1.6}/selve/__init__.py +66 -12
  4. {python-selve-new-1.1.5 → python_selve_new-1.1.6}/setup.py +1 -1
  5. {python-selve-new-1.1.5 → python_selve_new-1.1.6}/LICENSE +0 -0
  6. {python-selve-new-1.1.5 → python_selve_new-1.1.6}/README.rst +0 -0
  7. {python-selve-new-1.1.5 → python_selve_new-1.1.6}/python_selve_new.egg-info/SOURCES.txt +0 -0
  8. {python-selve-new-1.1.5 → python_selve_new-1.1.6}/python_selve_new.egg-info/dependency_links.txt +0 -0
  9. {python-selve-new-1.1.5 → python_selve_new-1.1.6}/python_selve_new.egg-info/requires.txt +0 -0
  10. {python-selve-new-1.1.5 → python_selve_new-1.1.6}/python_selve_new.egg-info/top_level.txt +0 -0
  11. {python-selve-new-1.1.5 → python_selve_new-1.1.6}/selve/commandClasses/__init__.py +0 -0
  12. {python-selve-new-1.1.5 → python_selve_new-1.1.6}/selve/commandClasses/actor.py +0 -0
  13. {python-selve-new-1.1.5 → python_selve_new-1.1.6}/selve/commandClasses/command.py +0 -0
  14. {python-selve-new-1.1.5 → python_selve_new-1.1.6}/selve/commandClasses/common.py +0 -0
  15. {python-selve-new-1.1.5 → python_selve_new-1.1.6}/selve/commandClasses/group.py +0 -0
  16. {python-selve-new-1.1.5 → python_selve_new-1.1.6}/selve/commandClasses/iveo.py +0 -0
  17. {python-selve-new-1.1.5 → python_selve_new-1.1.6}/selve/commandClasses/senSim.py +0 -0
  18. {python-selve-new-1.1.5 → python_selve_new-1.1.6}/selve/commandClasses/sender.py +0 -0
  19. {python-selve-new-1.1.5 → python_selve_new-1.1.6}/selve/commandClasses/sensor.py +0 -0
  20. {python-selve-new-1.1.5 → python_selve_new-1.1.6}/selve/commands.py +0 -0
  21. {python-selve-new-1.1.5 → python_selve_new-1.1.6}/selve/commeo.py +0 -0
  22. {python-selve-new-1.1.5 → python_selve_new-1.1.6}/selve/communication.py +0 -0
  23. {python-selve-new-1.1.5 → python_selve_new-1.1.6}/selve/device.py +0 -0
  24. {python-selve-new-1.1.5 → python_selve_new-1.1.6}/selve/group.py +0 -0
  25. {python-selve-new-1.1.5 → python_selve_new-1.1.6}/selve/protocol.py +0 -0
  26. {python-selve-new-1.1.5 → python_selve_new-1.1.6}/selve/utils.py +0 -0
  27. {python-selve-new-1.1.5 → python_selve_new-1.1.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-selve-new
3
- Version: 1.1.5
3
+ Version: 1.1.6
4
4
  Summary: Python library for interfacing with selve devices using the USB-RF controller; forked from GPULIDO
5
5
  Home-page: https://github.com/Kannix2005/python-selve
6
6
  Author: Stefan Altheimer
@@ -16,6 +16,10 @@ Classifier: Programming Language :: Python :: 3.5
16
16
  Classifier: Programming Language :: Python :: 3.6
17
17
  Description-Content-Type: text/markdown
18
18
  License-File: LICENSE
19
+ Requires-Dist: pyserial
20
+ Requires-Dist: pybase64
21
+ Requires-Dist: untangle
22
+ Requires-Dist: nest_asyncio
19
23
 
20
24
  Python control of selve devices through USB-RF Gateway
21
25
  ======================================================
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-selve-new
3
- Version: 1.1.5
3
+ Version: 1.1.6
4
4
  Summary: Python library for interfacing with selve devices using the USB-RF controller; forked from GPULIDO
5
5
  Home-page: https://github.com/Kannix2005/python-selve
6
6
  Author: Stefan Altheimer
@@ -16,6 +16,10 @@ Classifier: Programming Language :: Python :: 3.5
16
16
  Classifier: Programming Language :: Python :: 3.6
17
17
  Description-Content-Type: text/markdown
18
18
  License-File: LICENSE
19
+ Requires-Dist: pyserial
20
+ Requires-Dist: pybase64
21
+ Requires-Dist: untangle
22
+ Requires-Dist: nest_asyncio
19
23
 
20
24
  Python control of selve devices through USB-RF Gateway
21
25
  ======================================================
@@ -1,6 +1,9 @@
1
1
  #!/usr/bin/python
2
2
 
3
3
  import asyncio
4
+
5
+ import serial.tools
6
+ import serial.tools.list_ports
4
7
  import nest_asyncio
5
8
  from selve.commandClasses.command import CommeoCommandDevice, CommeoCommandGroup, CommeoCommandGroupMan
6
9
  from selve.commandClasses.common import CommeoParamGetEvent, CommeoParamSetEvent, CommeoServiceFactoryReset, CommeoServiceGetState, CommeoServiceGetVersion, CommeoServicePing, CommeoServiceReset
@@ -40,15 +43,18 @@ class Gateway():
40
43
  self._LOGGER = _LOGGER
41
44
  self.lock = threading.Lock()
42
45
  self.devices: dict = {}
46
+ self.loop = None
43
47
 
44
48
 
45
- self.configserial()
46
49
 
47
50
  try:
48
51
  loop = asyncio.get_running_loop()
49
52
  except RuntimeError: # no event loop running:
50
53
  loop = asyncio.new_event_loop()
51
54
 
55
+ self.loop = loop
56
+ self.configserial()
57
+
52
58
  if discover:
53
59
  _LOGGER.info("Discovering devices")
54
60
  asyncio.set_event_loop(loop)
@@ -64,17 +70,65 @@ class Gateway():
64
70
  """
65
71
  Configure the serial port
66
72
  """
67
- self.ser = serial.Serial(
68
- port=self.port,
69
- baudrate=115200,
70
- parity=serial.PARITY_NONE,
71
- stopbits=serial.STOPBITS_ONE,
72
- bytesize=serial.EIGHTBITS)
73
- self.ser.timeout = 0
74
- self.ser.xonxoff = False
75
- self.ser.rtscts = False
76
- self.ser.dsrdtr = False
77
- self.ser.writeTimeout = 2
73
+ if self.port is None:
74
+ _ser = None
75
+ available_ports = serial.tools.list_ports.comports()
76
+ self._LOGGER.debug("available comports: " + str(available_ports))
77
+ if len(available_ports) == 0:
78
+ self._LOGGER.error("No available comports!")
79
+ raise GatewayError
80
+
81
+ for p in available_ports:
82
+ try:
83
+ _ser = serial.Serial(
84
+ port=p.device,
85
+ baudrate=115200,
86
+ parity=serial.PARITY_NONE,
87
+ stopbits=serial.STOPBITS_ONE,
88
+ bytesize=serial.EIGHTBITS)
89
+ _ser.timeout = 0
90
+ _ser.xonxoff = False
91
+ _ser.rtscts = False
92
+ _ser.dsrdtr = False
93
+ _ser.writeTimeout = 2
94
+ except Exception as e:
95
+ self._LOGGER.debug("Error at com port: " + str(e))
96
+ try:
97
+ _ser.close()
98
+ except:
99
+ self._LOGGER.debug("Cannot close com port")
100
+ _ser = None
101
+ pass
102
+ if self.loop.run_until_complete(self.gatewayReady()):
103
+ self.ser = _ser
104
+ return
105
+ else:
106
+ _ser.close()
107
+ _ser = None
108
+ else:
109
+ self._LOGGER.error("No gateway on comports found!")
110
+ raise GatewayError
111
+
112
+ else:
113
+ try:
114
+ self.ser = serial.Serial(
115
+ port=self.port,
116
+ baudrate=115200,
117
+ parity=serial.PARITY_NONE,
118
+ stopbits=serial.STOPBITS_ONE,
119
+ bytesize=serial.EIGHTBITS)
120
+ self.ser.timeout = 0
121
+ self.ser.xonxoff = False
122
+ self.ser.rtscts = False
123
+ self.ser.dsrdtr = False
124
+ self.ser.writeTimeout = 2
125
+ except Exception as e:
126
+ self._LOGGER.debug("Trying other comports - configured one not valid")
127
+
128
+ self.port = None
129
+ self.configserial()
130
+
131
+
78
132
 
79
133
  def handleData(self, data):
80
134
  incomingEvent(str(data))
@@ -15,7 +15,7 @@ with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
15
15
  setup(
16
16
 
17
17
  name='python-selve-new', # Required
18
- version='1.1.5', # Required
18
+ version='1.1.6', # Required
19
19
  description='Python library for interfacing with selve devices using the USB-RF controller; forked from GPULIDO', # Required
20
20
  long_description=long_description, # Optional
21
21
  long_description_content_type="text/markdown",