Code Monkey home page Code Monkey logo

microsoft / vscode-azure-iot-toolkit Goto Github PK

View Code? Open in Web Editor NEW
71.0 24.0 58.0 6.66 MB

Azure IoT Hub extension for Visual Studio Code

Home Page: https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.azure-iot-toolkit

License: Other

TypeScript 18.95% JavaScript 2.47% HTML 49.22% CSS 28.12% Python 0.21% C# 0.35% Go 0.06% Java 0.31% PHP 0.08% Ruby 0.05% F# 0.17%
vscode-extension azure-iot azure-iothub azure-iot-edge azure-iot-toolkit iot

vscode-azure-iot-toolkit's Introduction

Azure IoT Hub

Join the chat at https://gitter.im/Microsoft/azure-iot-toolkit Marketplace Version

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.

Device Explorer

The Wiki page includes a comprehensive getting started guide as well as detailed usage instructions of the following features:

  • IoT Hub management
    • Create IoT Hub
    • Select IoT Hub
    • Copy IoT Hub Connection String
    • Generate SAS Token for IoT Hub
  • Device management
    • List devices
    • Get device info
    • Create IoT device
    • Create Edge device
    • Delete device
    • Copy Device Connection String
    • Generate SAS Token for Device
  • Module management
    • List Modules
    • Get Module Info
    • Create Module
    • Edit Module Twin
    • Invoke Module Direct Method
    • Copy Module Connection String
    • Delete Module
  • Interact with Azure IoT Hub
    • Generate Code for C#, F#, Go, Java, Node.js, PHP, Python, Ruby or REST API
    • Send D2C message to IoT Hub
    • Monitor Built-in Event Endpoint
    • Send C2D message to device
    • Receive C2D message from IoT Hub
    • Invoke Device Direct Method
    • Edit Device Twin
    • Manage Azure IoT distributed tracing
  • Interact with Azure IoT Edge (Install Azure IoT Edge for more IoT Edge support)
    • List Modules
    • Edit Module Twin
    • Create deployment for Single Device
    • Create Deployment at Scale
  • Endpoints management
    • List Built-in and Custom Endpoints
    • Monitor Custom Event Hub Endpoint

Prerequisites

  1. In Explorer of VS Code, click "Azure IoT Hub" in the bottom left corner.

Click Device Explorer

  1. Click "Set IoT Hub Connection String" in context menu.

Set Connection String

  1. 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>).

Enter Connection String

  1. The devices list will be shown.

Device Explorer

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.

Select IoT Hub

  1. If you have not signed in to Azure, a pop-up will show to let you sign in to Azure.
  2. After you sign in, your Azure Subscription list will be shown, then select an Azure Subscription.
  3. Your IoT Hub list will be shown, then select an IoT Hub.
  4. The devices and endpoints list will be shown.

IoT Hub Explorer

Device Provisioning Service Explorer

  1. Open "Azure" view on the Activity Bar, and expand "IOT HUB DEVICE PROVISIONING SERVICE".

DPS Explorer

  1. If you're not signed in, click "Sign in to Azure..." to sign in.

  2. Expand one subscription to start exploring your device provisioning services.

Code Generation

Code Generation

Code Snippets

Trigger Content
iotSendD2CMessage Send D2C message to IoT Hub
iotMonitorD2CMessage Monitor D2C message for IoT Hub
iotSendC2DMessage Send C2D message to device
iotMonitorC2DMessage Monitor C2D message from IoT Hub
iotCallDirectMethods Send direct methods to device
iotReceiveDirectMethods Receive direct methods from IoT Hub

Snippet

After code snippet is created, you need to install corresponding npm package (e.g. azure-iot-device-mqtt) to run the code snippet. If you want to 'Run Code' directly, you need to install Code Runner.

Configuration

IoT Hub Consumer Group (default is "$Default"):

{
    "azure-iot-toolkit.iotHubConsumerGroup": "$Default"
}

The time span (in minutes) of monitoring D2C message before current time (default is 0):

{
    "azure-iot-toolkit.monitorD2CBeforeNowInMinutes": 0
}

Whether to show verbose info when monitoring messages (default is false):

{
    "azure-iot-toolkit.showVerboseMessage": false
}

Whether to stringify device-to-cloud messages (default is false):

{ 
    "azure-iot-toolkit.iotHubD2CMessageStringify": false
}

Whether to show IoT Hub info when IoT Hub Connection String is not set (default is true):

{ 
    "azure-iot-toolkit.showIoTHubInfo": true
}

Whether to enable auto refresh of tree view (default is false):

