A cloud-native virtual IoT device that streams real-time telemetry to the Anedya Platform β powering your dashboard without physical hardware.
π Runs 24/7 on Render Β· π‘ Sends data every 5 seconds Β· ποΈ Listens for relay commands in real-time
- About The Project
- How It Works
- Tech Stack
- Architecture
- Project Structure
- Quick Start
- Environment Variables
- Deployment
- Dashboard Integration
- Security
- Roadmap
- Contributing
- FAQ
- License
- Author
Building an IoT dashboard is exciting β until you realize you need actual hardware to generate data. This simulator eliminates that barrier entirely.
Anedya IoT Hardware Simulator is a lightweight Node.js service that acts as a virtual IoT device, continuously pushing realistic sensor telemetry (temperature & humidity) to the Anedya IoT Cloud. It also listens for incoming device commands (like relay toggles), simulating a full hardware lifecycle β all from a simple cloud deployment.
| Problem | Solution |
|---|---|
| No physical hardware for development | Virtual device generates realistic data |
| Dashboard needs continuous data stream | Simulator runs 24/7 on Render |
| Testing command delivery is hard | Automatic command polling & acknowledgment |
| Need real API integration, not mocks | Direct Anedya Cloud API communication |
The simulator performs two continuous operations in parallel:
- Generates randomized but realistic sensor readings:
- π‘οΈ Temperature:
20.00Β°Cβ30.00Β°C - π§ Humidity:
40.00%β60.00%
- π‘οΈ Temperature:
- Submits data via Anedya's Device API using the Connection Key
- Data appears instantly on the IoT Dashboard
- Polls the Anedya Cloud API for pending device commands
- Processes commands like
toggle-relayand logs hardware state changes - Enables dashboard β device communication
| Layer | Technology | Purpose |
|---|---|---|
| Runtime | JavaScript runtime | |
| HTTP Client | API communication with Anedya | |
| Web Framework | Keep-alive server for Render | |
| IoT Platform | Device management & data storage | |
| Deployment | 24/7 cloud hosting | |
| Dashboard | Companion dashboard on Vercel |
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β RENDER (Cloud) β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Anedya IoT Hardware Simulator β β
β β β β
β β βββββββββββββββ every 5s ββββββββββββββββββββββββ β β
β β β Telemetry ββββββββββββββββΆβ Anedya Device API β β β
β β β Generator β POST data β (ap-in-1 region) β β β
β β βββββββββββββββ ββββββββββββ¬ββββββββββββ β β
β β β β β
β β βββββββββββββββ every 2s ββββββββββββΌββββββββββββ β β
β β β Command βββββββββββββββββ Anedya Cloud API β β β
β β β Poller β FETCH cmds β (ap-in-1 region) β β β
β β βββββββββββββββ ββββββββββββββββββββββββ β β
β β β β
β β βββββββββββββββ β β
β β β Express β β Keeps Render free tier alive β β
β β β :PORT β β β
β β βββββββββββββββ β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββ
β IoT Dashboard (React) β
β Vercel Deployment β
β Real-time data visualization β
βββββββββββββββββββββββββββββββββ
anedya-simulator/
βββ simulator.js # Core simulator β telemetry + command engine
βββ package.json # Dependencies & project metadata
βββ .gitignore # Ignores node_modules, .env, logs
βββ .env # Environment variables (not committed)
Intentionally minimal. One file. One purpose. Zero bloat.
# Clone the repository
git clone https://github.com/Ayush-Kumar0207/anedya-simulator.git
cd anedya-simulator
# Install dependencies
npm install
# Configure environment variables
cp .env.example .env
# Edit .env with your Anedya credentials (see below)
# Start the simulator
node simulator.jsYou should see output like:
π Anedya IoT Hardware Simulator (STRICT CLOUD MODE)
- Communication: Strict Cloud API (AP-IN-1)
----------------------------------------------------
π Dummy Web Server listening on port 3000 to satisfy Render.
[Telemetry] Sent to Cloud: Temp=24.37Β°C, Hum=52.18%
Create a .env file in the project root:
# Anedya Device Connection Key
# Found in: Anedya Console β Your Project β Node β Connection Key
CONNECTION_KEY=your_connection_key_here
# Anedya Project API Key
# Found in: Anedya Console β Your Project β Settings β API Keys
API_KEY=your_api_key_here
# Anedya Node ID
# Found in: Anedya Console β Your Project β Nodes β Node ID
NODE_ID=your_node_id_here
# Server port (optional, defaults to 3000)
PORT=3000| Variable | Required | Description |
|---|---|---|
CONNECTION_KEY |
β | Authenticates telemetry submissions to Device API |
API_KEY |
β | Authenticates command fetching from Cloud API |
NODE_ID |
β | Identifies the virtual device node in Anedya |
PORT |
β | Web server port (auto-set by Render) |
This simulator is designed to run as a Render Web Service on the free tier.
-
Push to GitHub
git add . git commit -m "Initial commit" git push origin main
-
Create a Web Service on Render
-
Go to render.com β New β Web Service
-
Connect your
anedya-simulatorrepo -
Configure:
Setting Value Runtime Node Build Command npm installStart Command node simulator.jsPlan Free
-
-
Add Environment Variables
- In Render dashboard β Environment tab
- Add
CONNECTION_KEY,API_KEY, andNODE_ID
-
Deploy β Render will build and start your simulator automatically.
π‘ Why Express? Render's free tier requires an HTTP listener to keep the service alive. The Express server on
PORTserves this purpose while the simulator runs in the background.
node simulator.jsThe simulator will start sending telemetry immediately and log all activity to the console.
This simulator is the data engine behind the IoT Dashboard:
| Component | Repository | Deployment |
|---|---|---|
| Simulator (this repo) | anedya-simulator | Render |
| Dashboard | IOT_Dashboard_using_React | Vercel β |
Data Flow: Simulator β Anedya Cloud β Dashboard (via Anedya API)
- β All credentials stored as environment variables β never hardcoded
- β
.gitignoreexcludes.env, logs, and debug files - β API communication over HTTPS exclusively
- β Connection Key used for device-level auth (scoped to single node)
- β API Key used for project-level cloud operations
β οΈ Never commit your.envfile. Rotate keys immediately if exposed.
- Add more sensor types (pressure, light, motion)
- Configurable data ranges via environment variables
- WebSocket support for bi-directional communication
- Simulate multiple devices concurrently
- Add data anomaly simulation for alert testing
- Health check endpoint with uptime stats
- Docker containerization
Contributions are welcome! Here's how:
- Fork the repository
- Create a feature branch (
git checkout -b feature/multi-device-sim) - Commit your changes (
git commit -m 'Add multi-device simulation') - Push to the branch (
git push origin feature/multi-device-sim) - Open a Pull Request
Why does it need Express if it's just a simulator?
Render's free tier requires an active HTTP listener to keep the service running. The Express server satisfies this requirement while the actual simulation runs via
setInterval loops.
How accurate is the simulated data?
Temperature ranges from 20β30Β°C and humidity from 40β60% β realistic for indoor IoT sensors. Values are randomized with 2 decimal places for authentic-looking data streams.
Can I use this with a different IoT region?
Currently configured for
ap-in-1 (Asia-Pacific India). To use another region, update the DEVICE_URL and CLOUD_URL constants in simulator.js.
Will this work with Anedya's free plan?
Yes. The simulator uses standard Device and Cloud APIs that are available on all Anedya plans.
Distributed under the ISC License. See LICENSE for more information.
Ayush Kumar