python-selve-new 2.2.1__tar.gz → 2.2.2__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 (32) hide show
  1. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/PKG-INFO +1 -1
  2. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/python_selve_new.egg-info/PKG-INFO +1 -1
  3. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/selve/__init__.py +445 -87
  4. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/selve/commands/device.py +4 -0
  5. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/selve/commands/sender.py +2 -2
  6. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/selve/commands/sensor.py +4 -0
  7. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/setup.py +1 -1
  8. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/LICENSE +0 -0
  9. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/README.md +0 -0
  10. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/python_selve_new.egg-info/SOURCES.txt +0 -0
  11. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/python_selve_new.egg-info/dependency_links.txt +0 -0
  12. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/python_selve_new.egg-info/requires.txt +0 -0
  13. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/python_selve_new.egg-info/top_level.txt +0 -0
  14. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/selve/commands/__init__.py +0 -0
  15. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/selve/commands/command.py +0 -0
  16. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/selve/commands/event.py +0 -0
  17. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/selve/commands/group.py +0 -0
  18. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/selve/commands/iveo.py +0 -0
  19. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/selve/commands/param.py +0 -0
  20. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/selve/commands/senSim.py +0 -0
  21. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/selve/commands/service.py +0 -0
  22. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/selve/device.py +0 -0
  23. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/selve/gateway.py +0 -0
  24. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/selve/group.py +0 -0
  25. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/selve/iveo.py +0 -0
  26. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/selve/senSim.py +0 -0
  27. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/selve/sender.py +0 -0
  28. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/selve/sensor.py +0 -0
  29. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/selve/util/__init__.py +0 -0
  30. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/selve/util/errors.py +0 -0
  31. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/selve/util/protocol.py +0 -0
  32. {python-selve-new-2.2.1 → python-selve-new-2.2.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-selve-new
3
- Version: 2.2.1
3
+ Version: 2.2.2
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.2.1
3
+ Version: 2.2.2
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
@@ -12,6 +12,7 @@ from serial.tools import list_ports
12
12
  import untangle
13
13
 
14
14
  from selve.commands import param, service
15
+ from selve.commands import device
15
16
  from selve.commands.device import *
16
17
  from selve.commands.command import *
17
18
  from selve.commands.event import *
@@ -318,6 +319,10 @@ class Selve:
318
319
  self.commandResult(response)
319
320
  if isinstance(response, DeviceGetValuesResponse):
320
321
  self.updateCommeoDeviceValuesFromResponse(int(response.parameters[1][1]), response)
322
+ if isinstance(response, SenderTeachResultResponse) \
323
+ or isinstance(response, SensorTeachResultResponse)\
324
+ or isinstance(response, DeviceScanResultResponse):
325
+ self.processTeachResponse(response)
321
326
 
322
327
  return response
323
328
 
@@ -761,93 +766,32 @@ class Selve:
761
766
  return i
762
767
  i = i + 1
763
768
 
764
- async def pingGateway(self):
765
- cmd = service.ServicePing()
766
- methodResponse = await self.executeCommandSyncWithResponse(cmd)
767
- try:
768
- if hasattr(methodResponse, "name"):
769
- if methodResponse.name == "selve.GW.service.ping":
770
- self._LOGGER.debug("Ping back")
771
- return True
772
- except:
773
- self._LOGGER.debug("Error in ping")
774
- self._LOGGER.debug("No ping")
775
- return False
776
-
777
-
778
- async def gatewayState(self):
779
- cmd = service.ServiceGetState()
780
- try:
781
- methodResponse = await self.executeCommandSyncWithResponse(cmd)
782
- except GatewayError:
783
- self._LOGGER.error(str(GatewayError))
784
- methodResponse = None
785
-
786
- if hasattr(methodResponse, "name"):
787
- if methodResponse.name == "selve.GW." + str(CommeoServiceCommand.GETSTATE.value):
788
- if hasattr(methodResponse, "parameters"):
789
- status = ServiceState(int(methodResponse.parameters[0][1]))
790
- self._LOGGER.debug(f'Gateway state: {status}')
791
- self.state = status
792
- return status
793
- return None
794
-
795
- async def gatewayReady(self):
796
- state = await self.gatewayState()
797
- return state is ServiceState.READY
798
-
799
- async def getVersionG(self):
800
- cmd = service.ServiceGetVersion()
801
- methodResponse = await self.executeCommandSyncWithResponse(cmd)
802
- return methodResponse
803
-
804
- async def getGatewayFirmwareVersion(self):
805
- command = await self.getVersionG()
806
- if hasattr(command, "version"):
807
- return command.version
808
- else:
809
- return False
810
-
811
- async def getGatewaySerial(self):
812
- command = await self.getVersionG()
813
- if hasattr(command, "serial"):
814
- return command.serial
815
- else:
816
- return False
817
-
818
- async def getGatewaySpec(self):
819
- command = await self.getVersionG()
820
- if hasattr(command, "spec"):
821
- return command.spec
822
- else:
823
- return False
824
-
825
- def list_devices(self):
826
- """[summary]
827
- Log the list of registered devices
828
- """
829
- for id, val in self.devices.items():
830
- for ida, device in val.items():
831
- self._LOGGER.info(str(device))
832
-
833
- async def resetGateway(self):
834
- command = service.ServiceReset()
835
- response: ServiceResetResponse = await self.executeCommandSyncWithResponse(command)
836
- if response.executed != 1:
837
- self._LOGGER.info("Error: Gateway could not be reset or loads too long")
838
-
839
- # time.sleep(2)
769
+ async def processTeachResponse(self, response):
770
+ if isinstance(response, SenderTeachResultResponse):
771
+ if response.senderId == -1:
772
+ self._LOGGER.info("No Senders found yet...")
773
+ else:
774
+ self._LOGGER.info("Sender found: " + str(response.name) + " - " + str(response.senderId))
775
+ self._LOGGER.info("Time left for teaching: " + str(response.timeLeft) + "s")
776
+ self._LOGGER.debug("Current teaching state: " + str(response.teachState.name))
777
+ self._LOGGER.info("Last event: " + str(response.senderEvent.name))
778
+
779
+ if isinstance(response, SensorTeachResultResponse):
780
+ if response.foundId == -1:
781
+ self._LOGGER.info("No Senders found yet...")
782
+ else:
783
+ self._LOGGER.info("Sensor found: " + str(response.foundId))
784
+ self._LOGGER.info("Time left for teaching: " + str(response.timeLeft) + "s")
785
+ self._LOGGER.debug("Current teaching state: " + str(response.teachState.name))
786
+
787
+ if isinstance(response, DeviceScanResultResponse):
788
+ if response.noNewDevices <= 0:
789
+ self._LOGGER.info("No Senders found yet...")
790
+ else:
791
+ self._LOGGER.info("Devices found: " + str(response.foundIds))
792
+ self._LOGGER.debug("Current teaching state: " + str(response.scanState.name))
840
793
 
841
- start_time = time.time()
842
- while await self.gatewayState() != ServiceState.READY:
843
- if time.time() - start_time >= 10:
844
- self._LOGGER.info("Error: Gateway could not be reset or loads too long")
845
- pass
846
- self._LOGGER.info("Gateway reset")
847
794
 
848
- async def setEvents(self, eventDevice = False, eventSensor = False, eventSender = False, eventLogging = False, eventDuty = False):
849
- command = param.ParamSetEvent(eventDevice, eventSensor, eventSender, eventLogging, eventDuty)
850
- return await self.executeCommandSyncWithResponse(command)
851
795
 
852
796
  async def processEventResponse(self, response):
853
797
  if isinstance(response, CommeoDeviceEventResponse):
@@ -930,8 +874,213 @@ class Selve:
930
874
  for callback in self._callbacks:
931
875
  callback()
932
876
 
933
- ##Device functions
934
877
 
878
+ ### Service
879
+
880
+ async def pingGateway(self):
881
+ cmd = ServicePing()
882
+ methodResponse = await self.executeCommandSyncWithResponse(cmd)
883
+ try:
884
+ if hasattr(methodResponse, "name"):
885
+ if methodResponse.name == "selve.GW.service.ping":
886
+ self._LOGGER.debug("Ping back")
887
+ return True
888
+ except:
889
+ self._LOGGER.debug("Error in ping")
890
+ self._LOGGER.debug("No ping")
891
+ return False
892
+
893
+
894
+ async def gatewayState(self):
895
+ cmd = ServiceGetState()
896
+ try:
897
+ methodResponse = await self.executeCommandSyncWithResponse(cmd)
898
+ except GatewayError:
899
+ self._LOGGER.error(str(GatewayError))
900
+ methodResponse = None
901
+
902
+ if hasattr(methodResponse, "name"):
903
+ if methodResponse.name == "selve.GW." + str(CommeoServiceCommand.GETSTATE.value):
904
+ if hasattr(methodResponse, "parameters"):
905
+ status = ServiceState(int(methodResponse.parameters[0][1]))
906
+ self._LOGGER.debug(f'Gateway state: {status}')
907
+ self.state = status
908
+ return status
909
+ return None
910
+
911
+ async def gatewayReady(self):
912
+ state = await self.gatewayState()
913
+ return state is ServiceState.READY
914
+
915
+ async def getVersionG(self):
916
+ cmd = ServiceGetVersion()
917
+ methodResponse = await self.executeCommandSyncWithResponse(cmd)
918
+ return methodResponse
919
+
920
+ async def getGatewayFirmwareVersion(self):
921
+ command = await self.getVersionG()
922
+ if hasattr(command, "version"):
923
+ return command.version
924
+ else:
925
+ return False
926
+
927
+ async def getGatewaySerial(self):
928
+ command = await self.getVersionG()
929
+ if hasattr(command, "serial"):
930
+ return command.serial
931
+ else:
932
+ return False
933
+
934
+ async def getGatewaySpec(self):
935
+ command = await self.getVersionG()
936
+ if hasattr(command, "spec"):
937
+ return command.spec
938
+ else:
939
+ return False
940
+
941
+ def list_devices(self):
942
+ """[summary]
943
+ Log the list of registered devices
944
+ """
945
+ for id, val in self.devices.items():
946
+ for ida, device in val.items():
947
+ self._LOGGER.info(str(device))
948
+
949
+ async def resetGateway(self):
950
+ command = ServiceReset()
951
+ response: ServiceResetResponse = await self.executeCommandSyncWithResponse(command)
952
+ if response.executed is not True:
953
+ self._LOGGER.info("Error: Gateway could not be reset or loads too long")
954
+
955
+ # time.sleep(2)
956
+
957
+ start_time = time.time()
958
+ while await self.gatewayState() != ServiceState.READY:
959
+ if time.time() - start_time >= 30:
960
+ self._LOGGER.info("Error: Gateway could not be reset or loads too long")
961
+ pass
962
+ self._LOGGER.info("Gateway reset")
963
+
964
+ async def factoryResetGateway(self):
965
+ command = ServiceFactoryReset()
966
+ response: ServiceFactoryResetResponse = await self.executeCommandSyncWithResponse(command)
967
+ if response.executed is not True:
968
+ self._LOGGER.info("Error: Gateway could not be reset or loads too long")
969
+
970
+ start_time = time.time()
971
+ while await self.gatewayState() != ServiceState.READY:
972
+ if time.time() - start_time >= 60:
973
+ self._LOGGER.info("Error: Gateway could not be reset or loads too long")
974
+ pass
975
+ self._LOGGER.info("Gateway factory reset")
976
+ return response.executed
977
+
978
+ async def setLED(self, state: bool):
979
+ command = ServiceSetLed(state)
980
+ response: ServiceSetLedResponse = await self.executeCommandSyncWithResponse(command)
981
+ return response.executed
982
+
983
+ async def getLED(self):
984
+ command = ServiceGetLed()
985
+ response: ServiceGetLedResponse = await self.executeCommandSyncWithResponse(command)
986
+ return response
987
+
988
+ ### Param
989
+ async def setForward(self, state: bool):
990
+ command = ParamSetForward(state)
991
+ response: ParamSetForwardResponse = await self.executeCommandSyncWithResponse(command)
992
+ return response.executed
993
+
994
+ async def getForward(self):
995
+ command = ParamGetForward()
996
+ response: ParamGetForwardResponse = await self.executeCommandSyncWithResponse(command)
997
+ return response
998
+
999
+ async def setEvents(self, eventDevice = False, eventSensor = False, eventSender = False, eventLogging = False, eventDuty = False):
1000
+ command = ParamSetEvent(eventDevice, eventSensor, eventSender, eventLogging, eventDuty)
1001
+ return await self.executeCommandSyncWithResponse(command)
1002
+
1003
+
1004
+ async def getEvents(self):
1005
+ command = ParamGetEvent()
1006
+ response: ParamGetEventResponse = await self.executeCommandSyncWithResponse(command)
1007
+ return response
1008
+
1009
+
1010
+ async def getDuty(self):
1011
+ command = ParamGetDuty()
1012
+ response: ParamGetDutyResponse = await self.executeCommandSyncWithResponse(command)
1013
+ return response
1014
+
1015
+ async def getRF(self):
1016
+ command = ParamGetRf()
1017
+ response: ParamGetRfResponse = await self.executeCommandSyncWithResponse(command)
1018
+ return response
1019
+
1020
+
1021
+
1022
+ ##Device functions
1023
+ async def scanStart(self):
1024
+ command = DeviceScanStart()
1025
+ response: DeviceScanStartResponse = await self.executeCommandSyncWithResponse(command)
1026
+ return response.executed
1027
+
1028
+ async def scanStop(self):
1029
+ command = DeviceScanStop()
1030
+ response: DeviceScanStopResponse = await self.executeCommandSyncWithResponse(command)
1031
+ return response.executed
1032
+
1033
+ async def scanResult(self):
1034
+ """ manually polls the scan state, but the states are being reported automatically by the gateway itself"""
1035
+ command = DeviceScanResult()
1036
+ response: DeviceScanResultResponse = await self.executeCommandSyncWithResponse(command)
1037
+ return response
1038
+
1039
+ async def deviceSave(self, id: int):
1040
+ command = DeviceSave(id)
1041
+ response: DeviceSaveResponse = await self.executeCommandSyncWithResponse(command)
1042
+ return response.executed
1043
+
1044
+ async def deviceGetIds(self):
1045
+ command = DeviceGetIds()
1046
+ response: DeviceGetIdsResponse = await self.executeCommandSyncWithResponse(command)
1047
+ return response
1048
+
1049
+ async def deviceGetInfo(self, id: int):
1050
+ command = DeviceGetInfo(id)
1051
+ response: DeviceGetInfoResponse = await self.executeCommandSyncWithResponse(command)
1052
+ return response
1053
+
1054
+ async def deviceGetValues(self, id: int):
1055
+ command = DeviceGetValues(id)
1056
+ response: DeviceGetValuesResponse = await self.executeCommandSyncWithResponse(command)
1057
+ return response
1058
+
1059
+ async def deviceSetFunction(self, id: int, function: DeviceFunctions):
1060
+ command = DeviceSetFunction(id, function)
1061
+ response: DeviceSetFunctionResponse = await self.executeCommandSyncWithResponse(command)
1062
+ return response.executed
1063
+
1064
+ async def deviceSetLabel(self, id: int, label: str):
1065
+ command = DeviceSetLabel(id, label)
1066
+ response: DeviceSetLabelResponse = await self.executeCommandSyncWithResponse(command)
1067
+ return response.executed
1068
+
1069
+ async def deviceSetType(self, id: int, type: DeviceType):
1070
+ command = DeviceSetType(id, type)
1071
+ response: DeviceSetTypeResponse = await self.executeCommandSyncWithResponse(command)
1072
+ return response.executed
1073
+
1074
+ async def deviceDelete(self, id: int):
1075
+ command = DeviceDelete(id)
1076
+ response: DeviceDeleteResponse = await self.executeCommandSyncWithResponse(command)
1077
+ return response.executed
1078
+
1079
+ async def deviceWriteManual(self, id: int, address: int, name: str, config: DeviceType):
1080
+ command = DeviceWriteManual(id, address, name, config)
1081
+ response: DeviceWriteManualResponse = await self.executeCommandSyncWithResponse(command)
1082
+ return response.executed
1083
+
935
1084
  async def updateCommeoDeviceValues(self, id: int):
936
1085
  response: DeviceGetValuesResponse = await self.executeCommandSyncWithResponse(DeviceGetValues(id))
937
1086
  self.updateCommeoDeviceValuesFromResponse(id, response)
@@ -1043,7 +1192,28 @@ class Selve:
1043
1192
  self.setDeviceValue(device.id, 50, SelveTypes.IVEO)
1044
1193
  self.setDeviceTargetValue(device.id, 50, SelveTypes.IVEO)
1045
1194
 
1195
+
1046
1196
  ## Group
1197
+ async def groupRead(self, id: int):
1198
+ command = GroupRead(id)
1199
+ response: GroupReadResponse = await self.executeCommandSyncWithResponse(command)
1200
+ return response
1201
+
1202
+ async def groupWrite(self, id: int, actorIds: dict, name: str):
1203
+ command = GroupWrite(id, actorIds, name)
1204
+ response: GroupWriteResponse = await self.executeCommandSyncWithResponse(command)
1205
+ return response.executed
1206
+
1207
+ async def groupGetIds(self):
1208
+ command = GroupGetIds()
1209
+ response: GroupGetIdsResponse = await self.executeCommandSyncWithResponse(command)
1210
+ return response
1211
+
1212
+ async def groupDelete(self, id: int):
1213
+ command = GroupDelete(id)
1214
+ response: GroupDeleteResponse = await self.executeCommandSyncWithResponse(command)
1215
+ return response.executed
1216
+
1047
1217
  async def moveGroupUp(self, group: SelveGroup, type=DeviceCommandType.MANUAL):
1048
1218
  await self.executeCommand(CommandDriveUpGroup(group.id, type))
1049
1219
  for id in Util.b64_mask_to_list(group.mask):
@@ -1060,14 +1230,202 @@ class Selve:
1060
1230
  await self.updateCommeoDeviceValuesAsync(id)
1061
1231
 
1062
1232
 
1233
+ ### Iveo
1234
+ async def iveoSetRepeater(self, repeaterInstalled: int):
1235
+ """
1236
+ Sets the repeater level. \n
1237
+ repeaterInstalled: int can be \n
1238
+ 0 = no repeater installed\n
1239
+ 1 = repeater installed for 1-time forwarding\n
1240
+ 2 = multiple repeaters installed for 2-time forwarding
1241
+ """
1242
+ command = IveoSetRepeater(repeaterInstalled)
1243
+ response: IveoSetRepeaterResponse = await self.executeCommandSyncWithResponse(command)
1244
+ return response.executed
1245
+
1246
+ async def iveoGetRepeater(self):
1247
+ """
1248
+ Gets the repeater level. \n
1249
+ response.repeaterState: int can be \n
1250
+ 0 = no repeater installed\n
1251
+ 1 = repeater installed for 1-time forwarding\n
1252
+ 2 = multiple repeaters installed for 2-time forwarding
1253
+ """
1254
+ command = IveoGetRepeater()
1255
+ response: IveoGetRepeaterResponse = await self.executeCommandSyncWithResponse(command)
1256
+ return response
1257
+
1258
+ async def iveoSetLabel(self, id: int, label: str):
1259
+ command = IveoSetLabel(id, label)
1260
+ response: IveoSetLabelResponse = await self.executeCommandSyncWithResponse(command)
1261
+ return response.executed
1262
+
1263
+ async def iveoSetType(self, id: int, activity: int, type: DeviceType):
1264
+ """
1265
+ Sets the device configuration. \n
1266
+ id: Iveo device id
1267
+ activity: 0 = channel deactivated, 1 = channel active
1268
+ type: DeviceType
1269
+
1270
+ """
1271
+ command = IveoSetConfig(id, activity, type)
1272
+ response: IveoSetConfigResponse = await self.executeCommandSyncWithResponse(command)
1273
+ return response.executed
1274
+
1275
+ async def iveoGetType(self, id: int):
1276
+ """
1277
+ Gets the device configuration.
1278
+
1279
+ Params:
1280
+ id: Iveo device id
1281
+
1282
+ Response:
1283
+ name: Name of device
1284
+ activity: 0 = channel deactivated, 1 = channel active
1285
+ type: DeviceType
1286
+
1287
+ """
1288
+ command = IveoGetConfig(id)
1289
+ response: IveoGetConfigResponse = await self.executeCommandSyncWithResponse(command)
1290
+ return response
1291
+
1292
+ async def iveoGetIds(self):
1293
+ command = IveoGetIds()
1294
+ response: IveoGetIdsResponse = await self.executeCommandSyncWithResponse(command)
1295
+ return response
1296
+
1297
+ async def iveoFactoryReset(self):
1298
+ command = IveoFactory()
1299
+ response: IveoFactoryResponse = await self.executeCommandSyncWithResponse(command)
1300
+ return response.executed
1301
+
1302
+ async def iveoTeach(self):
1303
+ command = IveoTeach()
1304
+ response: IveoTeachResponse = await self.executeCommandSyncWithResponse(command)
1305
+ return response.executed
1306
+
1307
+ async def iveoLearn(self, id: int):
1308
+ command = IveoLearn(id)
1309
+ response: IveoLearnResponse = await self.executeCommandSyncWithResponse(command)
1310
+ return response.executed
1311
+
1312
+ async def iveoCommandManual(self, actorId: int, command: DriveCommandIveo):
1313
+ command = IveoManual(actorId, command)
1314
+ response: IveoManualResponse = await self.executeCommandSyncWithResponse(command)
1315
+ return response.executed
1316
+
1317
+ async def iveoCommandAutomatic(self, actorId: int, command: DriveCommandIveo):
1318
+ command = IveoAutomatic(actorId, command)
1319
+ response: IveoAutomaticResponse = await self.executeCommandSyncWithResponse(command)
1320
+ return response.executed
1321
+
1322
+
1323
+
1063
1324
  ### Sensor
1325
+ async def sensorTeachStart(self):
1326
+ command = SensorTechStart()
1327
+ response: SensorTeachStartResponse = await self.executeCommandSyncWithResponse(command)
1328
+ return response.executed
1329
+
1330
+ async def sensorTeachStop(self):
1331
+ command = SensorTeachStop()
1332
+ response: SensorTeachStopResponse = await self.executeCommandSyncWithResponse(command)
1333
+ return response.executed
1334
+
1335
+ async def sensorTeachResult(self):
1336
+ """ manually polls the teach result state, but the states are being reported automatically by the gateway itself"""
1337
+ command = SensorTeachResult()
1338
+ response: SensorTeachResultResponse = await self.executeCommandSyncWithResponse(command)
1339
+ return response
1340
+
1341
+ async def sensorGetIds(self):
1342
+ command = SensorGetIds()
1343
+ response: SensorGetIdsResponse = await self.executeCommandSyncWithResponse(command)
1344
+ return response
1345
+
1346
+ async def sensorGetInfo(self, id: int):
1347
+ command = SensorGetInfo(id)
1348
+ response: SensorGetInfoResponse = await self.executeCommandSyncWithResponse(command)
1349
+ return response
1350
+
1351
+ async def sensorGetValues(self, id: int):
1352
+ command = SensorGetValues(id)
1353
+ response: SensorGetValuesResponse = await self.executeCommandSyncWithResponse(command)
1354
+ return response
1355
+
1356
+ async def sensorSetLabel(self, id: int, label: str):
1357
+ command = SensorSetLabel(id, label)
1358
+ response: SensorSetLabelResponse = await self.executeCommandSyncWithResponse(command)
1359
+ return response.executed
1360
+
1361
+ async def sensorDelete(self, id: int):
1362
+ command = SensorDelete(id)
1363
+ response: SensorDeleteResponse = await self.executeCommandSyncWithResponse(command)
1364
+ return response.executed
1365
+
1366
+ async def sensorWriteManual(self, id: int, address: int, name: str):
1367
+ command = SensorWriteManual(id, address, name)
1368
+ response: SensorWriteManualResponse = await self.executeCommandSyncWithResponse(command)
1369
+ return response.executed
1370
+
1064
1371
  async def updateSensorValuesAsync(self, id: int):
1065
1372
  await self.executeCommand(SensorGetValues(id))
1066
1373
 
1067
- ### SenSim
1374
+
1375
+
1376
+ ### SenSim - ToDo
1068
1377
  async def updateSenSimValuesAsync(self, id: int):
1069
1378
  await self.executeCommand(SenSimGetValues(id))
1070
1379
 
1071
1380
  ### Sender
1381
+ async def senderTeachStart(self):
1382
+ command = SenderTeachStart()
1383
+ response: SenderTeachStartResponse = await self.executeCommandSyncWithResponse(command)
1384
+ return response.executed
1385
+
1386
+ async def senderTeachStop(self):
1387
+ command = SenderTeachStop()
1388
+ response: SenderTeachStopResponse = await self.executeCommandSyncWithResponse(command)
1389
+ return response.executed
1390
+
1391
+ async def senderTeachResult(self):
1392
+ """ manually polls the teach result state, but the states are being reported automatically by the gateway itself"""
1393
+ command = SenderTeachResult()
1394
+ response: SenderTeachResultResponse = await self.executeCommandSyncWithResponse(command)
1395
+ return response
1396
+
1397
+ async def senderGetIds(self):
1398
+ command = SenderGetIds()
1399
+ response: SenderGetIdsResponse = await self.executeCommandSyncWithResponse(command)
1400
+ return response
1401
+
1402
+ async def senderGetInfo(self, id: int):
1403
+ command = SenderGetInfo(id)
1404
+ response: SenderGetInfoResponse = await self.executeCommandSyncWithResponse(command)
1405
+ return response
1406
+
1407
+ async def senderGetValues(self, id: int):
1408
+ command = SenderGetValues(id)
1409
+ response: SenderGetValuesResponse = await self.executeCommandSyncWithResponse(command)
1410
+ return response
1411
+
1412
+ async def senderSetLabel(self, id: int, label: str):
1413
+ command = SenderSetLabel(id, label)
1414
+ response: SenderSetLabelResponse = await self.executeCommandSyncWithResponse(command)
1415
+ return response.executed
1416
+
1417
+ async def senderDelete(self, id: int):
1418
+ command = SenderDelete(id)
1419
+ response: SenderDeleteResponse = await self.executeCommandSyncWithResponse(command)
1420
+ return response.executed
1421
+
1422
+ async def senderWriteManual(self, id: int, address: int, channel: int, resetCount: int, name: str):
1423
+ command = SenderWriteManual(id, address, channel, resetCount, name)
1424
+ response: SenderWriteManualResponse = await self.executeCommandSyncWithResponse(command)
1425
+ return response.executed
1426
+
1427
+
1428
+
1429
+
1072
1430
  async def updateSenderValuesAsync(self, id: int):
1073
1431
  await self.executeCommand(SenderGetValues(id))
@@ -10,6 +10,10 @@ class DeviceScanStop(GatewayCommand):
10
10
  def __init__(self):
11
11
  super().__init__(CommeoDeviceCommand.SCANSTOP)
12
12
 
13
+ class DeviceScanResult(GatewayCommand):
14
+ def __init__(self):
15
+ super().__init__(CommeoDeviceCommand.SCANRESULT)
16
+
13
17
 
14
18
  class DeviceSave(GatewayCommand):
15
19
  def __init__(self, id: int):
@@ -25,8 +25,8 @@ class SenderGetValues(GatewayCommand):
25
25
  super().__init__(CommeoSenderCommand.GETVALUES, [(ParameterType.INT, id)])
26
26
 
27
27
  class SenderSetLabel(GatewayCommand):
28
- def __init__(self, id: int):
29
- super().__init__(CommeoSenderCommand.SETLABEL, [(ParameterType.INT, id)])
28
+ def __init__(self, id: int, name: str):
29
+ super().__init__(CommeoSenderCommand.SETLABEL, [(ParameterType.INT, id), (ParameterType.STRING, name)])
30
30
 
31
31
  class SenderDelete(GatewayCommand):
32
32
  def __init__(self, id: int):
@@ -10,6 +10,10 @@ class SensorTeachStop(GatewayCommand):
10
10
  def __init__(self):
11
11
  super().__init__(CommeoSensorCommand.TEACHSTOP)
12
12
 
13
+ class SensorTeachResult(GatewayCommand):
14
+ def __init__(self):
15
+ super().__init__(CommeoSensorCommand.TEACHRESULT)
16
+
13
17
 
14
18
  class SensorGetIds(GatewayCommand):
15
19
  def __init__(self):
@@ -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.2.1', # Required
18
+ version='2.2.2', # 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",