Know your home power usage from State Grid Corporation of China
(SGCC
)
- Periodically collect power usage and charge data
- Provide residents and their usage data through Web API
- Web page which illustrates BI dashboard
Pull the codes to your local environment
$ git clone https://github.com/usharerose/sgcc-alert.git && cd sgcc-alert
Rename ./settings_local.py.template
to ./settings_local.py
, and fill your personal settings into it.
SGCC_ACCOUNT_USERNAME = 'admin' # account name of SGCC official website
SGCC_ACCOUNT_PASSWORD = 'admin' # account password of SGCC official website
DAILY_CRON_TIME = '06:00' # The time when fetch your usage data from remote, MM:SS
SYNC_INITIALIZED = True # Whether fetch your usage data immediately when start services or not
Then start the services
$ make run
You can view the illustration by http://127.0.0.1:30001/dashboard
And integrate with other unified center. e.g. Home Assistant as Webpage card.
Service exposes APIs, allowing users to query data. You can view the definitions from http://127.0.0.1:30001/api/v1.0/docs/.
Execute the following commands, which sets up a service with development dependencies and enter into it.
> make run && make ssh
- As a precondition, please install Poetry which is a tool for dependency management and packaging in Python.
- Install and activate local virtual environment
> poetry install && poetry shell
IPython
is provided as interactive shell