Skip to content

Commit 7bafda5

Browse files
author
brentru
committed
adding in c2d messaging
1 parent 4a361f1 commit 7bafda5

File tree

2 files changed

+41
-25
lines changed

2 files changed

+41
-25
lines changed

README.rst

Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ Introduction
1313
:target: https://travis-ci.com/adafruit/Adafruit_CircuitPython_AzureIoT
1414
:alt: Build Status
1515

16-
Access to Microsoft Azure IoT from CircuitPython
17-
16+
Access to Microsoft Azure IoT from a CircuitPython device.
1817

1918
Dependencies
2019
=============
@@ -26,38 +25,56 @@ Please ensure all dependencies are available on the CircuitPython filesystem.
2625
This is easily achieved by downloading
2726
`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.
2827

29-
Installing from PyPI
30-
--------------------
31-
.. note:: This library is not available on PyPI yet. Install documentation is included
32-
as a standard element. Stay tuned for PyPI availability!
33-
.. todo:: Remove the above note if PyPI version is/will be available at time of release.
34-
If the library is not planned for PyPI, remove the entire 'Installing from PyPI' section.
35-
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
36-
PyPI <https://pypi.org/project/adafruit-circuitpython-azureiot/>`_. To install for current user:
28+
Usage Example
29+
=============
3730

38-
.. code-block:: shell
31+
Create an instance of an Azure IoT Hub:
3932

40-
pip3 install adafruit-circuitpython-azureiot
33+
.. code-block:: python
4134
42-
To install system-wide (this may be required in some cases):
35+
my_hub = IOT_HUB(wifi, 'Azure_IOT_Hub_Name', 'Azure_IOT_Hub_SAS_Token')
4336
44-
.. code-block:: shell
37+
Send a device-to-cloud message:
4538

46-
sudo pip3 install adafruit-circuitpython-azureiot
39+
.. code-block:: python
4740
48-
To install in a virtual environment in your current project:
41+
my_hub.send_device_message('deviceID', 'Hi Azure IoT!')
4942
50-
.. code-block:: shell
43+
Enumerate all devices on an Azure IOT Hub:
5144

52-
mkdir project-name && cd project-name
53-
python3 -m venv .env
54-
source .env/bin/activate
55-
pip3 install adafruit-circuitpython-azureiot
45+
.. code-block:: python
5646
57-
Usage Example
58-
=============
47+
hub_devices = my_hub.get_devices()
48+
49+
Get a specified device on an Azure IoT Hub:
50+
51+
.. code-block:: python
52+
53+
device_info = my_hub.get_device('deviceID')
54+
55+
Create a new device on an Azure IoT Hub:
56+
57+
.. code-block:: python
58+
59+
my_hub.create_device('deviceID')
60+
61+
Delete a device from an Azure IoT Hub:
62+
63+
.. code-block:: python
64+
65+
my_hub.delete_device('deviceID')
66+
67+
Get a device twin:
68+
69+
.. code-block:: python
70+
71+
twin_info = my_hub.get_device_twin('deviceID')
72+
73+
Update a device twin's properties:
74+
75+
.. code-block:: python
5976
60-
.. todo:: Add a quick, simple example. It and other examples should live in the examples folder and be included in docs/examples.rst.
77+
my_hub.update_device_twin('Blinka', device_properties)
6178
6279
Contributing
6380
============

adafruit_azureiot.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ def _post(self, path, payload):
8282
json=payload,
8383
headers=self._azure_header)
8484
self._parse_http_status(response.status_code, response.reason)
85-
return response.json()
8685

8786
def _get(self, path):
8887
response = self._wifi.get(

0 commit comments

Comments
 (0)