Git Product home page Git Product logo

leandroalbero / pvpc-kasa-nicehash Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 460 KB

Calculates the cost-effectiveness of mining. It queries data from TP-Link HS110, queries average cost/day of the electricity and also queries Nicehash API in order to get bitcoin mined per day on my machines.

License: GNU General Public License v3.0

Python 100.00%
bitcoin nicehash python tplink kasa spain

pvpc-kasa-nicehash's Introduction

PVPC + Kasa smart plugs + Nicehash

This script calculates the cost-effectiveness of mining. It queries historical data from a TP-Link HS110 smart plug, queries average cost/day of the electricity (Spanish grid only for now, PVPC) and also queries Nicehash's API in order to get bitcoin and EUR produced per day by the miners.

Getting started

You can install the most recent release using pip while in the project root:

pip3 install .

Then you'll need to install its dependencies using:

pip3 install -r requirements.txt

Finally, run it by:

(venv) fengdu:pvpc-kasa-nicehash leandroalbero$ python3 pvpc-knh
[L] Current power consumption (W): <EmeterStatus power=762.746298 voltage=231.684036 current=3.343074 total=761.359>
________________
Total energy cost: 237.53 EUR
Total produced BTC: 0.01009038 EUR: 390.40
Average produced per day BTC: 0.00017702 EUR: 6.85
Average energy cost per day: 4.85 EUR
________________

Note: If using Nicehash API v2 you need to create a file named 'secrets' with org_id, api_key and api_secret on each line.

Requirements and supported devices

  • TP-Link Kasa smart plug, this code has been tested with the HS110
  • Nicehash API v2 org_id, api_key and api_secret

Plugs

  • HS100
  • HS103
  • HS105
  • HS107
  • HS110
  • KP105
  • KP115
  • KP401

TODO:

  • We don't use 'ESIOS API' because it requires an API token, we use a web scraper on https://tarifaluzhora.es/ instead. This is slower, but it is easier to set up. Will try to use ESIOS API by requesting a token on the CLI
  • CLI doesn't have any parameters yet. Should have at least start_date and end_date or a default value for current month
  • Nicehash API
  • Tidy the code for the plot function.
  • Change start and end date to query data for the current month by default

Resources

Links

Reverse engineering the TP-Link HS110

TP-Link WiFi SmartPlug Client and Wireshark Dissector

Python-kasa GitHub repository

pvpc-kasa-nicehash's People

Contributors

leandroalbero avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.