python-broadlink
python-broadlink copied to clipboard
Feature: Add API to get historical data for Smart Plug mini from broadlink server (or mention my tool)
I am using 2 Smart plug SP3S-EU since 2018. The e-control App was limited in functionality/views. One of the strange things is e.g. the fact that you cannot see the month December of the year before the current year. So I was looking around if someone already had a better solution. I found the library python-broadlink, but this was only for local access to your broadlink smart plug devices (get direct power measurements). So I decided to try to sniff the e-Control app, see here.
In short, it appeared way easier to get the historical data of my smart plug mini than expected. You do not even have to login, you only need the server name and MAC address of the smart plug mini. Oops, so simple ;-)
So I started making a simple standalone python script smart_plug_mini.py which appends the history data per hour in a csv file for each device and made some parts configurable. Also the tool writes the Day, Weeks, Months and Years summaries to separate .csv files per device.
Maybe this is interesting for others or for python-broadlink to add to their features.
If this does not fit in the architecture of python-broadlink, maybe you want to add my tool python-broadlink-smart-plug-mini to the README of python-broadlink?
FYI for the ones who would like more information of my tool python-broadlink-smart-plug-mini.
Note: you need to install the package gspread and configure gspread
Usage:
python csv_to_google_sheet.py
INPUTFILES:
- smart_plug_mini.cfg
- for each configured DEVICE_NAME:
-
- DEVICE_NAME.csv
-
- DEVICE_NAME.days.csv
-
- DEVICE_NAME.weeks.csv
-
- DEVICE_NAME.months.csv
-
- DEVICE_NAME.years.csv
Standard output:
- progress of what is done
OUTPUT SPREADSHEET:
- DEVICE_NAME.SP (for each configured DEVICE_NAME)
So the smart_plug_mini.py tool runs on my Raspberry Pi server, but I want to look at the results, without having to login to my server. So another tool has been made, which copies a summary to a google spreadsheet for each device: csv_to_google_sheet.py
The Google spreadsheet contains kWh usage, including nice diagrams, when you import the example Badkamer.SP.xlsx spreadsheet in Google Spreadsheet:
- last written Date, Time, kWh, Hour, Day, Week, Month, Year
- last 48 hours
- last 32 days
- last 27 weeks
- last 25 months
- last 25 years ;-)
A short video of how it can look on an Android phone, can be found here. Of course you can also view the Google Spreadsheet on your computer or tablet, e.g. Windows or Mac.
