npm package: @ivk1231/homebridge-solar-monitor
Description: Solar production monitor for Homebridge with Pushover notifications
Author: Solar Monitor Team
Latest version: 1.0.0

# Homebridge Solar Monitor

A Homebridge plugin that monitors solar production data from e-SenZ and provides HomeKit integration with Pushover notifications.

## Features

- 🌞 **Real-time Solar Monitoring**: Scrapes data from e-SenZ solar monitoring website
- 📱 **Pushover Notifications**: Sends rich notifications to iOS devices
- 👥 **Multi-User Support**: Send notifications to multiple family members
- ⏰ **Time-Based Monitoring**: Only monitors during solar hours (6 AM - 6:30 PM IST)
- 🏠 **HomeKit Integration**: Exposes solar data as HomeKit accessories
- 🔄 **Automatic Updates**: Configurable update intervals (5-60 minutes)

## Installation

### Option 1: Install via Homebridge UI (Recommended)

1. Open Homebridge UI: `http://your-homebridge-ip:8581`
2. Go to **Plugins** → **Search**
3. Search for `homebridge-solar-monitor`
4. Click **Install**

### Option 2: Install via NPM

```bash
npm install -g homebridge-solar-monitor
```

### Option 3: Install from GitHub

```bash
npm install -g git+https://github.com/yourusername/homebridge-solar-monitor.git
```

## Configuration

### Via Homebridge UI

1. Go to **Accessories** → **Add Accessory**
2. Select **Solar Monitor**
3. Configure the following settings:

| Setting | Description | Required |
|---------|-------------|----------|
| **Name** | Display name in HomeKit | Yes |
| **e-SenZ Username** | Your e-SenZ login username | Yes |
| **e-SenZ Password** | Your e-SenZ login password | Yes |
| **Update Interval** | Minutes between updates (5-60) | Yes |
| **Pushover User Key** | Your Pushover user key | No |
| **Pushover App Token** | Your Pushover app token | No |
| **Second User Key** | Additional family member's user key | No |

### Via config.json

```json
{
  "accessories": [
    {
      "accessory": "SolarMonitor",
      "name": "Solar Monitor",
      "username": "314",
      "password": "solgen314",
      "updateInterval": 15,
      "pushoverUserKey": "your_user_key_here",
      "pushoverAppToken": "your_app_token_here",
      "secondUserKey": "family_member_user_key"
    }
  ]
}
```

## HomeKit Integration

The plugin creates the following HomeKit accessories:

### 1. Solar Monitor (Lightbulb)
- **Brightness**: Represents current power output (0-100%)
- **On/Off**: Indicates if solar is active (power > 0)

### 2. Today Energy (Temperature Sensor)
- **Temperature**: Today's energy production (scaled for visibility)

### 3. Yesterday Energy (Humidity Sensor)
- **Humidity**: Yesterday's energy production (scaled for visibility)

### 4. Monthly Energy (Contact Sensor)
- **Contact State**: Indicates if monthly energy > 0

## Pushover Setup

### 1. Install Pushover App
- Download **Pushover** from the App Store ($5 one-time)
- Create account at https://pushover.net/
- Note your **User Key** from the dashboard

### 2. Create App Token
1. Go to https://pushover.net/apps/build
2. Create new app called "Solar Monitor"
3. Copy the **App Token**

### 3. Add to Configuration
Add your credentials to the plugin configuration in Homebridge UI.

## Sample Notifications

```
⚡ Solar Production Update

🔋 Current Power: 10 kW
📊 E Today: 2.90 kWh
📈 E Yesterday: 27.92 kWh
📅 E This Month: 0.00 kWh

⏰ 2025-07-20 10:12:22
```

## Requirements

- **Homebridge**: v1.3.0 or higher
- **Node.js**: v14.0.0 or higher
- **Python 3**: For web scraping
- **Chrome/Chromium**: For browser automation
- **Pushover App**: For iOS notifications (optional)

## Troubleshooting

### Common Issues

1. **"Failed to scrape data"**
   - Check e-SenZ credentials
   - Verify internet connection
   - Check if e-SenZ website is accessible

2. **"No notifications received"**
   - Verify Pushover credentials
   - Check iOS notification settings
   - Test with curl command

3. **"Python not found"**
   - Install Python 3: `sudo apt-get install python3`
   - Install dependencies: `pip3 install -r requirements.txt`

### Logs

Check Homebridge logs for detailed error messages:
```bash
# View logs
sudo journalctl -u homebridge -f

# Or in Homebridge UI: Settings → Logs
```

## Development

### Local Development

```bash
# Clone repository
git clone https://github.com/yourusername/homebridge-solar-monitor.git
cd homebridge-solar-monitor

# Install dependencies
npm install

# Link for development
npm link
```

### Testing

```bash
# Test scraper
python3 solar_scraper.py

# Test notifications
python3 test_pushover.py
```

## License

MIT License - see LICENSE file for details.

## Support

- **Issues**: https://github.com/yourusername/homebridge-solar-monitor/issues
- **Discussions**: https://github.com/yourusername/homebridge-solar-monitor/discussions

---

**Enjoy monitoring your solar production with HomeKit!** 🌞🏠📱