{ 
    "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):

{ 
    "azure-iot-toolkit.treeViewAutoRefreshIntervalInSeconds": 60
}

Resources

❤️ Contributors

Thanks to all the contributors!

Data/Telemetry

This project collects usage data and sends it to Microsoft to help improve our products and services. Read our privacy statement to learn more. If you don’t wish to send usage data to Microsoft, you can set the telemetry.enableTelemetry setting to false. Learn more in our FAQ.

vscode-azure-iot-toolkit's People

Contributors

adashen avatar blackchoey avatar c-ryan-k avatar dependabot[bot] avatar erich-wang avatar formulahendry avatar jxtxzzw avatar lazarusx avatar loghorn avatar matsujirushi avatar michielvanschaik avatar microsoft-github-policy-service[bot] avatar montgomp avatar nickdarvey avatar sldragon avatar tomaszbartoszewski avatar wangyuchensjtu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-azure-iot-toolkit's Issues

Support `StartTime` when monitoring D2C

While investing the new vs code support (so awesome!), I came across something that had proved valuable in the previous tool of choice (Device Explorer UI). There I can do:

image

And when monitoring, I can provide a start date in the past, allowing me to get the "last few" D2C messages. This is super helpful when dealing with slow reporting rates (say, >10mins), where you'd have to leave the window open to get the latest.

Is there a way to do this in vscode-azure-iot-toolkit? I looked for a setting, but didn't see anything obvious.

It would also be sufficient to somehow just, "get the latest message for this device and display it". As that is typically what I am wanting.

Please advise,
Elliott

Startup Activation time ...

I've been getting popups from VS Code about the extension host "not responding" on startup every time lately, and when I look, it seems the works offender is the Azure IoT Toolkit at almost 10 seconds on my dev PC ...

  • Extension Name: azure-iot-toolkit
  • Extension Version: 1.4.0
  • OS Version: Windows_NT x64 10.0.17763
  • VSCode version: 1.28.0-insider

We have written the needed data into your clipboard. Please paste:

{
	"activationTimes": {
		"startup": true,
		"codeLoadingTime": 9649,
		"activateCallTime": 11,
		"activateResolvedTime": 0,
		"activationEvent": "*"
	}
}

The Edge commands are not sorted in a logical order

Currently, the Edge related commands in IoT Toolkit extension is sorted as:
image

I found this order somewhat counter-intuitive, because Setup Edge usually happens first and Create Deployment happens last. This can be confusing for users. (Actually, the current order is the order with which these commands are added to the extension).

I think below order is more logical:
2017-11-12 00 06 52

the display of D2C message is wrong after add configuration to set start time

install latest toolkit 1.3.0.-rc3

step:

  1. create IoT hub
  2. create IoT edge device
  3. In VS Code settings, set the start time for monitoring D2C message (e.g. 30)
    "azure-iot-toolkit.monitorD2CBeforeNowInMinutes": 30
    4.right click the edge device and Start monitoring D2C message
    Expect : the output should not print D2C message ,because I don't send any D2C message for this device
    Actually: the output print the D2C messages as bellow, but I don't know these message come from.

IoTHubMonitor] Start monitoring D2C message for [macedgedevice] ...
[IoTHubMonitor] Created partition receiver [3] for consumerGroup [$Default]
[IoTHubMonitor] Created partition receiver [2] for consumerGroup [$Default]
[IoTHubMonitor] Created partition receiver [1] for consumerGroup [$Default]
[IoTHubMonitor] Created partition receiver [0] for consumerGroup [$Default]
[IoTHubMonitor] [9:33:11 AM] Message received from [macedgedevice]:
{
"temperature": 29.069904,
"humidity": 78.810182
}
[IoTHubMonitor] [9:33:12 AM] Message received from [macedgedevice]:
{
"temperature": 29.968401,
"humidity": 68.754284
}
[IoTHubMonitor] [9:33:14 AM] Message received from [macedgedevice]:
{
"temperature": 26.369562,
"humidity": 73.736461
}

Generate Code

Flow:

  1. Right-click on a device and select 'Generate Code'
  2. Drop-down list: select language (Node.js, Python, HTTP...)
  3. Drop-down list: select code type (Send D2C message, Monitor D2C message..)
  4. Generate code and show in VS Code

Languages:

  • Node.js
  • Python
  • REST API
  • Java
  • C#
  • F#
  • Go
  • PHP
  • Ruby

Empty D2C and C2D message is not sent to IoT Hub

Repro step:

  1. Start monitoring D2C messages
  2. Click "Send D2C message to IoT Hub" for a device
  3. Press Enter directly after input window popup

Expected behavior:
I will see the message printed in output window

Actual behavior:
I can only see one message: Sending message to [IoT Hub]. No D2C message printed in output window.

Spinner is not dismissed when there's error loading the device list

Steps to reproduce:

  1. Open command palette to execute a command which needs a device as the input such as "Copy Device Connection String".
  2. If something wrong happens when the device list is being loaded (such as disconnecting from Internet), the spinner will not be dismissed until you press the ESC button.

The expected behavior is that when there is an error, the spinner should be dismissed automatically and an error message should be shown.

List iot hub after selecting subscription would fail randomly

Repo step:
Open new window of vscode, select iothub, then select subscription.
sometimes, the list of iothub is not listed. It happens more often if you just open a new VS code.

Note: the problem happened randomly. In most cases, it works fine.

Doesn't show D2C messages which match a route

I thought Start Monitoring D2C Message wasn't working since I knew my device was sending messages, and I could see they were being seen by a stream analytics job which listens to the hub, but the extension wasn't printing anything. It wasn't until I disabled the route that the extension showed me the messages. Is there a way to make it work for all D2C messages rather than only unmatched/unrouted ones?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.