{"id":49835413,"url":"https://github.com/leandroalbero/pvpc-kasa-nicehash","last_synced_at":"2026-05-14T00:08:14.926Z","repository":{"id":165206992,"uuid":"446653658","full_name":"leandroalbero/pvpc-kasa-nicehash","owner":"leandroalbero","description":"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.","archived":false,"fork":false,"pushed_at":"2022-03-01T08:18:19.000Z","size":460,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-01-29T20:16:50.438Z","etag":null,"topics":["bitcoin","kasa","nicehash","python","spain","tplink"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leandroalbero.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-01-11T02:39:13.000Z","updated_at":"2023-03-11T11:33:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"3715ddbe-9b1d-4025-b64e-231fb2c1087b","html_url":"https://github.com/leandroalbero/pvpc-kasa-nicehash","commit_stats":{"total_commits":12,"total_committers":1,"mean_commits":12.0,"dds":0.0,"last_synced_commit":"26e00597673d1bd3cc36787cee277accbb44e2e4"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/leandroalbero/pvpc-kasa-nicehash","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leandroalbero%2Fpvpc-kasa-nicehash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leandroalbero%2Fpvpc-kasa-nicehash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leandroalbero%2Fpvpc-kasa-nicehash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leandroalbero%2Fpvpc-kasa-nicehash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leandroalbero","download_url":"https://codeload.github.com/leandroalbero/pvpc-kasa-nicehash/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leandroalbero%2Fpvpc-kasa-nicehash/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33004784,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"ssl_error","status_checked_at":"2026-05-13T13:14:51.610Z","response_time":115,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitcoin","kasa","nicehash","python","spain","tplink"],"created_at":"2026-05-14T00:08:14.169Z","updated_at":"2026-05-14T00:08:14.910Z","avatar_url":"https://github.com/leandroalbero.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PVPC + Kasa smart plugs + Nicehash\n\nThis 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.\n\n## Getting started\n\nYou can install the most recent release using pip while in the project root:\n\n`pip3 install .`\n\nThen you'll need to install its dependencies using:\n\n`pip3 install -r requirements.txt`\n\nFinally, run it by:\n\n```\n(venv) fengdu:pvpc-kasa-nicehash leandroalbero$ python3 pvpc-knh\n[L] Current power consumption (W): \u003cEmeterStatus power=762.746298 voltage=231.684036 current=3.343074 total=761.359\u003e\n________________\nTotal energy cost: 237.53 EUR\nTotal produced BTC: 0.01009038 EUR: 390.40\nAverage produced per day BTC: 0.00017702 EUR: 6.85\nAverage energy cost per day: 4.85 EUR\n________________\n\n```\n**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.\n\n![](media/img.png)\n![](media/profitability.png)\n## Requirements and supported devices\n\n* TP-Link Kasa smart plug, this code has been tested with the HS110\n* Nicehash API v2 org_id, api_key and api_secret\n\n### Plugs\n\n* HS100\n* HS103\n* HS105\n* HS107\n* HS110\n* KP105\n* KP115\n* KP401\n\n## TODO:\n\n* We don't use 'ESIOS API' because it requires an API token, we use a web scraper on\n  [https://tarifaluzhora.es/](https://tarifaluzhora.es/?tarifa=pcb\u0026fecha=10%2F01%2F2022) instead. This is slower,\n  but it is easier to set up. Will try to use ESIOS API by requesting a token on the CLI\n* CLI doesn't have any parameters yet. Should have at least start_date and end_date or a default value for current month\n* ~~Nicehash API~~\n* Tidy the code for the plot function.\n* Change start and end date to query data for the current month by default\n\n## Resources\n\n### Links\n\n[Reverse engineering the TP-Link HS110](https://www.softscheck.com/en/reverse-engineering-tp-link-hs110/)\n\n[TP-Link WiFi SmartPlug Client and Wireshark Dissector](https://github.com/softScheck/tplink-smartplug)\n\n[Python-kasa GitHub repository](https://github.com/python-kasa/python-kasa)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleandroalbero%2Fpvpc-kasa-nicehash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleandroalbero%2Fpvpc-kasa-nicehash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleandroalbero%2Fpvpc-kasa-nicehash/lists"}