Skip to content

Commit e6d8b8c

Browse files
author
ludruda
committed
Merge branch 'master' of https://github.com/iot-for-all/iotc-python-client into master
2 parents 8f13fa8 + 8ccf41b commit e6d8b8c

File tree

6 files changed

+23
-18
lines changed

6 files changed

+23
-18
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: 6 additions & 6 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
@@ -108,7 +108,7 @@ device_id = 'device_id'
108108
sasKey = 'masterKey' # 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.set_model_id('<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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ async def main():
5656
await client.connect()
5757
while client.is_connected():
5858
await client.send_telemetry({
59-
't777b192a': str(randint(20, 45)),
60-
'h6941c57b': str(randint(20, 45)),
61-
"b2fba1eb1": str(randint(20, 45))
59+
'accelerometerX': str(randint(20, 45)),
60+
'accelerometerY': str(randint(20, 45)),
61+
"accelerometerZ": str(randint(20, 45))
6262
})
6363
await asyncio.sleep(3)
6464

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)