Skip to content

Commit 8ccf41b

Browse files
author
lucadruda
committed
v 1.0.4
1 parent b381d64 commit 8ccf41b

File tree

6 files changed

+28
-23
lines changed

6 files changed

+28
-23
lines changed

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
1.0.4 (2020-10-07)
2+
------------------
3+
- fix property report with value wrapped
4+
15
1.0.3 (2020-06-17)
26
------------------
37
- remove wrong dependency

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ from iotc.aio import IoTCClient
8787

8888
#### X509
8989
```py
90-
scopeId = 'scopeID';
90+
scope_id = 'scope_id';
9191
device_id = 'device_id';
9292
key = {'certFile':'<CERT_CHAIN_FILE_PATH>','keyFile':'<CERT_KEY_FILE_PATH>','certPhrase':'<CERT_PASSWORD>'}
9393

94-
iotc = IoTCClient(device_id, scopeId,
94+
iotc = IoTCClient(device_id, scope_id,
9595
IOTCConnectType.IOTC_CONNECT_X509_CERT, key)
9696
```
9797
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
105105
```py
106106
scopeId = 'scopeID';
107107
device_id = 'device_id';
108-
sasKey = 'masterKey'; # or use device key directly
108+
sas_key = 'master_key'; # or use device key directly
109109

110110
iotc = IoTCClient(device_id, scopeId,
111-
IOTCConnectType.IOTC_CONNECT_SYMM_KEY, sasKey)
111+
IOTCConnectType.IOTC_CONNECT_SYMM_KEY, sas_key)
112112
```
113113
IOTCConnectType enum can be imported from the same module of IoTCClient
114114

@@ -216,7 +216,7 @@ A device can send custom data during provision process: if a device is aware of
216216

217217
### How to set IoTC template ID in your device
218218
Template Id can be found in the device explorer page of IoTCentral
219-
![Img](assets/modelId.jpg)
219+
![Img](https://github.com/iot-for-all/iotc-python-client/raw/master/assets/modelId.jpg)
220220

221221
Then call this method before connect():
222222

@@ -227,14 +227,14 @@ iotc.setModelId('<modelId>');
227227
### Manual approval (default)
228228
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.
229229
This can be done from explorer page after selecting the device
230-
![Img](assets/manual_approval.jpg)
230+
![Img](https://github.com/iot-for-all/iotc-python-client/raw/master/assets/manual_approval.jpg)
231231

232232

233233
### Automatic approval
234234
To change default behavior, administrator can enable device auto-approval from Device Connection page under the Administration section.
235235
With automatic approval a device can be provisioned without any manual action and can start sending/receiving data after status changes to "Provisioned"
236236

237-
![Img](assets/auto_approval.jpg)
237+
![Img](https://github.com/iot-for-all/iotc-python-client/raw/master/assets/auto_approval.jpg)
238238

239239
## License
240240
This samples is licensed with the MIT license. For more information, see [LICENSE](./LICENSE)

samples/py3.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
from iotc import IOTCConnectType, IOTCLogLevel, IOTCEvents
1515
from iotc.aio import IoTCClient
1616

17-
device_id = config['DEVICE_A']['DeviceId']
18-
scope_id = config['DEVICE_A']['ScopeId']
19-
key = config['DEVICE_A']['DeviceKey']
17+
device_id = config['DEVICE_M2']['DeviceId']
18+
scope_id = config['DEVICE_M2']['ScopeId']
19+
key = config['DEVICE_M2']['DeviceKey']
2020

2121
# optional model Id for auto-provisioning
2222
try:
23-
model_id = config['DEVICE_A']['ModelId']
23+
model_id = config['DEVICE_M2']['ModelId']
2424
except:
2525
model_id = None
2626

@@ -65,9 +65,9 @@ async def main():
6565
await client.connect()
6666
while client.is_connected():
6767
await client.send_telemetry({
68-
't777b192a': str(randint(20, 45)),
69-
'h6941c57b': str(randint(20, 45)),
70-
"b2fba1eb1": str(randint(20, 45))
68+
'accelerometerX': str(randint(20, 45)),
69+
'accelerometerY': str(randint(20, 45)),
70+
"accelerometerZ": str(randint(20, 45))
7171
})
7272
await asyncio.sleep(3)
7373

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
with open("README.md", "r") as fh:
66
long_description = fh.read()
77

8-
version = "1.0.3"
8+
version = "1.0.4"
99

1010
setuptools.setup(
1111
name='iotc',

src/iotc/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,11 @@ def _on_properties(self):
209209
self._logger.debug('Acknowledging {}'.format(prop))
210210
self.send_property({
211211
'{}'.format(prop): {
212-
"value": patch[prop]["value"],
213-
'status': 'completed',
214-
'desiredVersion': patch['$version'],
215-
'message': 'Property received'}
212+
"ac": 200,
213+
"ad": 'Property received',
214+
"av": patch['$version'],
215+
"value": patch[prop]["value"]
216+
}
216217
})
217218
else:
218219
self._logger.debug(

src/iotc/aio/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ async def _on_properties(self):
9292
await self._logger.debug('Acknowledging {}'.format(prop))
9393
await self.send_property({
9494
'{}'.format(prop): {
95-
"value": patch[prop]["value"],
96-
'status': 'completed',
97-
'desiredVersion': patch['$version'],
98-
'message': 'Property received'}
95+
"ac": 200,
96+
"ad": 'Property received',
97+
"av": patch['$version'],
98+
"value": patch[prop]["value"]}
9999
})
100100
else:
101101
await self._logger.debug(

0 commit comments

Comments
 (0)