diff options
author | CoprDistGit <infra@openeuler.org> | 2023-04-12 06:23:27 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-04-12 06:23:27 +0000 |
commit | 0c6c49cfa30426421324659dbf940d237cb045df (patch) | |
tree | a13984826394f63f0a4fc9503a036ed0197becdd | |
parent | 740585685d1db06b5d141ba2cc916bc1f7a5884b (diff) |
automatic import of python-boschshcpy
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-boschshcpy.spec | 649 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 651 insertions, 0 deletions
@@ -0,0 +1 @@ +/boschshcpy-0.2.56.tar.gz diff --git a/python-boschshcpy.spec b/python-boschshcpy.spec new file mode 100644 index 0000000..7605d1b --- /dev/null +++ b/python-boschshcpy.spec @@ -0,0 +1,649 @@ +%global _empty_manifest_terminate_build 0 +Name: python-boschshcpy +Version: 0.2.56 +Release: 1 +Summary: Bosch Smart Home Controller API Python Library +License: bsd-3-clause +URL: https://github.com/tschamm/boschshcpy +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/84/26/8411e5db1eb0ab35eee1ffff81a67c32b2cdf2e601c2f41a321b8501c75f/boschshcpy-0.2.56.tar.gz +BuildArch: noarch + +Requires: python3-cryptography +Requires: python3-getmac +Requires: python3-requests +Requires: python3-zeroconf + +%description +# Bosch Smart Home Controller API Python Library + +This library implements the local communication REST API for the Bosch Smart Home Controller system. It supports both long and short polling. The API documentation is available [here](https://github.com/BoschSmartHome/bosch-shc-api-docs). + +The following device services are implemented: + +* ```TemperatureLevel``` +* ```HumidityLevel``` +* ```RoomClimateControl``` +* ```ShutterContact``` +* ```ValveTappet``` +* ```PowerSwitch``` +* ```PowerMeter``` +* ```Routing``` +* ```PowerSwitchProgram``` +* ```PresenceSimulationConfiguration``` +* ```BinarySwitch``` +* ```SmokeDetectorCheck``` +* ```Alarm``` +* ```ShutterControl``` +* ```CameraLight``` +* ```PrivacyMode``` +* ```CameraNotification``` +* ```IntrusionDetectionControl``` +* ```Keypad``` +* ```LatestMotion``` +* ```AirQualityLevel``` +* ```SurveillanceAlarm``` +* ```BatteryLevel``` +* ```Thermostat``` +* ```WaterLeakageSensor``` +* ```WaterLeakageSensorTilt``` +* and more + +The following device models are implemented, using the above services: + +* ```ShutterContact```, ```ShutterContact2``` +* ```ShutterControl```, ```Micromodule Shutter``` +* ```SmartPlug``` +* ```SmartPlugCompact``` +* ```LightControl```, ```Micromodule Light Control```, ```Micromodule Light Attached``` +* ```SmokeDetector``` +* ```CameraEyes```, ```Camera360``` +* ```IntrusionDetectionSystem``` +* ```RoomClimateControl``` +* ```Thermostat```, ```Thermostat2``` +* ```WallThermostat``` +* ```UniversalSwitch``` +* ```MotionDetector``` +* ```PresenceSimulationSystem``` +* ```Twinguard``` +* ```WaterLeakageSensor``` + +## Command line access to SHC +1. Install a `python` (>=3.10) environment on your computer. +2. Install latest version of `boschshcpy`, you should have at least `version>=0.2.45`. +```bash +pip install boschshcpy +``` + +### Registering a new client + +To register a new client, use the script `boschshc_registerclient`: +```bash +boschshc_registerclient -ip _your_shc_ip_ -pw _your_shc_password_ +``` + +This will register your client and will write the associated certificate/key pair into your working directory. See also [Usage Guide](#usage-guide) + +### Rawscans + +To make a rawscan of your devices, use the script `boschshc_rawscan` + +#### Make a rawscan of the public information +```bash +boschshc_rawscan -ip _your_shc_ip_ -cert _your_shc_cert_file_ -key _your_shc_key_file_ public_information +``` + +#### Make a rawscan of all devices +```bash +boschshc_rawscan -ip _your_shc_ip_ -cert _your_shc_cert_file_ -key _your_shc_key_file_ devices +``` + +#### Make a rawscan of a single device with a known `device_id` +```bash +boschshc_rawscan -ip _your_shc_ip_ -cert _your_shc_cert_file_ -key _your_shc_key_file_ device _your_device_id_ +``` + +An exemplary output looks as follows: +```bash + { + "@type": "device", + "rootDeviceId": "xx-xx-xx-xx-xx-xx", + "id": "hdm:HomeMaticIP:30xxx", + "deviceServiceIds": [ + "Thermostat", + "BatteryLevel", + "ValveTappet", + "SilentMode", + "TemperatureLevel", + "Linking", + "TemperatureOffset" + ], + "manufacturer": "BOSCH", + "roomId": "hz_8", + "deviceModel": "TRV", + "serial": "30xxx", + "profile": "GENERIC", + "name": "Test Thermostat", + "status": "AVAILABLE", + "parentDeviceId": "roomClimateControl_hz_8", + "childDeviceIds": [] + }, +``` + +#### Make a rawscan of the associated services of a device +```bash +boschshc_rawscan -ip _your_shc_ip_ -cert _your_shc_cert_file_ -key _your_shc_key_file_ device_services _your_device_id_ +``` + +The exemplary output will look as follows: +```bash +[ + { + "@type": "DeviceServiceData", + "id": "BatteryLevel", + "deviceId": "hdm:HomeMaticIP:30xxx", + "path": "/devices/hdm:HomeMaticIP:30xxx/services/BatteryLevel" + }, + { + "@type": "DeviceServiceData", + "id": "Thermostat", + "deviceId": "hdm:HomeMaticIP:30xxx", + "state": { + "@type": "childLockState", + "childLock": "OFF" + }, + "path": "/devices/hdm:HomeMaticIP:30xxx/services/Thermostat" + }, +... +] +``` + +#### Make a rawscan of the a service of a device, where the `device_id` as well as the `service_id` are known +```bash +boschshc_rawscan -ip _your_shc_ip_ -cert _your_shc_cert_file_ -key _your_shc_key_file_ device_service _your_device_id_ _your_service_id +``` + +#### Make a rawscan of the all scenarios +```bash +boschshc_rawscan -ip _your_shc_ip_ -cert _your_shc_cert_file_ -key _your_shc_key_file_ scenarios +``` + +#### Make a rawscan of the all rooms +```bash +boschshc_rawscan -ip _your_shc_ip_ -cert _your_shc_cert_file_ -key _your_shc_key_file_ rooms +``` + +## Example code to use the `boschshcpy` library + +```python +import boschshcpy + +# Create session +session = boschshcpy.SHCSession(controller_ip="192.168.25.51", certificate='cert.pem', key='key.pem') +session.information.summary() + +device = session.device('roomClimateControl_hz_5') +service = device.device_service('TemperatureLevel') +print(service.temperature) + +# Update this service's state +service.short_poll() + +# Start long polling thread in background +session.start_polling() + +# Do work here +... + +# Stop polling +session.stop_polling() + +# Trigger intrusion detection system +intrusion_control = session.intrusion_system +intrusion_control.arm() +``` + +## Usage guide + +Before accessing the Bosch Smart Home Controller, a client must be registered on the controller. For this a valid cert/key pair must be provided to the controller. To start the client registration, press and hold the button on the controller until the led starts flashing. More information [here](https://github.com/BoschSmartHome/bosch-shc-api-docs/tree/master/postman#register-a-new-client-to-the-bosch-smart-home-controller). + + +%package -n python3-boschshcpy +Summary: Bosch Smart Home Controller API Python Library +Provides: python-boschshcpy +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-boschshcpy +# Bosch Smart Home Controller API Python Library + +This library implements the local communication REST API for the Bosch Smart Home Controller system. It supports both long and short polling. The API documentation is available [here](https://github.com/BoschSmartHome/bosch-shc-api-docs). + +The following device services are implemented: + +* ```TemperatureLevel``` +* ```HumidityLevel``` +* ```RoomClimateControl``` +* ```ShutterContact``` +* ```ValveTappet``` +* ```PowerSwitch``` +* ```PowerMeter``` +* ```Routing``` +* ```PowerSwitchProgram``` +* ```PresenceSimulationConfiguration``` +* ```BinarySwitch``` +* ```SmokeDetectorCheck``` +* ```Alarm``` +* ```ShutterControl``` +* ```CameraLight``` +* ```PrivacyMode``` +* ```CameraNotification``` +* ```IntrusionDetectionControl``` +* ```Keypad``` +* ```LatestMotion``` +* ```AirQualityLevel``` +* ```SurveillanceAlarm``` +* ```BatteryLevel``` +* ```Thermostat``` +* ```WaterLeakageSensor``` +* ```WaterLeakageSensorTilt``` +* and more + +The following device models are implemented, using the above services: + +* ```ShutterContact```, ```ShutterContact2``` +* ```ShutterControl```, ```Micromodule Shutter``` +* ```SmartPlug``` +* ```SmartPlugCompact``` +* ```LightControl```, ```Micromodule Light Control```, ```Micromodule Light Attached``` +* ```SmokeDetector``` +* ```CameraEyes```, ```Camera360``` +* ```IntrusionDetectionSystem``` +* ```RoomClimateControl``` +* ```Thermostat```, ```Thermostat2``` +* ```WallThermostat``` +* ```UniversalSwitch``` +* ```MotionDetector``` +* ```PresenceSimulationSystem``` +* ```Twinguard``` +* ```WaterLeakageSensor``` + +## Command line access to SHC +1. Install a `python` (>=3.10) environment on your computer. +2. Install latest version of `boschshcpy`, you should have at least `version>=0.2.45`. +```bash +pip install boschshcpy +``` + +### Registering a new client + +To register a new client, use the script `boschshc_registerclient`: +```bash +boschshc_registerclient -ip _your_shc_ip_ -pw _your_shc_password_ +``` + +This will register your client and will write the associated certificate/key pair into your working directory. See also [Usage Guide](#usage-guide) + +### Rawscans + +To make a rawscan of your devices, use the script `boschshc_rawscan` + +#### Make a rawscan of the public information +```bash +boschshc_rawscan -ip _your_shc_ip_ -cert _your_shc_cert_file_ -key _your_shc_key_file_ public_information +``` + +#### Make a rawscan of all devices +```bash +boschshc_rawscan -ip _your_shc_ip_ -cert _your_shc_cert_file_ -key _your_shc_key_file_ devices +``` + +#### Make a rawscan of a single device with a known `device_id` +```bash +boschshc_rawscan -ip _your_shc_ip_ -cert _your_shc_cert_file_ -key _your_shc_key_file_ device _your_device_id_ +``` + +An exemplary output looks as follows: +```bash + { + "@type": "device", + "rootDeviceId": "xx-xx-xx-xx-xx-xx", + "id": "hdm:HomeMaticIP:30xxx", + "deviceServiceIds": [ + "Thermostat", + "BatteryLevel", + "ValveTappet", + "SilentMode", + "TemperatureLevel", + "Linking", + "TemperatureOffset" + ], + "manufacturer": "BOSCH", + "roomId": "hz_8", + "deviceModel": "TRV", + "serial": "30xxx", + "profile": "GENERIC", + "name": "Test Thermostat", + "status": "AVAILABLE", + "parentDeviceId": "roomClimateControl_hz_8", + "childDeviceIds": [] + }, +``` + +#### Make a rawscan of the associated services of a device +```bash +boschshc_rawscan -ip _your_shc_ip_ -cert _your_shc_cert_file_ -key _your_shc_key_file_ device_services _your_device_id_ +``` + +The exemplary output will look as follows: +```bash +[ + { + "@type": "DeviceServiceData", + "id": "BatteryLevel", + "deviceId": "hdm:HomeMaticIP:30xxx", + "path": "/devices/hdm:HomeMaticIP:30xxx/services/BatteryLevel" + }, + { + "@type": "DeviceServiceData", + "id": "Thermostat", + "deviceId": "hdm:HomeMaticIP:30xxx", + "state": { + "@type": "childLockState", + "childLock": "OFF" + }, + "path": "/devices/hdm:HomeMaticIP:30xxx/services/Thermostat" + }, +... +] +``` + +#### Make a rawscan of the a service of a device, where the `device_id` as well as the `service_id` are known +```bash +boschshc_rawscan -ip _your_shc_ip_ -cert _your_shc_cert_file_ -key _your_shc_key_file_ device_service _your_device_id_ _your_service_id +``` + +#### Make a rawscan of the all scenarios +```bash +boschshc_rawscan -ip _your_shc_ip_ -cert _your_shc_cert_file_ -key _your_shc_key_file_ scenarios +``` + +#### Make a rawscan of the all rooms +```bash +boschshc_rawscan -ip _your_shc_ip_ -cert _your_shc_cert_file_ -key _your_shc_key_file_ rooms +``` + +## Example code to use the `boschshcpy` library + +```python +import boschshcpy + +# Create session +session = boschshcpy.SHCSession(controller_ip="192.168.25.51", certificate='cert.pem', key='key.pem') +session.information.summary() + +device = session.device('roomClimateControl_hz_5') +service = device.device_service('TemperatureLevel') +print(service.temperature) + +# Update this service's state +service.short_poll() + +# Start long polling thread in background +session.start_polling() + +# Do work here +... + +# Stop polling +session.stop_polling() + +# Trigger intrusion detection system +intrusion_control = session.intrusion_system +intrusion_control.arm() +``` + +## Usage guide + +Before accessing the Bosch Smart Home Controller, a client must be registered on the controller. For this a valid cert/key pair must be provided to the controller. To start the client registration, press and hold the button on the controller until the led starts flashing. More information [here](https://github.com/BoschSmartHome/bosch-shc-api-docs/tree/master/postman#register-a-new-client-to-the-bosch-smart-home-controller). + + +%package help +Summary: Development documents and examples for boschshcpy +Provides: python3-boschshcpy-doc +%description help +# Bosch Smart Home Controller API Python Library + +This library implements the local communication REST API for the Bosch Smart Home Controller system. It supports both long and short polling. The API documentation is available [here](https://github.com/BoschSmartHome/bosch-shc-api-docs). + +The following device services are implemented: + +* ```TemperatureLevel``` +* ```HumidityLevel``` +* ```RoomClimateControl``` +* ```ShutterContact``` +* ```ValveTappet``` +* ```PowerSwitch``` +* ```PowerMeter``` +* ```Routing``` +* ```PowerSwitchProgram``` +* ```PresenceSimulationConfiguration``` +* ```BinarySwitch``` +* ```SmokeDetectorCheck``` +* ```Alarm``` +* ```ShutterControl``` +* ```CameraLight``` +* ```PrivacyMode``` +* ```CameraNotification``` +* ```IntrusionDetectionControl``` +* ```Keypad``` +* ```LatestMotion``` +* ```AirQualityLevel``` +* ```SurveillanceAlarm``` +* ```BatteryLevel``` +* ```Thermostat``` +* ```WaterLeakageSensor``` +* ```WaterLeakageSensorTilt``` +* and more + +The following device models are implemented, using the above services: + +* ```ShutterContact```, ```ShutterContact2``` +* ```ShutterControl```, ```Micromodule Shutter``` +* ```SmartPlug``` +* ```SmartPlugCompact``` +* ```LightControl```, ```Micromodule Light Control```, ```Micromodule Light Attached``` +* ```SmokeDetector``` +* ```CameraEyes```, ```Camera360``` +* ```IntrusionDetectionSystem``` +* ```RoomClimateControl``` +* ```Thermostat```, ```Thermostat2``` +* ```WallThermostat``` +* ```UniversalSwitch``` +* ```MotionDetector``` +* ```PresenceSimulationSystem``` +* ```Twinguard``` +* ```WaterLeakageSensor``` + +## Command line access to SHC +1. Install a `python` (>=3.10) environment on your computer. +2. Install latest version of `boschshcpy`, you should have at least `version>=0.2.45`. +```bash +pip install boschshcpy +``` + +### Registering a new client + +To register a new client, use the script `boschshc_registerclient`: +```bash +boschshc_registerclient -ip _your_shc_ip_ -pw _your_shc_password_ +``` + +This will register your client and will write the associated certificate/key pair into your working directory. See also [Usage Guide](#usage-guide) + +### Rawscans + +To make a rawscan of your devices, use the script `boschshc_rawscan` + +#### Make a rawscan of the public information +```bash +boschshc_rawscan -ip _your_shc_ip_ -cert _your_shc_cert_file_ -key _your_shc_key_file_ public_information +``` + +#### Make a rawscan of all devices +```bash +boschshc_rawscan -ip _your_shc_ip_ -cert _your_shc_cert_file_ -key _your_shc_key_file_ devices +``` + +#### Make a rawscan of a single device with a known `device_id` +```bash +boschshc_rawscan -ip _your_shc_ip_ -cert _your_shc_cert_file_ -key _your_shc_key_file_ device _your_device_id_ +``` + +An exemplary output looks as follows: +```bash + { + "@type": "device", + "rootDeviceId": "xx-xx-xx-xx-xx-xx", + "id": "hdm:HomeMaticIP:30xxx", + "deviceServiceIds": [ + "Thermostat", + "BatteryLevel", + "ValveTappet", + "SilentMode", + "TemperatureLevel", + "Linking", + "TemperatureOffset" + ], + "manufacturer": "BOSCH", + "roomId": "hz_8", + "deviceModel": "TRV", + "serial": "30xxx", + "profile": "GENERIC", + "name": "Test Thermostat", + "status": "AVAILABLE", + "parentDeviceId": "roomClimateControl_hz_8", + "childDeviceIds": [] + }, +``` + +#### Make a rawscan of the associated services of a device +```bash +boschshc_rawscan -ip _your_shc_ip_ -cert _your_shc_cert_file_ -key _your_shc_key_file_ device_services _your_device_id_ +``` + +The exemplary output will look as follows: +```bash +[ + { + "@type": "DeviceServiceData", + "id": "BatteryLevel", + "deviceId": "hdm:HomeMaticIP:30xxx", + "path": "/devices/hdm:HomeMaticIP:30xxx/services/BatteryLevel" + }, + { + "@type": "DeviceServiceData", + "id": "Thermostat", + "deviceId": "hdm:HomeMaticIP:30xxx", + "state": { + "@type": "childLockState", + "childLock": "OFF" + }, + "path": "/devices/hdm:HomeMaticIP:30xxx/services/Thermostat" + }, +... +] +``` + +#### Make a rawscan of the a service of a device, where the `device_id` as well as the `service_id` are known +```bash +boschshc_rawscan -ip _your_shc_ip_ -cert _your_shc_cert_file_ -key _your_shc_key_file_ device_service _your_device_id_ _your_service_id +``` + +#### Make a rawscan of the all scenarios +```bash +boschshc_rawscan -ip _your_shc_ip_ -cert _your_shc_cert_file_ -key _your_shc_key_file_ scenarios +``` + +#### Make a rawscan of the all rooms +```bash +boschshc_rawscan -ip _your_shc_ip_ -cert _your_shc_cert_file_ -key _your_shc_key_file_ rooms +``` + +## Example code to use the `boschshcpy` library + +```python +import boschshcpy + +# Create session +session = boschshcpy.SHCSession(controller_ip="192.168.25.51", certificate='cert.pem', key='key.pem') +session.information.summary() + +device = session.device('roomClimateControl_hz_5') +service = device.device_service('TemperatureLevel') +print(service.temperature) + +# Update this service's state +service.short_poll() + +# Start long polling thread in background +session.start_polling() + +# Do work here +... + +# Stop polling +session.stop_polling() + +# Trigger intrusion detection system +intrusion_control = session.intrusion_system +intrusion_control.arm() +``` + +## Usage guide + +Before accessing the Bosch Smart Home Controller, a client must be registered on the controller. For this a valid cert/key pair must be provided to the controller. To start the client registration, press and hold the button on the controller until the led starts flashing. More information [here](https://github.com/BoschSmartHome/bosch-shc-api-docs/tree/master/postman#register-a-new-client-to-the-bosch-smart-home-controller). + + +%prep +%autosetup -n boschshcpy-0.2.56 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-boschshcpy -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed Apr 12 2023 Python_Bot <Python_Bot@openeuler.org> - 0.2.56-1 +- Package Spec generated @@ -0,0 +1 @@ +b1bf4eb01e13490f113f8319a7abb4da boschshcpy-0.2.56.tar.gz |