Code Monkey home page Code Monkey logo

azureiotsimulator's Introduction

IoT sensor emulator

Overview

This project is a minimalistic emulator if an IoT devile, simulating stream of data sent to Azure IoT Hub. It's useful when testing streaming jobs. Based on the Azure Raspberry Pi IoT Simulator Online Simulator.

Prerequisites

  • Docker

Usage

Set the environment variables

  • SLEEP_INTERVAL_SECONDS: This environment variable specifies the number of seconds the application should wait before sending the next message.

  • MESSAGE_COUNT: This environment variable specifies the total number of messages that the application should send.

  • AZURE_CONN_STRING: This environment variable is the connection string that the application uses to connect to Azure IoT Hub. The connection string should be set to the values for your IoT hub.

Building the Docker Image

Run the following command to build the Docker image:

docker build -t azure-iot-smart-home .

Running the Application

Run the following command to start the application

docker run azure-iot-smart-home

Message format

The messages sent by this program have the following format:

{
  "id": "unique-id",
  "timestamp": "YYYY-MM-DDTHH:MM:SS",
  "temperature": temperature-value,
  "humidity": humidity-value
}

where:

  • id: A unique identifier for the message.
  • timestamp: The current date and time in the format YYYY-MM-DDTHH:MM:SS.
  • temperature: A random value between -40 and 40.
  • humidity: A random value between 1 and 99.

Check received messages in Azure Portal

In order to see your messages in Azure portal, open Azure CLI and run following commands

  1. Add the Azure IoT extension to the Azure CLI. The Azure IoT extension provides a set of commands for managing Azure IoT Hubs, devices, and solutions.
az extension add --name azure-iot`
  1. Monitor events on an Azure IoT Hub with the specified name.
az iot hub monitor-events --hub-name <youriothubname>

azureiotsimulator's People

Watchers

Andrii Mazur avatar

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.