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

Partner files for v1.0 usage service #299

Merged
merged 4 commits into from
Jun 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions tools/usage-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# python-alpine does not include gcc/glib required by Pandas.
# Trying slim for now.
FROM python:3.11-slim
# Best practice is to have a WORKDIR. So we have one, but I'm pretty sure we won't
# use it.
WORKDIR /app
RUN pip3 install --no-cache-dir pwdusage
# COPY . . - don't need this, as we don't copy any files in.
CMD ["python3", "-m", "pwdusage.server"]
EXPOSE 9050
27 changes: 27 additions & 0 deletions tools/usage-service/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Powerwall-Dashboard Usage Micro Service

This folder contains the sample setup files for a usage microservice that integrates
into Powerwall-Dashboard. This service provides a proxy that generates usage and
cost/savings information based on utility usage plans. As of 4/6/2023, this service only
supports a general time of use plan, but the service is extensible to different plans.

More specifically, this folder contains:

- Scripts and docker configuration files required to setup a dock image for the
`pwdusage` usage micro service for Powerwall-Dashboard.
- A sample configuration file for `pwdusage`.
- Sample grafana dashboard files that can be used to build your own usage dashboards
and panels.

As this micro-service is tightly linked to the `pwdusage` python package, please refer
to the [`pwdusage`](https://github.com/BuongiornoTexas/pwdusage) README for specifics
on:
- Creating a docker image.
- Configuring the service.
- Configuring grafana to use the service.

Note: I have made the explicit decision to document once with `pwdusage` rather than try
to manage two parallel documentation streams.



209 changes: 209 additions & 0 deletions tools/usage-service/Savings panel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
{
"id": 71,
"gridPos": {
"h": 5,
"w": 9,
"x": 0,
"y": 20
},
"type": "graph",
"title": "Savings - ToU Month to Date",
"transformations": [
{
"id": "calculateField",
"options": {
"alias": "powerwall > home",
"mode": "reduceRow",
"reduce": {
"include": [
"Off-Peak PW to home-grid charge ($)",
"Peak PW to home-grid charge ($)"
],
"reducer": "sum"
}
}
},
{
"id": "calculateField",
"options": {
"alias": "solar > home",
"mode": "reduceRow",
"reduce": {
"include": [
"Off-Peak Solar to home+residual ($)",
"Peak Solar to home+residual ($)"
],
"reducer": "sum"
}
}
},
{
"id": "calculateField",
"options": {
"alias": "export > grid",
"mode": "reduceRow",
"reduce": {
"include": [
"Off-Peak Grid export+++ ($)",
"Peak Grid export+++ ($)"
],
"reducer": "sum"
}
}
},
{
"id": "calculateField",
"options": {
"alias": "total",
"mode": "reduceRow",
"reduce": {
"include": [
"powerwall > home",
"solar > home",
"export > grid"
],
"reducer": "sum"
}
}
},
{
"id": "organize",
"options": {
"excludeByName": {
"Off-Peak Grid export+++ ($)": true,
"Off-Peak Grid export+++ (kWh)": true,
"Off-Peak Grid supply--- ($)": true,
"Off-Peak Grid supply--- (kWh)": true,
"Off-Peak PW to home-grid charge ($)": true,
"Off-Peak PW to home-grid charge (kWh)": true,
"Off-Peak Solar to home+residual ($)": true,
"Off-Peak Solar to home+residual (kWh)": true,
"Off-Peak Supply Charge ($)": true,
"Peak Grid export+++ ($)": true,
"Peak Grid export+++ (kWh)": true,
"Peak Grid supply--- ($)": true,
"Peak Grid supply--- (kWh)": true,
"Peak PW to home-grid charge ($)": true,
"Peak PW to home-grid charge (kWh)": true,
"Peak Solar to home+residual ($)": true,
"Peak Solar to home+residual (kWh)": true,
"Peak Supply Charge ($)": true,
"_time": false
},
"indexByName": {},
"renameByName": {}
}
}
],
"datasource": {
"uid": "-e6_y3a4k",
"type": "simpod-json-datasource"
},
"thresholds": [],
"pluginVersion": "9.1.2",
"timeFrom": "1M",
"hideTimeOverride": true,
"description": "Estimated Savings",
"links": [],
"legend": {
"alignAsTable": true,
"avg": false,
"current": false,
"hideEmpty": false,
"hideZero": true,
"max": false,
"min": false,
"rightSide": true,
"show": true,
"total": true,
"values": true
},
"aliasColors": {
"battery": "green",
"battery impact": "green",
"combined": "red",
"solar": "yellow",
"solar + battery": "red",
"solar > grid": "purple",
"solar > home": "yellow",
"solar only": "yellow",
"total": "blue"
},
"bars": true,
"dashLength": 10,
"decimals": 2,
"fieldConfig": {
"defaults": {
"links": []
},
"overrides": []
},
"fill": 1,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
"pointradius": 2,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"targets": [
{
"datasource": {
"type": "simpod-json-datasource",
"uid": "-e6_y3a4k"
},
"editorMode": "code",
"payload": "{\r\n \"summary\": true,\r\n \"month_to_date\": true\r\n}",
"refId": "A",
"target": "usage"
}
],
"timeRegions": [],
"tooltip": {
"shared": false,
"sort": 0,
"value_type": "individual"
},
"transparent": true,
"xaxis": {
"mode": "series",
"show": false,
"values": [
"total"
],
"name": null,
"buckets": null
},
"yaxes": [
{
"$$hashKey": "object:1096",
"decimals": 2,
"format": "currencyUSD",
"label": "",
"logBase": 1,
"min": "0",
"show": true
},
{
"$$hashKey": "object:1097",
"format": "short",
"logBase": 1,
"show": false
}
],
"yaxis": {
"align": false
},
"dashes": false,
"fillGradient": 0,
"hiddenSeries": false,
"interval": "",
"lines": false,
"percentage": false,
"points": false,
"stack": false,
"steppedLine": false,
"timeShift": null
}
Loading