vscode-azure-iot-toolkit/README.md

190 строки
8.5 KiB
Markdown
Исходник Обычный вид История

# Azure IoT Hub
2016-10-28 08:46:08 +03:00
2018-06-25 11:55:29 +03:00
[![Join the chat at https://gitter.im/Microsoft/azure-iot-toolkit](https://badges.gitter.im/Microsoft/azure-iot-toolkit.svg)](https://gitter.im/Microsoft/azure-iot-toolkit?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Marketplace Version](https://vsmarketplacebadge.apphb.com/version-short/vsciot-vscode.azure-iot-toolkit.svg)](https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.azure-iot-toolkit)
## Overview
Interact with Azure IoT Hub, IoT Device Management, IoT Edge Management, IoT Hub Device Simulation, IoT Hub Code Generation and IoT Hub Device Provisioning Service.
2016-10-28 08:46:08 +03:00
2017-06-05 11:10:36 +03:00
## Device Explorer
2018-07-09 12:20:01 +03:00
The [Wiki page](https://github.com/Microsoft/vscode-azure-iot-toolkit/wiki) includes a comprehensive getting started guide as well as detailed usage instructions of the following features:
2017-06-05 11:10:36 +03:00
* IoT Hub management
* Create IoT Hub
* Select IoT Hub
* Copy IoT Hub Connection String
* Generate SAS Token for IoT Hub
2017-06-05 11:10:36 +03:00
* Device management
* List devices
* Get device info
* Create IoT device
* Create Edge device
2017-06-05 11:10:36 +03:00
* Delete device
* Copy Device Connection String
* Generate SAS Token for Device
2019-05-20 05:42:04 +03:00
* Module management
2018-11-13 05:34:08 +03:00
* List Modules
2018-10-09 08:07:20 +03:00
* Get Module Info
* Create Module
* Edit Module Twin
* Invoke Module Direct Method
2018-10-09 08:07:20 +03:00
* Copy Module Connection String
* Delete Module
2017-06-05 11:10:36 +03:00
* Interact with Azure IoT Hub
2018-10-09 08:07:20 +03:00
* Generate Code for C#, F#, Go, Java, Node.js, PHP, Python, Ruby or REST API
2017-06-05 11:10:36 +03:00
* Send D2C message to IoT Hub
2019-05-13 11:16:06 +03:00
* Monitor Built-in Event Endpoint
* Send C2D message to device
* Receive C2D message from IoT Hub
* Invoke Device Direct Method
* Edit Device Twin
2019-01-25 07:51:32 +03:00
* Manage Azure IoT distributed tracing
2018-06-25 11:55:29 +03:00
* Interact with Azure IoT Edge (Install [Azure IoT Edge](https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.azure-iot-edge) for more IoT Edge support)
2018-11-13 05:34:08 +03:00
* List Modules
* Edit Module Twin
* Create deployment for Single Device
* Create Deployment at Scale
2019-05-20 05:42:04 +03:00
* Endpoints management
2019-05-13 11:16:06 +03:00
* List Built-in and Custom Endpoints
* Monitor Custom Event Hub Endpoint
2017-06-05 11:10:36 +03:00
### Prerequisites
2019-05-16 11:05:08 +03:00
1. In Explorer of VS Code, click "Azure IoT Hub" in the bottom left corner.
2017-06-05 11:10:36 +03:00
2018-03-22 16:04:28 +03:00
![Click Device Explorer](images/device-explorer-click.png)
2017-06-05 11:10:36 +03:00
2. Click "Set IoT Hub Connection String" in context menu.
2018-03-22 16:04:28 +03:00
![Set Connection String](images/set-connection-string.png)
2017-11-14 06:16:37 +03:00
3. An input box will pop up, then enter your IoT Hub Connection String (It is one-time configuration, and please make sure it is **IoT Hub Connection String** not **Device Connection String**. The format is `HostName=<my-hub>.azure-devices.net;SharedAccessKeyName=<my-policy>;SharedAccessKey=<my-policy-key>`).
2017-06-05 11:10:36 +03:00
2018-03-22 16:04:28 +03:00
![Enter Connection String](images/enter-connection-string.png)
2017-06-05 11:10:36 +03:00
2019-05-16 11:05:08 +03:00
4. The devices list will be shown.
2017-06-05 11:10:36 +03:00
2018-03-22 16:04:28 +03:00
![Device Explorer](images/device-explorer.png)
2016-10-28 08:46:08 +03:00
### Sign in to Azure
Instead of copying and pasting to set IoT Hub Connection String, you could sign in to Azure to select IoT Hub from your Azure Subscription.
1. Click "Select IoT Hub" in context menu.
2018-03-22 16:04:28 +03:00
![Select IoT Hub](images/select-iot-hub.png)
2. If you have not signed in to Azure, a pop-up will show to let you sign in to Azure.
3. After you sign in, your Azure Subscription list will be shown, then select an Azure Subscription.
4. Your IoT Hub list will be shown, then select an IoT Hub.
2019-05-16 11:05:08 +03:00
5. The devices and endpoints list will be shown.
![IoT Hub Explorer](images/iot-hub-explorer.png)
## Device Provisioning Service Explorer
1. Open "Azure" view on the Activity Bar, and expand "IOT HUB DEVICE PROVISIONING SERVICE".
![DPS Explorer](images/dps-explorer.png)
2. If you're not signed in, click "Sign in to Azure..." to sign in.
3. Expand one subscription to start exploring your device provisioning services.
## Code Generation
![Code Generation](images/code-generation.gif)
## Code Snippets
2017-03-06 10:30:59 +03:00
| Trigger | Content |
| ---- | ---- |
| iotSendD2CMessage | Send D2C message to IoT Hub |
| iotMonitorD2CMessage | Monitor D2C message for IoT Hub |
2017-03-08 05:44:21 +03:00
| iotSendC2DMessage | Send C2D message to device |
| iotMonitorC2DMessage | Monitor C2D message from IoT Hub |
2017-06-05 11:10:36 +03:00
| iotCallDirectMethods | Send direct methods to device |
| iotReceiveDirectMethods | Receive direct methods from IoT Hub |
2018-03-22 16:04:28 +03:00
![Snippet](images/snippet.gif)
2017-03-06 10:30:59 +03:00
> After code snippet is created, you need to install corresponding npm package (e.g. [azure-iot-device-mqtt](https://www.npmjs.com/package/azure-iot-device-mqtt)) to run the code snippet.
> If you want to 'Run Code' directly, you need to install [Code Runner](https://marketplace.visualstudio.com/items?itemName=formulahendry.code-runner).
2016-10-28 15:06:48 +03:00
## Configuration
2016-10-28 08:46:08 +03:00
2017-08-17 06:51:44 +03:00
IoT Hub Consumer Group (default is `"$Default"`):
2016-10-28 15:06:48 +03:00
```json
{
2017-02-27 16:23:08 +03:00
"azure-iot-toolkit.iotHubConsumerGroup": "$Default"
}
```
The time span (in minutes) of monitoring D2C message before current time (default is `0`):
```json
{
"azure-iot-toolkit.monitorD2CBeforeNowInMinutes": 0
}
```
Whether to show verbose info when monitoring messages (default is `false`):
```json
{
"azure-iot-toolkit.showVerboseMessage": false
}
```
Whether to stringify device-to-cloud messages (default is `false`):
```json
{
"azure-iot-toolkit.iotHubD2CMessageStringify": false
2016-10-28 15:06:48 +03:00
}
```
Whether to show IoT Hub info when IoT Hub Connection String is not set (default is `true`):
```json
{
"azure-iot-toolkit.showIoTHubInfo": true
}
```
2017-12-22 06:57:27 +03:00
Whether to enable auto refresh of tree view (default is `false`):
```json
{
"azure-iot-toolkit.treeViewAutoRefreshEnable": false
}
```
Time interval in seconds for tree view auto refresh, auto refresh has to be enabled for it to work. (default is `60`):
```json
{
"azure-iot-toolkit.treeViewAutoRefreshIntervalInSeconds": 60
}
```
2018-06-15 09:16:22 +03:00
## Resources
- [Channel 9 video: Walkthrough of Azure IoT Hub extension](https://channel9.msdn.com/Shows/Internet-of-Things-Show/Azure-IoT-Toolkit-extension-for-Visual-Studio-Code)
- [Channel 9 video: What's new in the IoT Hub extension for VS Code](https://channel9.msdn.com/Shows/Internet-of-Things-Show/Whats-new-in-the-IoT-Toolkit-extension-for-VS-Code)
- [Create an IoT hub using the Azure IoT Tools for Visual Studio Code](https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-create-use-iot-toolkit)
- [Use Azure IoT Tools to send and receive messages between your device and IoT Hub](https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-vscode-iot-toolkit-cloud-device-messaging)
- [Use Azure IoT Tools for Azure IoT Hub device management](https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-device-management-iot-toolkit)
- [Quickly build your Azure IoT application with Node.js, Python or REST API](https://devblogs.microsoft.com/iotdev/azure-iot-toolkit-1-2-0-quickly-build-your-azure-iot-application-in-vs-code-with-node-js-python-or-rest-api/)
- [Azure IoT Hub extension supports C#, Go, Java, Node.js, PHP, Python and Ruby to develop Azure IoT application in VS Code](https://devblogs.microsoft.com/iotdev/azure-iot-toolkit-supports-c-go-java-node-js-php-python-and-ruby-to-develop-azure-iot-application-in-vs-code/)
2018-08-01 08:06:08 +03:00
- [Use VS Code as IoT Hub Device Simulator](https://blogs.msdn.microsoft.com/iotdev/2018/07/12/use-vs-code-as-iot-hub-device-simulator-say-hello-to-azure-iot-hub-in-5-minutes/)
- [Use VS Code to call Azure IoT Hub REST APIs](https://blogs.msdn.microsoft.com/iotdev/2018/07/19/call-azure-iot-hub-rest-apis-in-vs-code/)
- [Create and control an IoT device connected to an IoT hub (Node.js)](https://github.com/Microsoft/vscode-azure-iot-toolkit/wiki/Quickstart-Node.js)
- [Create and control an IoT device connected to an IoT hub (.NET)](https://github.com/Microsoft/vscode-azure-iot-toolkit/wiki/Quickstart-.NET)
2018-06-15 09:16:22 +03:00
- [Handy Tool When You Develop With Azure IoT](https://blogs.msdn.microsoft.com/iotdev/2017/09/01/handy-tool-when-you-develop-with-azure-iot/)
- [Azure IoT Hub extension for Visual Studio Code generally available for managing Azure IoT Hub and Devices with ease](https://blogs.msdn.microsoft.com/iotdev/2018/06/30/azure-iot-toolkit-for-visual-studio-code-generally-available-for-managing-azure-iot-hub-and-devices-with-ease/)
2018-06-15 09:16:22 +03:00
2018-10-09 08:07:20 +03:00
## ❤️ Contributors
Thanks to all the [contributors](https://github.com/Microsoft/vscode-azure-iot-toolkit/graphs/contributors)!
2017-12-22 06:57:27 +03:00
## Data/Telemetry
This project collects usage data and sends it to Microsoft to help improve our products and services. Read our [privacy statement](http://go.microsoft.com/fwlink/?LinkId=521839) to learn more.
2018-07-09 12:20:01 +03:00
If you dont wish to send usage data to Microsoft, you can set the `telemetry.enableTelemetry` setting to `false`. Learn more in our [FAQ](https://code.visualstudio.com/docs/supporting/faq#_how-to-disable-telemetry-reporting).