{"id":32399915,"url":"https://github.com/davidasmith/sunsynkr","last_synced_at":"2025-10-25T08:59:13.432Z","repository":{"id":250952623,"uuid":"835925555","full_name":"DavidASmith/sunsynkr","owner":"DavidASmith","description":"Retrieve data from Sunsynk solar PV systems via SunsynkConnect","archived":false,"fork":false,"pushed_at":"2024-07-31T22:43:33.000Z","size":1176,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-08-01T02:04:51.650Z","etag":null,"topics":["inverter","pv","r-package","solar","sunsynk"],"latest_commit_sha":null,"homepage":"https://davidasmith.github.io/sunsynkr/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DavidASmith.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-30T19:55:46.000Z","updated_at":"2024-07-31T22:41:53.000Z","dependencies_parsed_at":"2024-07-31T01:56:54.347Z","dependency_job_id":"258cb705-a286-47df-92fa-d6d28a04f4a6","html_url":"https://github.com/DavidASmith/sunsynkr","commit_stats":null,"previous_names":["davidasmith/sunsynkr"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DavidASmith/sunsynkr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavidASmith%2Fsunsynkr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavidASmith%2Fsunsynkr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavidASmith%2Fsunsynkr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavidASmith%2Fsunsynkr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DavidASmith","download_url":"https://codeload.github.com/DavidASmith/sunsynkr/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavidASmith%2Fsunsynkr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280929567,"owners_count":26415348,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-25T02:00:06.499Z","response_time":81,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["inverter","pv","r-package","solar","sunsynk"],"created_at":"2025-10-25T08:59:12.078Z","updated_at":"2025-10-25T08:59:13.423Z","avatar_url":"https://github.com/DavidASmith.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# sunsynkr\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/DavidASmith/sunsynkr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/DavidASmith/sunsynkr/actions/workflows/R-CMD-check.yaml)\n\u003c!-- badges: end --\u003e\n\n`sunsynkr` is an R package to help you acquire information about Sunsynk photovoltaic systems from their API. If you have a Sunsynk inverter and an account to view and manage it on [SunsynkConnect](https://sunsynk.net/), you should be able to use this package to retrieve information about your plant. \n\nNote that this package is unofficial and is in no way associated with Sunsynk. It may stop working (or return misleading outputs) at any time and without warning.\n\nAlso note that this package is currently at an early stage of development. Functions may not work as specified and things may change fundamentally in future versions. \n\n## Installation\n\nFrom R, you can install the current release of `sunsynkr` like so:\n\n``` r\ndevtools::install_github(\"DavidASmith/sunsynkr\")\n```\n\n## Example usage\n\nFirst, load the package.\n\n```{r example}\nlibrary(sunsynkr)\n```\n\n### Authentication\n\nYou must configure environment variables to hold your sunsynk username and password (the ones you use to login to SunsynkConnect at https://sunsynk.net/). Configure the following environment variables:\n\n- `SUNSYNK_USER`\n- `SUNSYNK_PASS`\n\n### Get a token\n\nAll `sunsynkr` functions which call the API require a token as an argument. Accordingly, you must first acquire an authentication token.\n\n```{r}\ntoken \u003c- get_token()\ntoken\n```\n\nYou can now use this token to authenticate other `susynkr` functions to the API.\n\n### Get plants details\n\n```{r include=FALSE}\n# Redact personal info\nredact_character \u003c- function(x) {\n  gsub(\"\\\\w\", \"X\", x)\n}\n\nredact_plants \u003c- function(x) {\n  \n  plant_infos \u003c- x$data$infos\n  \n  redact_plant \u003c- function(x) {\n    x$id \u003c- redact_character(x$id)\n    x$name \u003c- redact_character(x$name)\n    x$thumbUrl \u003c- redact_character(x$thumbUrl)\n    x$address \u003c- redact_character(x$address)\n    x$email \u003c- redact_character(x$email)\n    x$phone \u003c- redact_character(x$phone)\n    x$masterId \u003c- redact_character(x$masterId)\n    \n    x\n  }\n  \n  x$data$infos \u003c- lapply(plant_infos, redact_plant)\n  \n  x\n  \n}\n\n```\n\nYou can now get details of all plants associated with your account.\n\n```{r}\nplants \u003c- get_plants(token)\n\n```\n\n```{r include=FALSE}\nplant_id \u003c- plants$data$infos[[1]]$id\n\nplants \u003c- plants |\u003e \n  redact_plants()\n```\n\nPrinting the `sunsynkr_plants` object returns a tibble summarising the information available for each plant.\n\n```{r}\nplants\n\n```\n\n### Flow\n\nWe can query the most recent power flow from the API for a given plant. We can extract the plant from `plants` like this. \n\n```{r eval=FALSE}\nplant_id \u003c- plants$data$infos[[1]]$id\n```\n\nThen, we can obtain the power flow for the plant.\n\n```{r}\nflow \u003c- get_flow(token, \n                 plant_id)\n\n```\n\nPrinting the `sunsynkr_flow` object outputs a representation of the power flows managed by the inverter.\n\n```{r}\nflow\n```\n\n### Day summary\n\nYou can return a summary of all power flows (and battery state of charge) at five minute intervals for a given day.\n\n```{r}\n\ndate \u003c- lubridate::today() - lubridate::days(1)\n\nday_summary_table \u003c- get_day_summary_table(token, \n                                           plant_id, \n                                           date)\n\nday_summary_table\n```\n\nYou can also generate a plot of the day summary table.\n\n```{r fig.height=6, fig.width=6}\nplot(day_summary_table)\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidasmith%2Fsunsynkr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidasmith%2Fsunsynkr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidasmith%2Fsunsynkr/lists"}