A Home Assistant integration for PSEG Long Island that provides automated energy usage data collection and statistics updates using a dedicated automation addon.
This integration uses a two-component approach:
- PSEG Long Island Automation Addon: Handles automated login, reCAPTCHA bypass, and cookie management
- PSEG Long Island Integration: Lightweight component that fetches energy data using the addon's authentication
- User Configuration: Enter PSEG credentials in the integration setup
- Automated Login: Addon uses Playwright to handle reCAPTCHA and login
- Cookie Management: Addon provides fresh authentication cookies to the integration
- Data Retrieval: Integration fetches energy usage data from PSEG API
- Automatic Refresh: Cookies are automatically refreshed when they expire
- Home Assistant OS, Core, or Supervised installation
- PSEG Long Island account credentials (username/email and password)
- Internet access for PSEG API calls
-
Add the custom repository:
- Go to Settings โ Add-ons โ Add-on Store
- Click the three dots menu (โฎ) โ Repositories
- Add:
https://github.com/daswass/ha-psegli - Click Add
-
Install the addon:
- Find PSEG Long Island Automation in the store
- Click Install
- Wait for installation to complete
- Click Start
-
Verify the addon is running:
- Check that the addon shows "Running" status
- The addon provides a web interface at port 8000
-
Copy the integration files:
# From your HA system cp -r custom_components/psegli /config/custom_components/ -
Restart Home Assistant
-
Add the integration:
- Go to Settings โ Devices & Services
- Click Add Integration
- Search for PSEG Long Island
- Enter your PSEG username/email and password
- Click Submit
The integration configuration is simple - just enter your PSEG credentials:
- Username/Email: Your PSEG account email address
- Password: Your PSEG account password
- Cookie: A working Cookie from a manual login to https://mysmartenergy.psegliny.com/Dashboard
Once configured, the integration will:
- Fetch energy usage data every 5 minutes
- Update Home Assistant Energy Dashboard statistics
With optional AddOn:
- Automatically log in to PSEG using the addon
- Handle reCAPTCHA challenges transparently
- Maintain authentication cookies automatically
- ๐ Automated Authentication: No manual cookie management needed
- ๐ค reCAPTCHA Bypass: Uses Playwright for automated login
- ๐ Energy Statistics: Updates Home Assistant Energy Dashboard
- ๐ Automatic Refresh: Handles cookie expiration seamlessly
- โฑ๏ธ Real-time Data: Hourly interval data from PSEG
- Initial Setup: User enters PSEG credentials in integration setup
- Addon Communication: Integration calls addon API to get fresh cookies
- Automated Login: Addon uses Playwright to handle reCAPTCHA and login
- Cookie Provision: Addon returns valid authentication cookies
- Data Fetching: Integration uses cookies to call PSEG API
- Automatic Refresh: Process repeats when cookies expire
- Check if addon is running in Settings โ Add-ons
- Verify addon logs for errors
- Ensure port 8000 is available
- Check addon health at
/api/health
- Verify addon is running before adding integration
- Check Home Assistant logs for configuration errors
- Ensure PSEG credentials are correct
- Verify internet connectivity
- Check addon logs for login failures
- Verify PSEG account is active and not locked
- Ensure reCAPTCHA is accessible from your network
- Check if PSEG has changed their login process
If the psegli.enter_mfa_code action doesn't appear in Developer Tools > Actions:
-
Reload the integration โ Go to Settings > Integrations > PSEG Long Island > โฎ > Reload
-
Use Options flow โ You can still complete MFA via Settings > Integrations > PSEG Long Island > โฎ > Options (leave cookie empty, Submit, then enter the code)
- Check integration logs for API errors
- Verify addon is providing valid cookies
- Check PSEG website accessibility
- Verify integration is enabled and running
The integration provides:
- Hourly Energy Usage: kWh consumption per hour
- Daily Totals: Aggregated daily consumption
- Statistics: Long-term energy tracking
- Energy Dashboard: Integration with HA Energy features
- Addon Issues: Check addon logs in Home Assistant
- Integration Issues: Check Home Assistant logs
- PSEG Issues: Verify account status on PSEG website
- GitHub Issues: Report bugs at ha-psegli repository
service: psegli.update_statisticsThe addon provides these endpoints:
GET /health- Health checkPOST /login- Login with username/passwordPOST /login-form- Login with form data
- Fix addon communication on Home Assistant OS: discover addon via Supervisor instead of
localhost:8000 - Increase login/MFA timeout to 300s for long Playwright flows
- Fix Options flow for Home Assistant 2025.12+ (
config_entryis now read-only on OptionsFlow)
- Allow integration setup to complete when MFA required (call enter_mfa_code with code)
- Add INFO logging for statistics update start/completion
- Skip scheduled cookie refresh when cookie still valid (avoid MFA every 30 min)
- Auto-update statistics after enter_mfa_code and on scheduled runs
- Trigger update_statistics after refresh_cookie succeeds
- Fix MFA code submission flow (wait_for_selector, iframe support, get_by_placeholder fallback)
- Add HEADED=1 env var for local MFA debugging
- Fix enter_mfa_code action: register identically to refresh_cookie and update_statistics (no configuration.yaml needed)
- Bump version to force integration reload (fixes enter_mfa_code action visibility)
- MFA support: enter_mfa_code service for completing verification from Developer Tools
- Cleanup logging
- Improved auto-update scheduling
- Refactored Add-On
- Improved statistics calculation
- Add-On retry improvements
- Update Stealth version
- Add-On logic updates
- Fully functional integration with optional Add-On
- Major Architecture Change: Now uses Home Assistant addon for automation
- Simplified Setup: No more manual cookie management
- Automated reCAPTCHA: Playwright handles all browser automation
- Repository Installation: Addon installs from custom repository
- User-Friendly Configuration: Simple username/password form
- Automatic Cookie Refresh: Seamless authentication management
- Initial release with manual cookie management
- Basic PSEG API integration
- Energy Dashboard integration
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
Note: This integration requires the PSEG Long Island Automation Addon to function. The addon handles all browser automation and reCAPTCHA challenges automatically, making the integration much more user-friendly than previous versions.