Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Add API to get historical data for Smart Plug mini from broadlink server (or mention my tool) #746

Open
ZuinigeRijder opened this issue Feb 4, 2023 · 1 comment

Comments

@ZuinigeRijder
Copy link

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?

@ZuinigeRijder
Copy link
Author

FYI for the ones who would like more information of my tool python-broadlink-smart-plug-mini.

Added tool to read the smart_plug_mini.py generated csv files and write a summary for each device to a separate Google spreadsheet

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.

Broadlink Smart Plug Mini showing csv results in Google Spreadsheet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant