sgcc_electricity_new  by ARC-MX

Home Assistant integration for State Grid electricity data

Created 2 years ago
1,729 stars

Top 24.1% on SourcePulse

GitHubView on GitHub
Project Summary

Summary This project integrates China's State Grid electricity data into Home Assistant for users in non-Southern Grid regions. It provides real-time monitoring of electricity usage, historical data logging, and cost tracking within smart home setups, automating data retrieval and overcoming website security challenges.

How It Works The system uses Python with Selenium and Chrome anti-detection to scrape State Grid data. A key innovation is employing Volcengine's Doubao LLM for offline, robust solving of Tencent CAPTCHAs, replacing older OCR/ONNX methods. Fetched data is pushed to Home Assistant via its REST API, creating sensor entities. Daily usage can optionally be stored in a local SQLite database.

Quick Start & Requirements

  • Installation: Docker deployment via docker-compose.
  • Prerequisites: Docker, Home Assistant, State Grid account, Volcengine ARK API Key (for LLM CAPTCHA). Requires ~1GB disk space, ~500MB RAM. Supports amd64, arm64, armv7 (manual ONNX setup for armv7).
  • Links: Project Repo, Original Repo, Volcengine ARK, State Grid Login.

Highlighted Details

  • LLM-Powered CAPTCHA: Advanced, offline visual recognition for CAPTCHAs using Volcengine's Doubao LLM.
  • Rich Data Integration: Exposes sensors for daily/monthly/yearly usage/charges, pre-paid balance, and time-of-use (peak/valley/flat/tip) consumption.
  • Broad Platform Support: Compatible with amd64, arm64, and armv7 architectures.
  • Configurable Data Retention: Stores daily usage data for 7 or 30 days in SQLite.
  • Low Balance Alerts: Optional push notifications for low electricity balance.

Maintenance & Community This project is an actively maintained fork of an archived repository, with significant updates by ARC-MX, including the LLM CAPTCHA solution. Community discussion occurs in a paid QQ group, requiring proof of project support.

Licensing & Compatibility The repository's license is not specified, making commercial use and derivative works unclear. It is designed for integration with Home Assistant.

Limitations & Caveats Restricted to China's State Grid service areas (excluding Southern Grid provinces). State Grid imposes daily login limits that can hinder retrieval. Requires a Volcengine API key for CAPTCHA resolution. Enabling "smart payment" may shift billing to pre-paid, risking service interruption.

Health Check
Last Commit

1 week ago

Responsiveness

Inactive

Pull Requests (30d)
3
Issues (30d)
9
Star History
40 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.