A simple Node.js application that fetches and displays real-time power usage data from the n2g-ynni.net API.
Power Monitor connects to the n2g-ynni.net API to retrieve instantaneous electricity consumption data. It displays:
- Current power usage in watts
- Daily minimum power usage
- Daily maximum power usage
- Timestamp of the measurement
-
Clone this repository:
git clone https://github.com/yourusername/power-monitor.git cd power-monitor
-
Install dependencies:
npm install
-
Create a
.env
file in the root directory with your API key:API_KEY=your_api_key_here
Run the application with:
node power-monitor.js
The application will display your current power usage information in the console.
- dotenv - For loading environment variables
- node-fetch - For making HTTP requests (required for Node.js < 18)
- Node.js (version 12 or higher recommended)
- An API key from n2g-ynni.net