v 1.0.4
This commit is contained in:
Родитель
b381d64379
Коммит
8ccf41bffa
|
@ -1,3 +1,7 @@
|
|||
1.0.4 (2020-10-07)
|
||||
------------------
|
||||
- fix property report with value wrapped
|
||||
|
||||
1.0.3 (2020-06-17)
|
||||
------------------
|
||||
- remove wrong dependency
|
||||
|
|
14
README.md
14
README.md
|
@ -87,11 +87,11 @@ from iotc.aio import IoTCClient
|
|||
|
||||
#### X509
|
||||
```py
|
||||
scopeId = 'scopeID';
|
||||
scope_id = 'scope_id';
|
||||
device_id = 'device_id';
|
||||
key = {'certFile':'<CERT_CHAIN_FILE_PATH>','keyFile':'<CERT_KEY_FILE_PATH>','certPhrase':'<CERT_PASSWORD>'}
|
||||
|
||||
iotc = IoTCClient(device_id, scopeId,
|
||||
iotc = IoTCClient(device_id, scope_id,
|
||||
IOTCConnectType.IOTC_CONNECT_X509_CERT, key)
|
||||
```
|
||||
IOTCConnectType enum can be imported from the same module of IoTCClient
|
||||
|
@ -105,10 +105,10 @@ _'certPhrase'_ is optional and represents the password for the certificate if an
|
|||
```py
|
||||
scopeId = 'scopeID';
|
||||
device_id = 'device_id';
|
||||
sasKey = 'masterKey'; # or use device key directly
|
||||
sas_key = 'master_key'; # or use device key directly
|
||||
|
||||
iotc = IoTCClient(device_id, scopeId,
|
||||
IOTCConnectType.IOTC_CONNECT_SYMM_KEY, sasKey)
|
||||
IOTCConnectType.IOTC_CONNECT_SYMM_KEY, sas_key)
|
||||
```
|
||||
IOTCConnectType enum can be imported from the same module of IoTCClient
|
||||
|
||||
|
@ -216,7 +216,7 @@ A device can send custom data during provision process: if a device is aware of
|
|||
|
||||
### How to set IoTC template ID in your device
|
||||
Template Id can be found in the device explorer page of IoTCentral
|
||||
![Img](assets/modelId.jpg)
|
||||
![Img](https://github.com/iot-for-all/iotc-python-client/raw/master/assets/modelId.jpg)
|
||||
|
||||
Then call this method before connect():
|
||||
|
||||
|
@ -227,14 +227,14 @@ iotc.setModelId('<modelId>');
|
|||
### Manual approval (default)
|
||||
By default device auto-approval in IoT Central is disabled, which means that administrator needs to approve the device registration to complete the provisioning process.
|
||||
This can be done from explorer page after selecting the device
|
||||
![Img](assets/manual_approval.jpg)
|
||||
![Img](https://github.com/iot-for-all/iotc-python-client/raw/master/assets/manual_approval.jpg)
|
||||
|
||||
|
||||
### Automatic approval
|
||||
To change default behavior, administrator can enable device auto-approval from Device Connection page under the Administration section.
|
||||
With automatic approval a device can be provisioned without any manual action and can start sending/receiving data after status changes to "Provisioned"
|
||||
|
||||
![Img](assets/auto_approval.jpg)
|
||||
![Img](https://github.com/iot-for-all/iotc-python-client/raw/master/assets/auto_approval.jpg)
|
||||
|
||||
## License
|
||||
This samples is licensed with the MIT license. For more information, see [LICENSE](./LICENSE)
|
||||
|
|
|
@ -14,13 +14,13 @@ if config['DEFAULT'].getboolean('Local'):
|
|||
from iotc import IOTCConnectType, IOTCLogLevel, IOTCEvents
|
||||
from iotc.aio import IoTCClient
|
||||
|
||||
device_id = config['DEVICE_A']['DeviceId']
|
||||
scope_id = config['DEVICE_A']['ScopeId']
|
||||
key = config['DEVICE_A']['DeviceKey']
|
||||
device_id = config['DEVICE_M2']['DeviceId']
|
||||
scope_id = config['DEVICE_M2']['ScopeId']
|
||||
key = config['DEVICE_M2']['DeviceKey']
|
||||
|
||||
# optional model Id for auto-provisioning
|
||||
try:
|
||||
model_id = config['DEVICE_A']['ModelId']
|
||||
model_id = config['DEVICE_M2']['ModelId']
|
||||
except:
|
||||
model_id = None
|
||||
|
||||
|
@ -65,9 +65,9 @@ async def main():
|
|||
await client.connect()
|
||||
while client.is_connected():
|
||||
await client.send_telemetry({
|
||||
't777b192a': str(randint(20, 45)),
|
||||
'h6941c57b': str(randint(20, 45)),
|
||||
"b2fba1eb1": str(randint(20, 45))
|
||||
'accelerometerX': str(randint(20, 45)),
|
||||
'accelerometerY': str(randint(20, 45)),
|
||||
"accelerometerZ": str(randint(20, 45))
|
||||
})
|
||||
await asyncio.sleep(3)
|
||||
|
||||
|
|
2
setup.py
2
setup.py
|
@ -5,7 +5,7 @@ import sys
|
|||
with open("README.md", "r") as fh:
|
||||
long_description = fh.read()
|
||||
|
||||
version = "1.0.3"
|
||||
version = "1.0.4"
|
||||
|
||||
setuptools.setup(
|
||||
name='iotc',
|
||||
|
|
|
@ -209,10 +209,11 @@ class IoTCClient(AbstractClient):
|
|||
self._logger.debug('Acknowledging {}'.format(prop))
|
||||
self.send_property({
|
||||
'{}'.format(prop): {
|
||||
"value": patch[prop]["value"],
|
||||
'status': 'completed',
|
||||
'desiredVersion': patch['$version'],
|
||||
'message': 'Property received'}
|
||||
"ac": 200,
|
||||
"ad": 'Property received',
|
||||
"av": patch['$version'],
|
||||
"value": patch[prop]["value"]
|
||||
}
|
||||
})
|
||||
else:
|
||||
self._logger.debug(
|
||||
|
|
|
@ -92,10 +92,10 @@ class IoTCClient(AbstractClient):
|
|||
await self._logger.debug('Acknowledging {}'.format(prop))
|
||||
await self.send_property({
|
||||
'{}'.format(prop): {
|
||||
"value": patch[prop]["value"],
|
||||
'status': 'completed',
|
||||
'desiredVersion': patch['$version'],
|
||||
'message': 'Property received'}
|
||||
"ac": 200,
|
||||
"ad": 'Property received',
|
||||
"av": patch['$version'],
|
||||
"value": patch[prop]["value"]}
|
||||
})
|
||||
else:
|
||||
await self._logger.debug(
|
||||
|
|
Загрузка…
Ссылка в новой задаче