├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ └── build_images.yml ├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── graf_DA.yaml ├── graf_DS.yaml ├── graf_dash.json ├── powerwall.conf ├── powerwall.repo ├── powerwallcookie.sh.template └── run.sh /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Server/Desktop (please complete the following information):** 27 | - OS: [e.g. Windows, Fedora, Ubuntu] 28 | - Container runtime [e.g. docker, podman] 29 | - Version [e.g. 10, 32, 18.04] 30 | 31 | **Additional context** 32 | Add any other context about the problem here. 33 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/workflows/build_images.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: 'build images' 3 | 4 | on: 5 | push: 6 | branches: 7 | - multiarch 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Checkout 14 | uses: actions/checkout@v2 15 | 16 | - name: Prepare 17 | id: prep 18 | run: | 19 | DOCKER_IMAGE=${{ secrets.DOCKER_USERNAME }}/powerwall-dashboard 20 | ### ${GITHUB_REPOSITORY#*/} 21 | VERSION=multiarch 22 | SHORTREF=${GITHUB_SHA::8} 23 | 24 | # If this is git tag, use the tag name as a docker tag 25 | if [[ $GITHUB_REF == refs/tags/* ]]; then 26 | VERSION=${GITHUB_REF#refs/tags/v} 27 | fi 28 | TAGS_DOCKER="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:${SHORTREF},${DOCKER_IMAGE}:latest" 29 | TAGS_QUAYIO="${{ secrets.REGISTRY_URI }}/${DOCKER_IMAGE}:${VERSION},${{ secrets.REGISTRY_URI }}/${DOCKER_IMAGE}:${SHORTREF},${{ secrets.REGISTRY_URI }}/${DOCKER_IMAGE}:latest" 30 | 31 | # If the VERSION looks like a version number, assume that 32 | # this is the most recent version of the image and also 33 | # tag it 'latest'. 34 | 35 | #if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then 36 | # TAGS="$TAGS,${DOCKER_IMAGE}:latest" 37 | #fi 38 | 39 | # Set output parameters. 40 | echo ::set-output name=tags_docker::${TAGS_DOCKER} 41 | echo ::set-output name=tags_quayio::${TAGS_QUAYIO} 42 | echo ::set-output name=docker_image::${DOCKER_IMAGE} 43 | 44 | - name: Set up QEMU 45 | uses: docker/setup-qemu-action@master 46 | with: 47 | platforms: all 48 | 49 | - name: Set up Docker Buildx 50 | id: buildx 51 | uses: docker/setup-buildx-action@master 52 | 53 | - name: Login to DockerHub 54 | if: github.event_name != 'pull_request' 55 | uses: docker/login-action@v1 56 | with: 57 | username: ${{ secrets.DOCKER_USERNAME }} 58 | password: ${{ secrets.DOCKER_PASSWORD }} 59 | 60 | - name: Login to Quay 61 | if: github.event_name != 'pull_request' 62 | uses: docker/login-action@v1 63 | with: 64 | registry: quay.io 65 | username: ${{ secrets.QUAY_ROBOTACCT }} 66 | password: ${{ secrets.QUAY_ROBOTPASS }} 67 | 68 | 69 | - name: Build and publish to DockerHub and Quay 70 | uses: docker/build-push-action@v2 71 | with: 72 | builder: ${{ steps.buildx.outputs.name }} 73 | context: . 74 | file: ./Dockerfile 75 | platforms: linux/amd64,linux/arm64 76 | push: true 77 | tags: | 78 | ${{ steps.prep.outputs.tags_docker }} 79 | ${{ steps.prep.outputs.tags_quayio }} 80 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM centos:8 2 | MAINTAINER JR Morgan 3 | 4 | LABEL Vendor="CentOS8" \ 5 | License=GPLv2 \ 6 | Version=1.0 7 | 8 | ## Supports x86_64 or aarch64 9 | ARG TARGETARCH 10 | ENV A_ARCH=$TARGETARCH \ 11 | ARCH=$A_ARCH 12 | 13 | ENV VERSION_INFLUXDB=1.8.6 \ 14 | VERSION_TELEGRAF=1.19.0 \ 15 | VERSION_GRAFANA=7.5.2-1 16 | 17 | ENV POWERWALL_HOST="powerwall" \ 18 | POWERWALL_PASS="002D" \ 19 | POWERWALL_LOCATION="lat=36.2452052&lon=-113.7292593" \ 20 | DATABASE="PowerwallData" 21 | 22 | ## Install prerequisites 23 | RUN yum -y install epel-release \ 24 | && yum -y --setopt=tsflags=nodocs install \ 25 | initscripts \ 26 | urw-fonts \ 27 | cronie \ 28 | jq \ 29 | gettext 30 | 31 | ## Install Grafana 32 | RUN export IARCH=$(([[ $A_ARCH == *"arm"* ]] && echo "armhfp") || ([[ $A_ARCH == *"amd64"* ]] && echo "amd64" )) && \ 33 | echo "A_ARCH=${A_ARCH} IARCH=${IARCH} ARCH=${ARCH} OS arch=$(arch)" && \ 34 | yum -y --setopt=tsflags=nodocs install https://dl.grafana.com/oss/release/grafana-${VERSION_GRAFANA}.$(arch).rpm && \ 35 | yum -y clean all && \ 36 | rm -rf /var/cache/yum 37 | 38 | ## Install Telegraf + InfluxDB via binary (missing repo arm pkgs) 39 | RUN export IARCH=$(([[ $A_ARCH == *"arm"* ]] && echo "armhf") || ([[ $A_ARCH == *"amd64"* ]] && echo "amd64" )) \ 40 | && echo "A_ARCH=${A_ARCH} IARCH=${IARCH} ARCH=${ARCH} OS arch=$(arch)" \ 41 | && curl https://dl.influxdata.com/influxdb/releases/influxdb-${VERSION_INFLUXDB}_linux_${IARCH}.tar.gz -o influx.tar.gz \ 42 | && curl https://dl.influxdata.com/telegraf/releases/telegraf-${VERSION_TELEGRAF}_linux_${IARCH}.tar.gz -o telegraf.tar.gz \ 43 | && tar xvfz influx.tar.gz --strip=2 \ 44 | && tar xvzf telegraf.tar.gz --strip=2 45 | 46 | ## Cleanup tar files 47 | RUN rm -rf influx* telegraf* 48 | 49 | ## Defaults for InfluxDB 50 | ENV INFLUXDB_HTTP_ENABLED=true \ 51 | INFLUXDB_HTTP_BIND_ADDRESS="127.0.0.1:8086" \ 52 | INFLUXDB_HTTP_AUTH_ENABLED=false \ 53 | INFLUXDB_HTTP_LOG_ENABLED=true 54 | 55 | ## InfluxDB stores data by default at /var/lib/influxdb/[data|wal] 56 | ## which should be mapped to a docker/podman volume for persistence 57 | 58 | RUN mkdir -p /etc/telegraf && \ 59 | mkdir -p /etc/grafana/provisioning/dashboards \ 60 | /etc/grafana/provisioning/datasources \ 61 | /var/lib/grafana \ 62 | /var/log/grafana \ 63 | /var/lib/grafana/dashboards && \ 64 | chown grafana:grafana /var/lib/grafana/dashboards 65 | 66 | ADD powerwall.conf graf_DS.yaml graf_DA.yaml powerwallcookie.sh.template run.sh /tmp/ 67 | 68 | RUN mv /tmp/powerwall.conf /etc/telegraf/telegraf.d/powerwall.conf \ 69 | && mv /tmp/graf_DS.yaml /etc/grafana/provisioning/datasources/graf_DS.yaml \ 70 | && mv /tmp/graf_DA.yaml /etc/grafana/provisioning/dashboards/graf_DA.yaml \ 71 | && mv /tmp/powerwallcookie.sh.template /etc/powerwallcookie.sh \ 72 | && mv /tmp/run.sh /opt/run.sh \ 73 | && rm -f /tmp/* \ 74 | && chmod -v +x /opt/run.sh /etc/powerwallcookie.sh \ 75 | && export $(grep -v "#" /etc/sysconfig/grafana-server | cut -d= -f1) 76 | 77 | EXPOSE 3000 78 | 79 | CMD ["/opt/run.sh"] 80 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![GitHub Workflow](https://github.com/liveaverage/docker-powerwall-dashboard/actions/workflows/build_images.yml/badge.svg) 2 | ![Docker Pulls](https://img.shields.io/docker/pulls/liveaverage/powerwall-dashboard) 3 | 4 | > ⚠️ **DEPRECATION NOTICE** 5 | > This monolith image is being deprecated in favor of the [podman-compose or docker-compose variant](https://github.com/liveaverage/dc-powerwall-dashboard) which works the same, utilizes vendor-maintained images [for x86 and aarch64], and decouples the services for easier troubleshooting. 6 | 7 | # Overview 8 | 9 | This is based on the work of [@rhodesman](https://github.com/rhodesman) and his [teslaPowerDash](https://github.com/rhodesman/teslaPowerDash) repo, but hopefully enables easier ramp up to start obtaining and trending Powerwall 2 API data. 10 | 11 | # Preview 12 | 13 | Grafana Dashboard Preview 14 | 15 | # Usage 16 | 17 | If you're still using docker rather than podman, simply replace all `podman` calls with `docker`. 18 | 19 | - Pull the container image: 20 | 21 | ``` 22 | podman pull quay.io/liveaverage/powerwall-dashboard:latest 23 | ``` 24 | 25 | 26 | - Start the container, replacing `POWERWALL_IP` with the assigned IP address of your Powerwall, `POWERWALL_PASS` with your Powerwall password (required for Cookie-based auth as of **February 2021**), and `LOCAL_INFLUXDB_PATH` with an appropriate destination to store trend data: 27 | 28 | > The default Powerwall password may be the last 5 digits of your Backup Gateway. 29 | 30 | > Note you *must* use a hostname map for `powerwall` due to changes in the API introduced in **June 2021** 31 | 32 | ``` 33 | export POWERWALL_IP=192.168.1.92 34 | export POWERWALL_PASS=0R2D2 35 | export LOCAL_INFLUXDB_PATH=/tmp/influxdata 36 | export LOCAL_GRAFANA_PATH=/tmp/grafana 37 | export GRAFANA_WEATHER_LOCATION="lat=36.2452052&lon=-80.7292593" 38 | export GRAFANA_DASHBOARD_URL="https://raw.githubusercontent.com/liveaverage/docker-powerwall-dashboard/master/graf_dash.json" 39 | 40 | podman run --add-host powerwall:${POWERWALL_IP} -p 3000:3000 \ 41 | -e "POWERWALL_PASS=${POWERWALL_PASS}" \ 42 | -e "GRAFANA_DASHBOARD_URL=${GRAFANA_DASHBOARD_URL}" \ 43 | -e "POWERWALL_LOCATION=${GRAFANA_WEATHER_LOCATION}" \ 44 | -v ${LOCAL_INFLUXDB_PATH}:/var/lib/influxdb:z \ 45 | -v ${LOCAL_GRAFANA_PATH}:/var/lib/grafana:z \ 46 | liveaverage/powerwall-dashboard 47 | 48 | ``` 49 | - Access the Grafana dashboard from your container host IP, which may require firewall exceptions for TCP3000: http://localhost:3000 50 | - Default credentials are "admin" for username/password 51 | 52 | -------------------------------------------------------------------------------- /graf_DA.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | 3 | providers: 4 | # an unique provider name 5 | - name: 'Powerwall-Dashboard' 6 | # org id. will default to orgId 1 if not specified 7 | orgId: 1 8 | # name of the dashboard folder. Required 9 | folder: '' 10 | # folder UID. will be automatically generated if not specified 11 | folderUid: '' 12 | # provider type. Required 13 | type: file 14 | # disable dashboard deletion 15 | disableDeletion: false 16 | # enable dashboard editing 17 | editable: true 18 | # how often Grafana will scan for changed dashboards 19 | updateIntervalSeconds: 30 20 | options: 21 | # path to dashboard files on disk. Required 22 | path: /var/lib/grafana/dashboards 23 | -------------------------------------------------------------------------------- /graf_DS.yaml: -------------------------------------------------------------------------------- 1 | # config file version 2 | apiVersion: 1 3 | 4 | datasources: 5 | - orgId: 1 6 | name: DS_POWERDATA 7 | type: influxdb 8 | typeLogoUrl: '' 9 | access: proxy 10 | url: http://localhost:8086 11 | password: '' 12 | user: '' 13 | database: PowerwallData 14 | basicAuth: false 15 | basicAuthUser: '' 16 | basicAuthPassword: '' 17 | withCredentials: false 18 | isDefault: true 19 | jsonData: 20 | httpMode: GET 21 | keepCookies: [] 22 | secureJsonFields: {} 23 | version: 3 24 | readOnly: false 25 | -------------------------------------------------------------------------------- /graf_dash.json: -------------------------------------------------------------------------------- 1 | { 2 | "__inputs": [ 3 | { 4 | "name": "DS_POWERDATA", 5 | "label": "DS_POWERDATA", 6 | "description": "", 7 | "type": "datasource", 8 | "pluginId": "influxdb", 9 | "pluginName": "InfluxDB" 10 | } 11 | ], 12 | "__requires": [ 13 | { 14 | "type": "grafana", 15 | "id": "grafana", 16 | "name": "Grafana", 17 | "version": "6.2.5" 18 | }, 19 | { 20 | "type": "panel", 21 | "id": "grafana-piechart-panel", 22 | "name": "Pie Chart", 23 | "version": "1.3.6" 24 | }, 25 | { 26 | "type": "panel", 27 | "id": "graph", 28 | "name": "Graph", 29 | "version": "" 30 | }, 31 | { 32 | "type": "datasource", 33 | "id": "influxdb", 34 | "name": "InfluxDB", 35 | "version": "1.0.0" 36 | }, 37 | { 38 | "type": "panel", 39 | "id": "singlestat", 40 | "name": "Singlestat", 41 | "version": "" 42 | } 43 | ], 44 | "annotations": { 45 | "list": [ 46 | { 47 | "builtIn": 1, 48 | "datasource": "-- Grafana --", 49 | "enable": true, 50 | "hide": true, 51 | "iconColor": "rgba(0, 211, 255, 1)", 52 | "name": "Annotations & Alerts", 53 | "type": "dashboard" 54 | } 55 | ] 56 | }, 57 | "description": "An interactive view of your energy consumption, production, and environment.", 58 | "editable": true, 59 | "gnetId": null, 60 | "graphTooltip": 0, 61 | "id": null, 62 | "links": [], 63 | "panels": [ 64 | { 65 | "aliasColors": {}, 66 | "bars": false, 67 | "dashLength": 10, 68 | "dashes": false, 69 | "datasource": "DS_POWERDATA", 70 | "fill": 1, 71 | "gridPos": { 72 | "h": 8, 73 | "w": 12, 74 | "x": 0, 75 | "y": 0 76 | }, 77 | "id": 2, 78 | "legend": { 79 | "alignAsTable": false, 80 | "avg": false, 81 | "current": false, 82 | "max": false, 83 | "min": false, 84 | "show": false, 85 | "total": false, 86 | "values": false 87 | }, 88 | "lines": true, 89 | "linewidth": 1, 90 | "links": [], 91 | "nullPointMode": "null as zero", 92 | "options": {}, 93 | "percentage": false, 94 | "pointradius": 1, 95 | "points": false, 96 | "renderer": "flot", 97 | "seriesOverrides": [ 98 | { 99 | "alias": "output", 100 | "color": "#56A64B" 101 | }, 102 | { 103 | "alias": "charge", 104 | "color": "#37872D" 105 | } 106 | ], 107 | "spaceLength": 10, 108 | "stack": false, 109 | "steppedLine": false, 110 | "targets": [ 111 | { 112 | "alias": "output", 113 | "groupBy": [ 114 | { 115 | "params": [ 116 | "$__interval" 117 | ], 118 | "type": "time" 119 | }, 120 | { 121 | "params": [ 122 | "none" 123 | ], 124 | "type": "fill" 125 | } 126 | ], 127 | "hide": false, 128 | "measurement": "http", 129 | "orderByTime": "ASC", 130 | "policy": "default", 131 | "query": "SELECT count(\"battery_instant_power\") FROM \"http\" WHERE (\"battery_instant_power\" > 0) AND $timeFilter GROUP BY time(1d) fill(none)", 132 | "rawQuery": false, 133 | "refId": "A", 134 | "resultFormat": "time_series", 135 | "select": [ 136 | [ 137 | { 138 | "params": [ 139 | "battery_instant_power" 140 | ], 141 | "type": "field" 142 | }, 143 | { 144 | "params": [], 145 | "type": "mean" 146 | } 147 | ] 148 | ], 149 | "tags": [ 150 | 151 | ] 152 | }, 153 | { 154 | "alias": "charge", 155 | "groupBy": [ 156 | { 157 | "params": [ 158 | "1d" 159 | ], 160 | "type": "time" 161 | }, 162 | { 163 | "params": [ 164 | "0" 165 | ], 166 | "type": "fill" 167 | } 168 | ], 169 | "hide": true, 170 | "measurement": "http", 171 | "orderByTime": "ASC", 172 | "policy": "default", 173 | "query": "SELECT count(\"battery_instant_power\") FROM \"http\" WHERE (\"battery_instant_power\" < 0) AND $timeFilter GROUP BY time(1d) fill(0)", 174 | "rawQuery": true, 175 | "refId": "B", 176 | "resultFormat": "time_series", 177 | "select": [ 178 | [ 179 | { 180 | "params": [ 181 | "battery_instant_power" 182 | ], 183 | "type": "field" 184 | }, 185 | { 186 | "params": [], 187 | "type": "count" 188 | } 189 | ] 190 | ], 191 | "tags": [ 192 | 193 | { 194 | 195 | "key": "battery_instant_power", 196 | "operator": "<", 197 | "value": "0" 198 | } 199 | ] 200 | } 201 | ], 202 | "thresholds": [], 203 | "timeFrom": null, 204 | "timeRegions": [], 205 | "timeShift": null, 206 | "title": "Battery Output", 207 | "tooltip": { 208 | "shared": true, 209 | "sort": 0, 210 | "value_type": "individual" 211 | }, 212 | "type": "graph", 213 | "xaxis": { 214 | "buckets": null, 215 | "mode": "time", 216 | "name": null, 217 | "show": true, 218 | "values": [] 219 | }, 220 | "yaxes": [ 221 | { 222 | "format": "watth", 223 | "label": null, 224 | "logBase": 1, 225 | "max": null, 226 | "min": null, 227 | "show": true 228 | }, 229 | { 230 | "format": "short", 231 | "label": null, 232 | "logBase": 1, 233 | "max": null, 234 | "min": null, 235 | "show": false 236 | } 237 | ], 238 | "yaxis": { 239 | "align": false, 240 | "alignLevel": null 241 | } 242 | }, 243 | { 244 | "aliasColors": {}, 245 | "bars": false, 246 | "dashLength": 10, 247 | "dashes": false, 248 | "datasource": "DS_POWERDATA", 249 | "fill": 1, 250 | "gridPos": { 251 | "h": 8, 252 | "w": 12, 253 | "x": 12, 254 | "y": 0 255 | }, 256 | "id": 18, 257 | "legend": { 258 | "alignAsTable": false, 259 | "avg": false, 260 | "current": false, 261 | "max": false, 262 | "min": false, 263 | "show": false, 264 | "total": false, 265 | "values": false 266 | }, 267 | "lines": true, 268 | "linewidth": 1, 269 | "links": [], 270 | "nullPointMode": "null", 271 | "options": {}, 272 | "percentage": false, 273 | "pointradius": 1, 274 | "points": false, 275 | "renderer": "flot", 276 | "seriesOverrides": [ 277 | { 278 | "alias": "http.battery", 279 | "color": "#56A64B" 280 | }, 281 | { 282 | "alias": "http.solar", 283 | "color": "#FFEE52" 284 | }, 285 | { 286 | "alias": "http.grid", 287 | "color": "rgb(133, 133, 133)" 288 | }, 289 | { 290 | "alias": "http.house", 291 | "color": "#3274D9" 292 | } 293 | ], 294 | "spaceLength": 10, 295 | "stack": false, 296 | "steppedLine": false, 297 | "targets": [ 298 | { 299 | "groupBy": [ 300 | { 301 | "params": [ 302 | "$__interval" 303 | ], 304 | "type": "time" 305 | }, 306 | { 307 | "params": [ 308 | "none" 309 | ], 310 | "type": "fill" 311 | } 312 | ], 313 | "measurement": "http", 314 | "orderByTime": "ASC", 315 | "policy": "default", 316 | "refId": "A", 317 | "resultFormat": "time_series", 318 | "select": [ 319 | [ 320 | { 321 | "params": [ 322 | "load_instant_power" 323 | ], 324 | "type": "field" 325 | }, 326 | { 327 | "params": [], 328 | "type": "mean" 329 | }, 330 | { 331 | "params": [ 332 | "house" 333 | ], 334 | "type": "alias" 335 | } 336 | ] 337 | ], 338 | "tags": [ 339 | 340 | ] 341 | } 342 | ], 343 | "thresholds": [], 344 | "timeFrom": null, 345 | "timeRegions": [], 346 | "timeShift": null, 347 | "title": "House Output", 348 | "tooltip": { 349 | "shared": true, 350 | "sort": 0, 351 | "value_type": "individual" 352 | }, 353 | "type": "graph", 354 | "xaxis": { 355 | "buckets": null, 356 | "mode": "time", 357 | "name": null, 358 | "show": true, 359 | "values": [] 360 | }, 361 | "yaxes": [ 362 | { 363 | "format": "watth", 364 | "label": null, 365 | "logBase": 1, 366 | "max": null, 367 | "min": null, 368 | "show": true 369 | }, 370 | { 371 | "format": "short", 372 | "label": null, 373 | "logBase": 1, 374 | "max": null, 375 | "min": null, 376 | "show": false 377 | } 378 | ], 379 | "yaxis": { 380 | "align": false, 381 | "alignLevel": null 382 | } 383 | }, 384 | { 385 | "aliasColors": {}, 386 | "bars": false, 387 | "dashLength": 10, 388 | "dashes": false, 389 | "datasource": "DS_POWERDATA", 390 | "fill": 1, 391 | "gridPos": { 392 | "h": 9, 393 | "w": 12, 394 | "x": 0, 395 | "y": 8 396 | }, 397 | "id": 3, 398 | "interval": "", 399 | "legend": { 400 | "alignAsTable": false, 401 | "avg": false, 402 | "current": false, 403 | "max": false, 404 | "min": false, 405 | "show": false, 406 | "total": false, 407 | "values": false 408 | }, 409 | "lines": true, 410 | "linewidth": 1, 411 | "links": [], 412 | "nullPointMode": "null", 413 | "options": {}, 414 | "percentage": false, 415 | "pointradius": 1, 416 | "points": false, 417 | "renderer": "flot", 418 | "seriesOverrides": [ 419 | { 420 | "alias": "http.battery", 421 | "color": "#56A64B" 422 | }, 423 | { 424 | "alias": "http.solar", 425 | "color": "#FFEE52" 426 | }, 427 | { 428 | "alias": "http.grid", 429 | "color": "rgb(133, 133, 133)" 430 | } 431 | ], 432 | "spaceLength": 10, 433 | "stack": false, 434 | "steppedLine": false, 435 | "targets": [ 436 | { 437 | "groupBy": [ 438 | { 439 | "params": [ 440 | "$__interval" 441 | ], 442 | "type": "time" 443 | }, 444 | { 445 | "params": [ 446 | "none" 447 | ], 448 | "type": "fill" 449 | } 450 | ], 451 | "limit": "", 452 | "measurement": "http", 453 | "orderByTime": "ASC", 454 | "policy": "default", 455 | "refId": "A", 456 | "resultFormat": "time_series", 457 | "select": [ 458 | [ 459 | { 460 | "params": [ 461 | "solar_instant_power" 462 | ], 463 | "type": "field" 464 | }, 465 | { 466 | "params": [], 467 | "type": "mean" 468 | }, 469 | { 470 | "params": [ 471 | "solar" 472 | ], 473 | "type": "alias" 474 | } 475 | ] 476 | ], 477 | "tags": [ 478 | 479 | ] 480 | } 481 | ], 482 | "thresholds": [], 483 | "timeFrom": null, 484 | "timeRegions": [], 485 | "timeShift": null, 486 | "title": "Solar Output", 487 | "tooltip": { 488 | "shared": true, 489 | "sort": 0, 490 | "value_type": "individual" 491 | }, 492 | "type": "graph", 493 | "xaxis": { 494 | "buckets": null, 495 | "mode": "time", 496 | "name": null, 497 | "show": true, 498 | "values": [] 499 | }, 500 | "yaxes": [ 501 | { 502 | "format": "watth", 503 | "label": null, 504 | "logBase": 1, 505 | "max": null, 506 | "min": null, 507 | "show": true 508 | }, 509 | { 510 | "format": "short", 511 | "label": null, 512 | "logBase": 1, 513 | "max": null, 514 | "min": null, 515 | "show": false 516 | } 517 | ], 518 | "yaxis": { 519 | "align": false, 520 | "alignLevel": null 521 | } 522 | }, 523 | { 524 | "cacheTimeout": null, 525 | "colorBackground": false, 526 | "colorValue": true, 527 | "colors": [ 528 | "#d44a3a", 529 | "rgba(237, 129, 40, 0.89)", 530 | "#3274D9" 531 | ], 532 | "datasource": "DS_POWERDATA", 533 | "format": "watth", 534 | "gauge": { 535 | "maxValue": 100, 536 | "minValue": 0, 537 | "show": false, 538 | "thresholdLabels": false, 539 | "thresholdMarkers": true 540 | }, 541 | "gridPos": { 542 | "h": 3, 543 | "w": 6, 544 | "x": 12, 545 | "y": 8 546 | }, 547 | "id": 9, 548 | "interval": null, 549 | "links": [], 550 | "mappingType": 1, 551 | "mappingTypes": [ 552 | { 553 | "name": "value to text", 554 | "value": 1 555 | }, 556 | { 557 | "name": "range to text", 558 | "value": 2 559 | } 560 | ], 561 | "maxDataPoints": 100, 562 | "nullPointMode": "connected", 563 | "nullText": null, 564 | "options": {}, 565 | "postfix": "", 566 | "postfixFontSize": "50%", 567 | "prefix": "", 568 | "prefixFontSize": "50%", 569 | "rangeMaps": [ 570 | { 571 | "from": "null", 572 | "text": "N/A", 573 | "to": "null" 574 | } 575 | ], 576 | "sparkline": { 577 | "fillColor": "rgba(31, 118, 189, 0.18)", 578 | "full": false, 579 | "lineColor": "rgb(31, 120, 193)", 580 | "show": false 581 | }, 582 | "tableColumn": "mean", 583 | "targets": [ 584 | { 585 | "groupBy": [ 586 | { 587 | "params": [ 588 | "1h" 589 | ], 590 | "type": "time" 591 | }, 592 | { 593 | "params": [ 594 | "none" 595 | ], 596 | "type": "fill" 597 | } 598 | ], 599 | "limit": "", 600 | "measurement": "http", 601 | "orderByTime": "ASC", 602 | "policy": "default", 603 | "refId": "A", 604 | "resultFormat": "time_series", 605 | "select": [ 606 | [ 607 | { 608 | "params": [ 609 | "load_instant_power" 610 | ], 611 | "type": "field" 612 | }, 613 | { 614 | "params": [], 615 | "type": "mean" 616 | } 617 | ] 618 | ], 619 | "slimit": "", 620 | "tags": [ 621 | 622 | ] 623 | } 624 | ], 625 | "thresholds": "0,1", 626 | "timeFrom": null, 627 | "timeShift": null, 628 | "title": "Total House Usage", 629 | "type": "singlestat", 630 | "valueFontSize": "110%", 631 | "valueMaps": [], 632 | "valueName": "total" 633 | }, 634 | { 635 | "cacheTimeout": null, 636 | "colorBackground": false, 637 | "colorValue": false, 638 | "colors": [ 639 | "#299c46", 640 | "rgba(237, 129, 40, 0.89)", 641 | "#d44a3a" 642 | ], 643 | "datasource": "DS_POWERDATA", 644 | "format": "farenheit", 645 | "gauge": { 646 | "maxValue": 100, 647 | "minValue": 0, 648 | "show": false, 649 | "thresholdLabels": false, 650 | "thresholdMarkers": true 651 | }, 652 | "gridPos": { 653 | "h": 3, 654 | "w": 3, 655 | "x": 18, 656 | "y": 8 657 | }, 658 | "id": 15, 659 | "interval": null, 660 | "links": [], 661 | "mappingType": 1, 662 | "mappingTypes": [ 663 | { 664 | "name": "value to text", 665 | "value": 1 666 | }, 667 | { 668 | "name": "range to text", 669 | "value": 2 670 | } 671 | ], 672 | "maxDataPoints": 100, 673 | "nullPointMode": "connected", 674 | "nullText": null, 675 | "options": {}, 676 | "postfix": "", 677 | "postfixFontSize": "50%", 678 | "prefix": "", 679 | "prefixFontSize": "50%", 680 | "rangeMaps": [ 681 | { 682 | "from": "null", 683 | "text": "N/A", 684 | "to": "null" 685 | } 686 | ], 687 | "sparkline": { 688 | "fillColor": "rgba(31, 118, 189, 0.18)", 689 | "full": false, 690 | "lineColor": "rgb(31, 120, 193)", 691 | "show": false 692 | }, 693 | "tableColumn": "", 694 | "targets": [ 695 | { 696 | "groupBy": [ 697 | { 698 | "params": [ 699 | "$__interval" 700 | ], 701 | "type": "time" 702 | }, 703 | { 704 | "params": [ 705 | "null" 706 | ], 707 | "type": "fill" 708 | } 709 | ], 710 | "measurement": "weather", 711 | "orderByTime": "ASC", 712 | "policy": "default", 713 | "query": "SELECT ((mean(\"main_temp\") * 1.8) + 32 ) FROM \"weather\" WHERE time >= ${__from}ms and time <= ${__to}ms", 714 | "rawQuery": true, 715 | "refId": "A", 716 | "resultFormat": "time_series", 717 | "select": [ 718 | [ 719 | { 720 | "params": [ 721 | "main_temp" 722 | ], 723 | "type": "field" 724 | }, 725 | { 726 | "params": [], 727 | "type": "mean" 728 | } 729 | ] 730 | ], 731 | "tags": [ 732 | { 733 | "key": "url", 734 | "operator": "=", 735 | "value": "*" 736 | } 737 | ] 738 | } 739 | ], 740 | "thresholds": "", 741 | "timeFrom": null, 742 | "timeShift": null, 743 | "title": "Avg. Temp", 744 | "type": "singlestat", 745 | "valueFontSize": "80%", 746 | "valueMaps": [ 747 | { 748 | "op": "=", 749 | "text": "N/A", 750 | "value": "null" 751 | } 752 | ], 753 | "valueName": "avg" 754 | }, 755 | { 756 | "cacheTimeout": null, 757 | "colorBackground": false, 758 | "colorValue": false, 759 | "colors": [ 760 | "#299c46", 761 | "rgba(237, 129, 40, 0.89)", 762 | "#d44a3a" 763 | ], 764 | "datasource": "DS_POWERDATA", 765 | "format": "percent", 766 | "gauge": { 767 | "maxValue": 100, 768 | "minValue": 0, 769 | "show": false, 770 | "thresholdLabels": false, 771 | "thresholdMarkers": true 772 | }, 773 | "gridPos": { 774 | "h": 3, 775 | "w": 3, 776 | "x": 21, 777 | "y": 8 778 | }, 779 | "id": 11, 780 | "interval": null, 781 | "links": [], 782 | "mappingType": 1, 783 | "mappingTypes": [ 784 | { 785 | "name": "value to text", 786 | "value": 1 787 | }, 788 | { 789 | "name": "range to text", 790 | "value": 2 791 | } 792 | ], 793 | "maxDataPoints": 100, 794 | "nullPointMode": "connected", 795 | "nullText": null, 796 | "options": {}, 797 | "postfix": "", 798 | "postfixFontSize": "50%", 799 | "prefix": "", 800 | "prefixFontSize": "50%", 801 | "rangeMaps": [ 802 | { 803 | "from": "null", 804 | "text": "N/A", 805 | "to": "null" 806 | } 807 | ], 808 | "sparkline": { 809 | "fillColor": "rgba(31, 118, 189, 0.18)", 810 | "full": false, 811 | "lineColor": "rgb(31, 120, 193)", 812 | "show": false 813 | }, 814 | "tableColumn": "", 815 | "targets": [ 816 | { 817 | "groupBy": [ 818 | { 819 | "params": [ 820 | "1h" 821 | ], 822 | "type": "time" 823 | }, 824 | { 825 | "params": [ 826 | "none" 827 | ], 828 | "type": "fill" 829 | } 830 | ], 831 | "measurement": "weather", 832 | "orderByTime": "ASC", 833 | "policy": "default", 834 | "query": "SELECT mean(\"clouds_all\") FROM \"weather\" WHERE time >= ${__from}ms and time <= ${__to}ms GROUP BY time(1h) fill(none)", 835 | "rawQuery": true, 836 | "refId": "A", 837 | "resultFormat": "time_series", 838 | "select": [ 839 | [ 840 | { 841 | "params": [ 842 | "clouds_all" 843 | ], 844 | "type": "field" 845 | }, 846 | { 847 | "params": [], 848 | "type": "mean" 849 | } 850 | ] 851 | ], 852 | "tags": [ 853 | { 854 | "key": "url", 855 | "operator": "=", 856 | "value": "https://fcc-weather-api.glitch.me/api/current?lat=36.2452052&lon=-113.7292593" 857 | } 858 | ] 859 | } 860 | ], 861 | "thresholds": "", 862 | "timeFrom": null, 863 | "timeShift": null, 864 | "title": "Avg. Cloud Cover", 865 | "type": "singlestat", 866 | "valueFontSize": "110%", 867 | "valueMaps": [ 868 | { 869 | "op": "=", 870 | "text": "N/A", 871 | "value": "null" 872 | } 873 | ], 874 | "valueName": "avg" 875 | }, 876 | { 877 | "cacheTimeout": null, 878 | "colorBackground": false, 879 | "colorValue": true, 880 | "colors": [ 881 | "#299c46", 882 | "rgba(237, 129, 40, 0.89)", 883 | "#FFEE52" 884 | ], 885 | "datasource": "DS_POWERDATA", 886 | "format": "watth", 887 | "gauge": { 888 | "maxValue": 60000, 889 | "minValue": 0, 890 | "show": false, 891 | "thresholdLabels": false, 892 | "thresholdMarkers": false 893 | }, 894 | "gridPos": { 895 | "h": 3, 896 | "w": 4, 897 | "x": 12, 898 | "y": 11 899 | }, 900 | "id": 7, 901 | "interval": null, 902 | "links": [], 903 | "mappingType": 1, 904 | "mappingTypes": [ 905 | { 906 | "name": "value to text", 907 | "value": 1 908 | }, 909 | { 910 | "name": "range to text", 911 | "value": 2 912 | } 913 | ], 914 | "maxDataPoints": 100, 915 | "nullPointMode": "connected", 916 | "nullText": null, 917 | "options": {}, 918 | "postfix": "", 919 | "postfixFontSize": "50%", 920 | "prefix": "", 921 | "prefixFontSize": "50%", 922 | "rangeMaps": [ 923 | { 924 | "from": "null", 925 | "text": "N/A", 926 | "to": "null" 927 | } 928 | ], 929 | "sparkline": { 930 | "fillColor": "rgba(31, 118, 189, 0.18)", 931 | "full": true, 932 | "lineColor": "rgb(31, 120, 193)", 933 | "show": false 934 | }, 935 | "tableColumn": "", 936 | "targets": [ 937 | { 938 | "groupBy": [ 939 | { 940 | "params": [ 941 | "1h" 942 | ], 943 | "type": "time" 944 | }, 945 | { 946 | "params": [ 947 | "none" 948 | ], 949 | "type": "fill" 950 | } 951 | ], 952 | "measurement": "http", 953 | "orderByTime": "ASC", 954 | "policy": "default", 955 | "refId": "A", 956 | "resultFormat": "time_series", 957 | "select": [ 958 | [ 959 | { 960 | "params": [ 961 | "solar_instant_power" 962 | ], 963 | "type": "field" 964 | }, 965 | { 966 | "params": [], 967 | "type": "mean" 968 | } 969 | ] 970 | ], 971 | "tags": [ 972 | 973 | ] 974 | } 975 | ], 976 | "thresholds": "0,1", 977 | "timeFrom": null, 978 | "timeShift": null, 979 | "title": "Total Solar Generated", 980 | "type": "singlestat", 981 | "valueFontSize": "120%", 982 | "valueMaps": [ 983 | { 984 | "op": "=", 985 | "text": "N/A", 986 | "value": "null" 987 | } 988 | ], 989 | "valueName": "total" 990 | }, 991 | { 992 | "aliasColors": { 993 | "Battery": "#56A64B", 994 | "Grid": "#969696" 995 | }, 996 | "breakPoint": "50%", 997 | "cacheTimeout": null, 998 | "combine": { 999 | "label": "Others", 1000 | "threshold": 0 1001 | }, 1002 | "datasource": "DS_POWERDATA", 1003 | "fontSize": "80%", 1004 | "format": "watth", 1005 | "gridPos": { 1006 | "h": 6, 1007 | "w": 4, 1008 | "x": 16, 1009 | "y": 11 1010 | }, 1011 | "id": 24, 1012 | "interval": null, 1013 | "legend": { 1014 | "percentage": true, 1015 | "show": true, 1016 | "values": false 1017 | }, 1018 | "legendType": "On graph", 1019 | "links": [], 1020 | "maxDataPoints": 3, 1021 | "nullPointMode": "connected", 1022 | "options": {}, 1023 | "pieType": "donut", 1024 | "strokeWidth": 1, 1025 | "targets": [ 1026 | { 1027 | "alias": "Battery", 1028 | "groupBy": [ 1029 | { 1030 | "params": [ 1031 | "1h" 1032 | ], 1033 | "type": "time" 1034 | }, 1035 | { 1036 | "params": [ 1037 | "null" 1038 | ], 1039 | "type": "fill" 1040 | } 1041 | ], 1042 | "hide": false, 1043 | "measurement": "http", 1044 | "orderByTime": "ASC", 1045 | "policy": "default", 1046 | "refId": "A", 1047 | "resultFormat": "time_series", 1048 | "select": [ 1049 | [ 1050 | { 1051 | "params": [ 1052 | "battery_instant_power" 1053 | ], 1054 | "type": "field" 1055 | }, 1056 | { 1057 | "params": [], 1058 | "type": "mean" 1059 | } 1060 | ] 1061 | ], 1062 | "tags": [ 1063 | 1064 | { 1065 | 1066 | "key": "battery_instant_power", 1067 | "operator": "<", 1068 | "value": "0" 1069 | } 1070 | ] 1071 | }, 1072 | { 1073 | "alias": "Grid", 1074 | "groupBy": [ 1075 | { 1076 | "params": [ 1077 | "1h" 1078 | ], 1079 | "type": "time" 1080 | }, 1081 | { 1082 | "params": [ 1083 | "null" 1084 | ], 1085 | "type": "fill" 1086 | } 1087 | ], 1088 | "hide": false, 1089 | "measurement": "http", 1090 | "orderByTime": "ASC", 1091 | "policy": "default", 1092 | "refId": "B", 1093 | "resultFormat": "time_series", 1094 | "select": [ 1095 | [ 1096 | { 1097 | "params": [ 1098 | "site_instant_power" 1099 | ], 1100 | "type": "field" 1101 | }, 1102 | { 1103 | "params": [], 1104 | "type": "mean" 1105 | } 1106 | ] 1107 | ], 1108 | "tags": [ 1109 | 1110 | { 1111 | 1112 | "key": "site_instant_power", 1113 | "operator": "<", 1114 | "value": "0" 1115 | } 1116 | ] 1117 | }, 1118 | { 1119 | "alias": "House", 1120 | "groupBy": [ 1121 | { 1122 | "params": [ 1123 | "1h" 1124 | ], 1125 | "type": "time" 1126 | }, 1127 | { 1128 | "params": [ 1129 | "null" 1130 | ], 1131 | "type": "fill" 1132 | } 1133 | ], 1134 | "hide": true, 1135 | "measurement": "http", 1136 | "orderByTime": "ASC", 1137 | "policy": "default", 1138 | "refId": "C", 1139 | "resultFormat": "time_series", 1140 | "select": [ 1141 | [ 1142 | { 1143 | "params": [ 1144 | "load_instant_power" 1145 | ], 1146 | "type": "field" 1147 | }, 1148 | { 1149 | "params": [], 1150 | "type": "mean" 1151 | } 1152 | ] 1153 | ], 1154 | "tags": [ 1155 | 1156 | { 1157 | 1158 | "key": "solar_instant_power", 1159 | "operator": ">", 1160 | "value": "0" 1161 | } 1162 | ] 1163 | } 1164 | ], 1165 | "timeFrom": null, 1166 | "timeShift": null, 1167 | "title": "Solar Export", 1168 | "type": "grafana-piechart-panel", 1169 | "valueName": "current" 1170 | }, 1171 | { 1172 | "aliasColors": { 1173 | "Battery": "#56A64B", 1174 | "Grid": "rgb(186, 186, 186)", 1175 | "Solar": "#FFEE52" 1176 | }, 1177 | "breakPoint": "50%", 1178 | "cacheTimeout": null, 1179 | "combine": { 1180 | "label": "Others", 1181 | "threshold": 0 1182 | }, 1183 | "datasource": "DS_POWERDATA", 1184 | "decimals": null, 1185 | "fontSize": "70%", 1186 | "format": "watth", 1187 | "gridPos": { 1188 | "h": 6, 1189 | "w": 4, 1190 | "x": 20, 1191 | "y": 11 1192 | }, 1193 | "id": 20, 1194 | "interval": null, 1195 | "legend": { 1196 | "header": "", 1197 | "percentage": true, 1198 | "show": true, 1199 | "values": false 1200 | }, 1201 | "legendType": "On graph", 1202 | "links": [], 1203 | "maxDataPoints": 3, 1204 | "nullPointMode": "connected", 1205 | "options": {}, 1206 | "pieType": "donut", 1207 | "strokeWidth": ".5", 1208 | "targets": [ 1209 | { 1210 | "alias": "Solar", 1211 | "groupBy": [ 1212 | { 1213 | "params": [ 1214 | "1h" 1215 | ], 1216 | "type": "time" 1217 | }, 1218 | { 1219 | "params": [ 1220 | "none" 1221 | ], 1222 | "type": "fill" 1223 | } 1224 | ], 1225 | "measurement": "http", 1226 | "orderByTime": "ASC", 1227 | "policy": "default", 1228 | "refId": "A", 1229 | "resultFormat": "time_series", 1230 | "select": [ 1231 | [ 1232 | { 1233 | "params": [ 1234 | "solar_instant_power" 1235 | ], 1236 | "type": "field" 1237 | }, 1238 | { 1239 | "params": [], 1240 | "type": "mean" 1241 | }, 1242 | { 1243 | "params": [ 1244 | "solar" 1245 | ], 1246 | "type": "alias" 1247 | } 1248 | ] 1249 | ], 1250 | "tags": [ 1251 | 1252 | ] 1253 | }, 1254 | { 1255 | "alias": "Battery", 1256 | "groupBy": [ 1257 | { 1258 | "params": [ 1259 | "1h" 1260 | ], 1261 | "type": "time" 1262 | }, 1263 | { 1264 | "params": [ 1265 | "null" 1266 | ], 1267 | "type": "fill" 1268 | } 1269 | ], 1270 | "measurement": "http", 1271 | "orderByTime": "ASC", 1272 | "policy": "default", 1273 | "refId": "B", 1274 | "resultFormat": "time_series", 1275 | "select": [ 1276 | [ 1277 | { 1278 | "params": [ 1279 | "battery_instant_power" 1280 | ], 1281 | "type": "field" 1282 | }, 1283 | { 1284 | "params": [], 1285 | "type": "mean" 1286 | } 1287 | ] 1288 | ], 1289 | "tags": [ 1290 | 1291 | { 1292 | 1293 | "key": "battery_instant_power", 1294 | "operator": ">", 1295 | "value": "0" 1296 | } 1297 | ] 1298 | }, 1299 | { 1300 | "alias": "Grid", 1301 | "groupBy": [ 1302 | { 1303 | "params": [ 1304 | "1h" 1305 | ], 1306 | "type": "time" 1307 | }, 1308 | { 1309 | "params": [ 1310 | "none" 1311 | ], 1312 | "type": "fill" 1313 | } 1314 | ], 1315 | "measurement": "http", 1316 | "orderByTime": "ASC", 1317 | "policy": "default", 1318 | "refId": "C", 1319 | "resultFormat": "time_series", 1320 | "select": [ 1321 | [ 1322 | { 1323 | "params": [ 1324 | "site_instant_power" 1325 | ], 1326 | "type": "field" 1327 | }, 1328 | { 1329 | "params": [], 1330 | "type": "mean" 1331 | }, 1332 | { 1333 | "params": [ 1334 | "grid" 1335 | ], 1336 | "type": "alias" 1337 | } 1338 | ] 1339 | ], 1340 | "tags": [ 1341 | 1342 | ] 1343 | } 1344 | ], 1345 | "timeFrom": null, 1346 | "timeShift": null, 1347 | "title": "Power Breakdown", 1348 | "type": "grafana-piechart-panel", 1349 | "valueName": "total" 1350 | }, 1351 | { 1352 | "cacheTimeout": null, 1353 | "colorBackground": false, 1354 | "colorValue": true, 1355 | "colors": [ 1356 | "#299c46", 1357 | "#56A64B", 1358 | "#56A64B" 1359 | ], 1360 | "datasource": "DS_POWERDATA", 1361 | "format": "watth", 1362 | "gauge": { 1363 | "maxValue": 100, 1364 | "minValue": 0, 1365 | "show": false, 1366 | "thresholdLabels": false, 1367 | "thresholdMarkers": true 1368 | }, 1369 | "gridPos": { 1370 | "h": 3, 1371 | "w": 4, 1372 | "x": 12, 1373 | "y": 14 1374 | }, 1375 | "id": 6, 1376 | "interval": null, 1377 | "links": [], 1378 | "mappingType": 1, 1379 | "mappingTypes": [ 1380 | { 1381 | "name": "value to text", 1382 | "value": 1 1383 | }, 1384 | { 1385 | "name": "range to text", 1386 | "value": 2 1387 | } 1388 | ], 1389 | "maxDataPoints": 100, 1390 | "nullPointMode": "connected", 1391 | "nullText": null, 1392 | "options": {}, 1393 | "postfix": "", 1394 | "postfixFontSize": "50%", 1395 | "prefix": "", 1396 | "prefixFontSize": "50%", 1397 | "rangeMaps": [ 1398 | { 1399 | "from": "null", 1400 | "text": "N/A", 1401 | "to": "null" 1402 | } 1403 | ], 1404 | "sparkline": { 1405 | "fillColor": "rgba(31, 118, 189, 0.18)", 1406 | "full": false, 1407 | "lineColor": "rgb(31, 120, 193)", 1408 | "show": false 1409 | }, 1410 | "tableColumn": "", 1411 | "targets": [ 1412 | { 1413 | "groupBy": [ 1414 | { 1415 | "params": [ 1416 | "1h" 1417 | ], 1418 | "type": "time" 1419 | }, 1420 | { 1421 | "params": [ 1422 | "none" 1423 | ], 1424 | "type": "fill" 1425 | } 1426 | ], 1427 | "measurement": "http", 1428 | "orderByTime": "ASC", 1429 | "policy": "default", 1430 | "query": "SELECT mean(\"battery_instant_power\") FROM \"http\" WHERE (\"battery_instant_power\" > 0) AND $timeFilter GROUP BY time(1h) fill(none)", 1431 | "rawQuery": false, 1432 | "refId": "A", 1433 | "resultFormat": "time_series", 1434 | "select": [ 1435 | [ 1436 | { 1437 | "params": [ 1438 | "battery_instant_power" 1439 | ], 1440 | "type": "field" 1441 | }, 1442 | { 1443 | "params": [], 1444 | "type": "mean" 1445 | } 1446 | ] 1447 | ], 1448 | "tags": [ 1449 | 1450 | { 1451 | 1452 | "key": "battery_instant_power", 1453 | "operator": ">", 1454 | "value": "0" 1455 | } 1456 | ] 1457 | } 1458 | ], 1459 | "thresholds": "0,1", 1460 | "timeFrom": null, 1461 | "timeShift": null, 1462 | "title": "Total Battery Use", 1463 | "type": "singlestat", 1464 | "valueFontSize": "110%", 1465 | "valueMaps": [ 1466 | { 1467 | "op": "=", 1468 | "text": "N/A", 1469 | "value": "null" 1470 | } 1471 | ], 1472 | "valueName": "total" 1473 | }, 1474 | { 1475 | "aliasColors": {}, 1476 | "bars": false, 1477 | "dashLength": 10, 1478 | "dashes": false, 1479 | "datasource": "DS_POWERDATA", 1480 | "fill": 1, 1481 | "gridPos": { 1482 | "h": 8, 1483 | "w": 12, 1484 | "x": 0, 1485 | "y": 17 1486 | }, 1487 | "id": 4, 1488 | "legend": { 1489 | "alignAsTable": false, 1490 | "avg": false, 1491 | "current": false, 1492 | "max": false, 1493 | "min": false, 1494 | "show": false, 1495 | "total": false, 1496 | "values": false 1497 | }, 1498 | "lines": true, 1499 | "linewidth": 1, 1500 | "links": [], 1501 | "nullPointMode": "null", 1502 | "options": {}, 1503 | "percentage": false, 1504 | "pointradius": 1, 1505 | "points": false, 1506 | "renderer": "flot", 1507 | "seriesOverrides": [ 1508 | { 1509 | "alias": "http.battery", 1510 | "color": "#56A64B" 1511 | }, 1512 | { 1513 | "alias": "http.solar", 1514 | "color": "#FFEE52" 1515 | }, 1516 | { 1517 | "alias": "http.grid", 1518 | "color": "rgb(133, 133, 133)" 1519 | } 1520 | ], 1521 | "spaceLength": 10, 1522 | "stack": false, 1523 | "steppedLine": false, 1524 | "targets": [ 1525 | { 1526 | "groupBy": [ 1527 | { 1528 | "params": [ 1529 | "$__interval" 1530 | ], 1531 | "type": "time" 1532 | }, 1533 | { 1534 | "params": [ 1535 | "none" 1536 | ], 1537 | "type": "fill" 1538 | } 1539 | ], 1540 | "measurement": "http", 1541 | "orderByTime": "ASC", 1542 | "policy": "default", 1543 | "refId": "A", 1544 | "resultFormat": "time_series", 1545 | "select": [ 1546 | [ 1547 | { 1548 | "params": [ 1549 | "site_instant_power" 1550 | ], 1551 | "type": "field" 1552 | }, 1553 | { 1554 | "params": [], 1555 | "type": "mean" 1556 | }, 1557 | { 1558 | "params": [ 1559 | "grid" 1560 | ], 1561 | "type": "alias" 1562 | } 1563 | ] 1564 | ], 1565 | "tags": [ 1566 | 1567 | ] 1568 | } 1569 | ], 1570 | "thresholds": [], 1571 | "timeFrom": null, 1572 | "timeRegions": [], 1573 | "timeShift": null, 1574 | "title": "Grid Output", 1575 | "tooltip": { 1576 | "shared": true, 1577 | "sort": 0, 1578 | "value_type": "individual" 1579 | }, 1580 | "type": "graph", 1581 | "xaxis": { 1582 | "buckets": null, 1583 | "mode": "time", 1584 | "name": null, 1585 | "show": true, 1586 | "values": [] 1587 | }, 1588 | "yaxes": [ 1589 | { 1590 | "format": "watth", 1591 | "label": null, 1592 | "logBase": 1, 1593 | "max": null, 1594 | "min": null, 1595 | "show": true 1596 | }, 1597 | { 1598 | "format": "short", 1599 | "label": null, 1600 | "logBase": 1, 1601 | "max": null, 1602 | "min": null, 1603 | "show": false 1604 | } 1605 | ], 1606 | "yaxis": { 1607 | "align": false, 1608 | "alignLevel": null 1609 | } 1610 | }, 1611 | { 1612 | "cacheTimeout": null, 1613 | "colorBackground": false, 1614 | "colorValue": false, 1615 | "colors": [ 1616 | "#299c46", 1617 | "rgba(237, 129, 40, 0.89)", 1618 | "#d44a3a" 1619 | ], 1620 | "datasource": "DS_POWERDATA", 1621 | "decimals": 2, 1622 | "format": "currencyUSD", 1623 | "gauge": { 1624 | "maxValue": 100, 1625 | "minValue": 0, 1626 | "show": false, 1627 | "thresholdLabels": false, 1628 | "thresholdMarkers": true 1629 | }, 1630 | "gridPos": { 1631 | "h": 2, 1632 | "w": 4, 1633 | "x": 12, 1634 | "y": 17 1635 | }, 1636 | "id": 8, 1637 | "interval": null, 1638 | "links": [], 1639 | "mappingType": 1, 1640 | "mappingTypes": [ 1641 | { 1642 | "name": "value to text", 1643 | "value": 1 1644 | }, 1645 | { 1646 | "name": "range to text", 1647 | "value": 2 1648 | } 1649 | ], 1650 | "maxDataPoints": 100, 1651 | "nullPointMode": "connected", 1652 | "nullText": null, 1653 | "options": {}, 1654 | "postfix": "", 1655 | "postfixFontSize": "50%", 1656 | "prefix": "", 1657 | "prefixFontSize": "50%", 1658 | "rangeMaps": [ 1659 | { 1660 | "from": "null", 1661 | "text": "N/A", 1662 | "to": "null" 1663 | } 1664 | ], 1665 | "sparkline": { 1666 | "fillColor": "rgba(31, 118, 189, 0.18)", 1667 | "full": false, 1668 | "lineColor": "rgb(31, 120, 193)", 1669 | "show": false 1670 | }, 1671 | "tableColumn": "mean", 1672 | "targets": [ 1673 | { 1674 | "groupBy": [ 1675 | { 1676 | "params": [ 1677 | "1h" 1678 | ], 1679 | "type": "time" 1680 | }, 1681 | { 1682 | "params": [ 1683 | "none" 1684 | ], 1685 | "type": "fill" 1686 | } 1687 | ], 1688 | "limit": "", 1689 | "measurement": "http", 1690 | "orderByTime": "ASC", 1691 | "policy": "default", 1692 | "refId": "A", 1693 | "resultFormat": "time_series", 1694 | "select": [ 1695 | [ 1696 | { 1697 | "params": [ 1698 | "site_instant_power" 1699 | ], 1700 | "type": "field" 1701 | }, 1702 | { 1703 | "params": [], 1704 | "type": "mean" 1705 | }, 1706 | { 1707 | "params": [ 1708 | " / 1000 * 0.0993" 1709 | ], 1710 | "type": "math" 1711 | } 1712 | ] 1713 | ], 1714 | "slimit": "", 1715 | "tags": [ 1716 | 1717 | ] 1718 | } 1719 | ], 1720 | "thresholds": "", 1721 | "timeFrom": null, 1722 | "timeShift": null, 1723 | "title": "Net Grid Cost", 1724 | "type": "singlestat", 1725 | "valueFontSize": "80%", 1726 | "valueMaps": [ 1727 | { 1728 | "op": "=", 1729 | "text": "N/A", 1730 | "value": "null" 1731 | } 1732 | ], 1733 | "valueName": "total" 1734 | }, 1735 | { 1736 | "aliasColors": {}, 1737 | "bars": true, 1738 | "dashLength": 10, 1739 | "dashes": false, 1740 | "datasource": "DS_POWERDATA", 1741 | "fill": 1, 1742 | "gridPos": { 1743 | "h": 8, 1744 | "w": 8, 1745 | "x": 16, 1746 | "y": 17 1747 | }, 1748 | "id": 17, 1749 | "legend": { 1750 | "alignAsTable": true, 1751 | "avg": false, 1752 | "current": false, 1753 | "max": false, 1754 | "min": false, 1755 | "rightSide": true, 1756 | "show": false, 1757 | "total": true, 1758 | "values": true 1759 | }, 1760 | "lines": false, 1761 | "linewidth": 1, 1762 | "links": [], 1763 | "nullPointMode": "null as zero", 1764 | "options": {}, 1765 | "percentage": false, 1766 | "pointradius": 2, 1767 | "points": false, 1768 | "renderer": "flot", 1769 | "seriesOverrides": [ 1770 | { 1771 | "alias": "Solar", 1772 | "color": "#FFEE52" 1773 | }, 1774 | { 1775 | "alias": "Battery", 1776 | "color": "#56A64B" 1777 | }, 1778 | { 1779 | "alias": "Grid", 1780 | "color": "rgb(138, 138, 138)" 1781 | }, 1782 | { 1783 | "alias": "House", 1784 | "color": "#3274D9" 1785 | } 1786 | ], 1787 | "spaceLength": 10, 1788 | "stack": false, 1789 | "steppedLine": false, 1790 | "targets": [ 1791 | { 1792 | "alias": "House", 1793 | "groupBy": [ 1794 | { 1795 | "params": [ 1796 | "1h" 1797 | ], 1798 | "type": "time" 1799 | }, 1800 | { 1801 | "params": [ 1802 | "none" 1803 | ], 1804 | "type": "fill" 1805 | } 1806 | ], 1807 | "measurement": "http", 1808 | "orderByTime": "ASC", 1809 | "policy": "default", 1810 | "query": "SELECT mean(\"solar_instant_power\") AS \"solar\" FROM \"http\" WHERE $timeFilter GROUP BY time(1h) fill(none)", 1811 | "rawQuery": false, 1812 | "refId": "A", 1813 | "resultFormat": "time_series", 1814 | "select": [ 1815 | [ 1816 | { 1817 | "params": [ 1818 | "load_instant_power" 1819 | ], 1820 | "type": "field" 1821 | }, 1822 | { 1823 | "params": [], 1824 | "type": "mean" 1825 | } 1826 | ] 1827 | ], 1828 | "tags": [ 1829 | 1830 | ] 1831 | }, 1832 | { 1833 | "alias": "Solar", 1834 | "groupBy": [ 1835 | { 1836 | "params": [ 1837 | "1h" 1838 | ], 1839 | "type": "time" 1840 | }, 1841 | { 1842 | "params": [ 1843 | "none" 1844 | ], 1845 | "type": "fill" 1846 | } 1847 | ], 1848 | "measurement": "http", 1849 | "orderByTime": "ASC", 1850 | "policy": "default", 1851 | "refId": "B", 1852 | "resultFormat": "time_series", 1853 | "select": [ 1854 | [ 1855 | { 1856 | "params": [ 1857 | "solar_instant_power" 1858 | ], 1859 | "type": "field" 1860 | }, 1861 | { 1862 | "params": [], 1863 | "type": "mean" 1864 | }, 1865 | { 1866 | "params": [ 1867 | "battery" 1868 | ], 1869 | "type": "alias" 1870 | } 1871 | ] 1872 | ], 1873 | "tags": [ 1874 | 1875 | ] 1876 | }, 1877 | { 1878 | "alias": "Battery", 1879 | "groupBy": [ 1880 | { 1881 | "params": [ 1882 | "1h" 1883 | ], 1884 | "type": "time" 1885 | }, 1886 | { 1887 | "params": [ 1888 | "none" 1889 | ], 1890 | "type": "fill" 1891 | } 1892 | ], 1893 | "measurement": "http", 1894 | "orderByTime": "ASC", 1895 | "policy": "default", 1896 | "refId": "C", 1897 | "resultFormat": "time_series", 1898 | "select": [ 1899 | [ 1900 | { 1901 | "params": [ 1902 | "battery_instant_power" 1903 | ], 1904 | "type": "field" 1905 | }, 1906 | { 1907 | "params": [], 1908 | "type": "mean" 1909 | }, 1910 | { 1911 | "params": [ 1912 | "house" 1913 | ], 1914 | "type": "alias" 1915 | } 1916 | ] 1917 | ], 1918 | "tags": [ 1919 | 1920 | { 1921 | 1922 | "key": "battery_instant_power", 1923 | "operator": ">", 1924 | "value": "0" 1925 | } 1926 | ] 1927 | }, 1928 | { 1929 | "alias": "Grid", 1930 | "groupBy": [ 1931 | { 1932 | "params": [ 1933 | "1h" 1934 | ], 1935 | "type": "time" 1936 | }, 1937 | { 1938 | "params": [ 1939 | "none" 1940 | ], 1941 | "type": "fill" 1942 | } 1943 | ], 1944 | "measurement": "http", 1945 | "orderByTime": "ASC", 1946 | "policy": "default", 1947 | "refId": "D", 1948 | "resultFormat": "time_series", 1949 | "select": [ 1950 | [ 1951 | { 1952 | "params": [ 1953 | "site_instant_power" 1954 | ], 1955 | "type": "field" 1956 | }, 1957 | { 1958 | "params": [], 1959 | "type": "mean" 1960 | }, 1961 | { 1962 | "params": [ 1963 | "grid" 1964 | ], 1965 | "type": "alias" 1966 | } 1967 | ] 1968 | ], 1969 | "tags": [ 1970 | 1971 | ] 1972 | } 1973 | ], 1974 | "thresholds": [], 1975 | "timeFrom": null, 1976 | "timeRegions": [], 1977 | "timeShift": null, 1978 | "title": "Totals", 1979 | "tooltip": { 1980 | "shared": false, 1981 | "sort": 0, 1982 | "value_type": "individual" 1983 | }, 1984 | "type": "graph", 1985 | "xaxis": { 1986 | "buckets": null, 1987 | "mode": "series", 1988 | "name": null, 1989 | "show": true, 1990 | "values": [ 1991 | "total" 1992 | ] 1993 | }, 1994 | "yaxes": [ 1995 | { 1996 | "format": "watth", 1997 | "label": null, 1998 | "logBase": 1, 1999 | "max": null, 2000 | "min": null, 2001 | "show": true 2002 | }, 2003 | { 2004 | "format": "short", 2005 | "label": null, 2006 | "logBase": 1, 2007 | "max": null, 2008 | "min": null, 2009 | "show": false 2010 | } 2011 | ], 2012 | "yaxis": { 2013 | "align": false, 2014 | "alignLevel": null 2015 | } 2016 | }, 2017 | { 2018 | "cacheTimeout": null, 2019 | "colorBackground": false, 2020 | "colorValue": false, 2021 | "colors": [ 2022 | "#299c46", 2023 | "rgba(237, 129, 40, 0.89)", 2024 | "#d44a3a" 2025 | ], 2026 | "datasource": "DS_POWERDATA", 2027 | "format": "watth", 2028 | "gauge": { 2029 | "maxValue": 100, 2030 | "minValue": 0, 2031 | "show": false, 2032 | "thresholdLabels": false, 2033 | "thresholdMarkers": true 2034 | }, 2035 | "gridPos": { 2036 | "h": 2, 2037 | "w": 4, 2038 | "x": 12, 2039 | "y": 19 2040 | }, 2041 | "id": 25, 2042 | "interval": null, 2043 | "links": [], 2044 | "mappingType": 1, 2045 | "mappingTypes": [ 2046 | { 2047 | "name": "value to text", 2048 | "value": 1 2049 | }, 2050 | { 2051 | "name": "range to text", 2052 | "value": 2 2053 | } 2054 | ], 2055 | "maxDataPoints": 100, 2056 | "nullPointMode": "connected", 2057 | "nullText": null, 2058 | "options": {}, 2059 | "postfix": "", 2060 | "postfixFontSize": "50%", 2061 | "prefix": "", 2062 | "prefixFontSize": "50%", 2063 | "rangeMaps": [ 2064 | { 2065 | "from": "null", 2066 | "text": "N/A", 2067 | "to": "null" 2068 | } 2069 | ], 2070 | "sparkline": { 2071 | "fillColor": "rgba(31, 118, 189, 0.18)", 2072 | "full": false, 2073 | "lineColor": "rgb(31, 120, 193)", 2074 | "show": false 2075 | }, 2076 | "tableColumn": "mean", 2077 | "targets": [ 2078 | { 2079 | "groupBy": [ 2080 | { 2081 | "params": [ 2082 | "1h" 2083 | ], 2084 | "type": "time" 2085 | }, 2086 | { 2087 | "params": [ 2088 | "none" 2089 | ], 2090 | "type": "fill" 2091 | } 2092 | ], 2093 | "limit": "", 2094 | "measurement": "http", 2095 | "orderByTime": "ASC", 2096 | "policy": "default", 2097 | "refId": "A", 2098 | "resultFormat": "time_series", 2099 | "select": [ 2100 | [ 2101 | { 2102 | "params": [ 2103 | "site_instant_power" 2104 | ], 2105 | "type": "field" 2106 | }, 2107 | { 2108 | "params": [], 2109 | "type": "mean" 2110 | } 2111 | ] 2112 | ], 2113 | "slimit": "", 2114 | "tags": [ 2115 | 2116 | ] 2117 | } 2118 | ], 2119 | "thresholds": "", 2120 | "timeFrom": null, 2121 | "timeShift": null, 2122 | "title": "Net Grid Use", 2123 | "type": "singlestat", 2124 | "valueFontSize": "80%", 2125 | "valueMaps": [ 2126 | { 2127 | "op": "=", 2128 | "text": "N/A", 2129 | "value": "null" 2130 | } 2131 | ], 2132 | "valueName": "total" 2133 | }, 2134 | { 2135 | "cacheTimeout": null, 2136 | "colorBackground": false, 2137 | "colorValue": false, 2138 | "colors": [ 2139 | "#299c46", 2140 | "rgba(237, 129, 40, 0.89)", 2141 | "#d44a3a" 2142 | ], 2143 | "datasource": "DS_POWERDATA", 2144 | "format": "watth", 2145 | "gauge": { 2146 | "maxValue": 100, 2147 | "minValue": 0, 2148 | "show": false, 2149 | "thresholdLabels": false, 2150 | "thresholdMarkers": true 2151 | }, 2152 | "gridPos": { 2153 | "h": 2, 2154 | "w": 4, 2155 | "x": 12, 2156 | "y": 21 2157 | }, 2158 | "id": 21, 2159 | "interval": null, 2160 | "links": [], 2161 | "mappingType": 1, 2162 | "mappingTypes": [ 2163 | { 2164 | "name": "value to text", 2165 | "value": 1 2166 | }, 2167 | { 2168 | "name": "range to text", 2169 | "value": 2 2170 | } 2171 | ], 2172 | "maxDataPoints": 100, 2173 | "nullPointMode": "connected", 2174 | "nullText": null, 2175 | "options": {}, 2176 | "postfix": "", 2177 | "postfixFontSize": "50%", 2178 | "prefix": "", 2179 | "prefixFontSize": "50%", 2180 | "rangeMaps": [ 2181 | { 2182 | "from": "null", 2183 | "text": "N/A", 2184 | "to": "null" 2185 | } 2186 | ], 2187 | "sparkline": { 2188 | "fillColor": "rgba(31, 118, 189, 0.18)", 2189 | "full": false, 2190 | "lineColor": "rgb(31, 120, 193)", 2191 | "show": false 2192 | }, 2193 | "tableColumn": "mean", 2194 | "targets": [ 2195 | { 2196 | "groupBy": [ 2197 | { 2198 | "params": [ 2199 | "1h" 2200 | ], 2201 | "type": "time" 2202 | }, 2203 | { 2204 | "params": [ 2205 | "none" 2206 | ], 2207 | "type": "fill" 2208 | } 2209 | ], 2210 | "limit": "", 2211 | "measurement": "http", 2212 | "orderByTime": "ASC", 2213 | "policy": "default", 2214 | "refId": "A", 2215 | "resultFormat": "time_series", 2216 | "select": [ 2217 | [ 2218 | { 2219 | "params": [ 2220 | "site_instant_power" 2221 | ], 2222 | "type": "field" 2223 | }, 2224 | { 2225 | "params": [], 2226 | "type": "mean" 2227 | } 2228 | ] 2229 | ], 2230 | "slimit": "", 2231 | "tags": [ 2232 | 2233 | { 2234 | 2235 | "key": "site_instant_power", 2236 | "operator": ">", 2237 | "value": "0" 2238 | } 2239 | ] 2240 | } 2241 | ], 2242 | "thresholds": "", 2243 | "timeFrom": null, 2244 | "timeShift": null, 2245 | "title": "Total Grid Imported", 2246 | "type": "singlestat", 2247 | "valueFontSize": "80%", 2248 | "valueMaps": [ 2249 | { 2250 | "op": "=", 2251 | "text": "N/A", 2252 | "value": "null" 2253 | } 2254 | ], 2255 | "valueName": "total" 2256 | }, 2257 | { 2258 | "cacheTimeout": null, 2259 | "colorBackground": false, 2260 | "colorValue": false, 2261 | "colors": [ 2262 | "#299c46", 2263 | "rgba(237, 129, 40, 0.89)", 2264 | "#d44a3a" 2265 | ], 2266 | "datasource": "DS_POWERDATA", 2267 | "format": "watth", 2268 | "gauge": { 2269 | "maxValue": 100, 2270 | "minValue": 0, 2271 | "show": false, 2272 | "thresholdLabels": false, 2273 | "thresholdMarkers": true 2274 | }, 2275 | "gridPos": { 2276 | "h": 2, 2277 | "w": 4, 2278 | "x": 12, 2279 | "y": 23 2280 | }, 2281 | "id": 22, 2282 | "interval": null, 2283 | "links": [], 2284 | "mappingType": 1, 2285 | "mappingTypes": [ 2286 | { 2287 | "name": "value to text", 2288 | "value": 1 2289 | }, 2290 | { 2291 | "name": "range to text", 2292 | "value": 2 2293 | } 2294 | ], 2295 | "maxDataPoints": 100, 2296 | "nullPointMode": "connected", 2297 | "nullText": null, 2298 | "options": {}, 2299 | "postfix": "", 2300 | "postfixFontSize": "50%", 2301 | "prefix": "", 2302 | "prefixFontSize": "50%", 2303 | "rangeMaps": [ 2304 | { 2305 | "from": "null", 2306 | "text": "N/A", 2307 | "to": "null" 2308 | } 2309 | ], 2310 | "sparkline": { 2311 | "fillColor": "rgba(31, 118, 189, 0.18)", 2312 | "full": false, 2313 | "lineColor": "rgb(31, 120, 193)", 2314 | "show": false 2315 | }, 2316 | "tableColumn": "mean", 2317 | "targets": [ 2318 | { 2319 | "groupBy": [ 2320 | { 2321 | "params": [ 2322 | "1h" 2323 | ], 2324 | "type": "time" 2325 | }, 2326 | { 2327 | "params": [ 2328 | "none" 2329 | ], 2330 | "type": "fill" 2331 | } 2332 | ], 2333 | "limit": "", 2334 | "measurement": "http", 2335 | "orderByTime": "ASC", 2336 | "policy": "default", 2337 | "refId": "A", 2338 | "resultFormat": "time_series", 2339 | "select": [ 2340 | [ 2341 | { 2342 | "params": [ 2343 | "site_instant_power" 2344 | ], 2345 | "type": "field" 2346 | }, 2347 | { 2348 | "params": [], 2349 | "type": "mean" 2350 | } 2351 | ] 2352 | ], 2353 | "slimit": "", 2354 | "tags": [ 2355 | 2356 | { 2357 | 2358 | "key": "site_instant_power", 2359 | "operator": "<", 2360 | "value": "0" 2361 | } 2362 | ] 2363 | } 2364 | ], 2365 | "thresholds": "", 2366 | "timeFrom": null, 2367 | "timeShift": null, 2368 | "title": "Total Grid Exported", 2369 | "type": "singlestat", 2370 | "valueFontSize": "80%", 2371 | "valueMaps": [ 2372 | { 2373 | "op": "=", 2374 | "text": "N/A", 2375 | "value": "null" 2376 | } 2377 | ], 2378 | "valueName": "total" 2379 | } 2380 | ], 2381 | "refresh": false, 2382 | "schemaVersion": 18, 2383 | "style": "dark", 2384 | "tags": [], 2385 | "templating": { 2386 | "list": [] 2387 | }, 2388 | "time": { 2389 | "from": "now-12h", 2390 | "to": "now" 2391 | }, 2392 | "timepicker": { 2393 | "refresh_intervals": [ 2394 | "5s", 2395 | "10s", 2396 | "30s", 2397 | "1m", 2398 | "5m", 2399 | "15m", 2400 | "30m", 2401 | "1h", 2402 | "2h", 2403 | "1d" 2404 | ], 2405 | "time_options": [ 2406 | "5m", 2407 | "15m", 2408 | "1h", 2409 | "6h", 2410 | "12h", 2411 | "24h", 2412 | "2d", 2413 | "7d", 2414 | "30d" 2415 | ] 2416 | }, 2417 | "timezone": "browser", 2418 | "title": "Powerwall History", 2419 | "uid": "Wvq3l7HWz", 2420 | "version": 3 2421 | } 2422 | -------------------------------------------------------------------------------- /powerwall.conf: -------------------------------------------------------------------------------- 1 | [[outputs.influxdb]] 2 | urls = ["http://${INFLUXDB_HTTP_BIND_ADDRESS}"] 3 | database = "PowerwallData" # or whatever you want to name the DB 4 | skip_database_creation = false 5 | 6 | [[inputs.http]] 7 | urls = [ 8 | "https://${POWERWALL_HOST}/api/meters/aggregates", 9 | "https://${POWERWALL_HOST}/api/system_status/soe" 10 | ] 11 | method = "GET" 12 | insecure_skip_verify = true 13 | timeout = "5s" 14 | data_format = "json" 15 | headers = {"Cookie" = "AuthCookie=COOKIE_AUTH; UserRecord=COOKIE_REC" } 16 | bearer_token = "${TOKEN}" 17 | 18 | ## POWERWALL_LOCATION Should be in the string format "lat=29.7231806&lon=-82.5562896" 19 | 20 | [[inputs.http]] 21 | urls = [ 22 | "https://fcc-weather-api.glitch.me/api/current?${POWERWALL_LOCATION}" 23 | ] 24 | method = "GET" 25 | insecure_skip_verify = true 26 | timeout = "5s" 27 | interval = "300s" 28 | data_format = "json" 29 | name_override = "weather" 30 | -------------------------------------------------------------------------------- /powerwall.repo: -------------------------------------------------------------------------------- 1 | [grafana] 2 | name=grafana 3 | baseurl=https://packages.grafana.com/oss/rpm 4 | repo_gpgcheck=1 5 | enabled=1 6 | gpgcheck=1 7 | gpgkey=https://packages.grafana.com/gpg.key 8 | sslverify=1 9 | sslcacert=/etc/pki/tls/certs/ca-bundle.crt 10 | 11 | [influxdb] 12 | name = InfluxDB Repository - RHEL \$releasever 13 | baseurl = https://repos.influxdata.com/rhel/\$releasever/\$basearch/stable 14 | enabled = 1 15 | gpgcheck = 1 16 | gpgkey = https://repos.influxdata.com/influxdb.key 17 | 18 | -------------------------------------------------------------------------------- /powerwallcookie.sh.template: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | ####################################################### 5 | # Release Notes: 6 | # 7 | # Powerwall stats dumper for openhab 8 | # Created by Vince Loschiavo - 2021-02-21 9 | # Modified by JR Morgan - 2021-03-03 10 | # 11 | # As of Tesla Powerwall version 20.49.0, the powerwall gateway requires you authenticate for every stat. 12 | # 13 | # This script will login to the powerwall once per day to refresh the cookie, grab the JSON output from the powerwall and 14 | # send it to STDOUT for parsing by your tool of choice. 15 | # 16 | # Example URLs: 17 | # /api/meters/aggregates 18 | # /api/system_status/soe 19 | # /api/system_status/grid_status 20 | # /api/sitemaster 21 | # /api/powerwalls 22 | # /api/status 23 | # 24 | # 25 | ####################################################### 26 | # Subroutines 27 | ####################################################### 28 | 29 | # Create a valid Cookie 30 | create_cookie () { 31 | # Delete the old cookie if it exists 32 | if [ -f $COOKIE ] || [ -f $TOKEN ]; then 33 | rm -f $COOKIE $TOKEN 34 | fi 35 | 36 | # Login and Create new cookie 37 | curl -s -k -c $COOKIE -X POST -H "Content-Type: application/json" -d "{\"username\":\"customer\",\"password\":\"$PASSWORD\", \"email\":\"$EMAIL\"}" "https://${POWERWALL_HOST}/api/login/Basic" | jq -r '.token' > $TOKEN 38 | 39 | # If Login fails, then throw error and exit 40 | if [ $? -eq 200 ]; then 41 | echo "Login failed" 42 | exit; 43 | fi 44 | } 45 | 46 | 47 | # Check for a valid cookie 48 | valid_cookie () { 49 | 50 | # if cookie doesnt exist, then login and create the cookie 51 | if [ ! -f $COOKIE ] || [ ! -f $TOKEN ]; then 52 | # Cookie not present. Creating cookie. 53 | create_cookie 54 | fi 55 | 56 | # If the cookie is older than one day old, refresh the cookie 57 | # Collect both times in seconds-since-the-epoch 58 | ONE_DAY_AGO=$(date -d 'now - 4 hours' +%s) 59 | FILE_TIME=$(date -r "$COOKIE" +%s) 60 | 61 | if [ "$FILE_TIME" -le "$ONE_DAY_AGO" ]; then 62 | #The cookie is older than 1 days; get a new cookie 63 | create_cookie 64 | fi 65 | } 66 | 67 | 68 | 69 | ####################################################### 70 | # Main 71 | ####################################################### 72 | 73 | # Check for a valid cookie or login and create one 74 | valid_cookie 75 | 76 | # Update telegraf config based on existing variables 77 | COOKIE_REC=`grep UserRecord /var/tmp/PWcookie.txt | awk '{print($7)}'` 78 | COOKIE_AUTH=`grep AuthCookie /var/tmp/PWcookie.txt | awk '{print($7)}'` 79 | 80 | # This would work great if using systemd but fails with telegraf running in the foreground 81 | echo "COOKIE_AUTH=${COOKIE_AUTH}" > /etc/default/telegraf 82 | echo "COOKIE_REC=${COOKIE_REC}" >> /etc/default/telegraf 83 | 84 | sed -i "s/AuthCookie=[^;]*/AuthCookie=${COOKIE_AUTH}/g" /etc/telegraf/telegraf.d/powerwall.conf 85 | sed -i "s/UserRecord=[^\"]*/UserRecord=${COOKIE_REC}/g" /etc/telegraf/telegraf.d/powerwall.conf 86 | 87 | 88 | # Send SIGHUP to telegraf for configuration reload: https://www.influxdata.com/blog/continuous-deployment-of-telegraf-configurations/ 89 | if pgrep telegraf; then pkill -1 telegraf; fi 90 | 91 | #Done 92 | -------------------------------------------------------------------------------- /run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Create/validate cookie for Powerwall API Auth 4 | 5 | export POWERWALLIP="${POWERWALL_HOST}" # This is your Powerwall IP or DNS Name -- we force a host entry to 'teslapw' so static is fine 6 | export PASSWORD="${POWERWALL_PASS}" # Login to the Powerwall UI and Set this password - follow the on-screen instructions 7 | export USERNAME="customer" 8 | export EMAIL="Lt.Dan@bubbagump.com" # Set this to whatever you want, it's not actually used in the login process; I suspect Tesla will collect this eventually 9 | export COOKIE="/var/tmp/PWcookie.txt" # Feel free to change this location as you see fit. 10 | export TOKEN="/var/tmp/PWtoken.txt" 11 | 12 | # Workaround to ensure a couple of vars are left untouched 13 | export COOKIE_AUTH='${COOKIE_AUTH}' 14 | export COOKIE_REC='${COOKIE_REC}' 15 | export ONE_DAY_AGO='${ONE_DAY_AGO}' 16 | export FILE_TIME='${FILE_TIME}' 17 | 18 | # Substitute all vars and dump to cron.hourly 19 | envsubst < /etc/powerwallcookie.sh > /etc/PWcookie.sh 20 | chmod a+x /etc/PWcookie.sh 21 | 22 | # Initial run for auth cookie 23 | bash -xe /etc/PWcookie.sh 24 | 25 | sleep 3 26 | 27 | # Create crontab entry 28 | echo "0 * * * * /etc/PWcookie.sh" > /var/spool/cron/root 29 | 30 | # Start crond in the foreground 31 | /usr/sbin/crond -m off -n -s -p & 32 | 33 | # Start influx 34 | /usr/bin/influxd & 35 | status=$? 36 | if [ $status -ne 0 ]; then 37 | echo "Failed to start influxd: $status" 38 | exit $status 39 | fi 40 | 41 | 42 | # Start telegraf: 43 | /usr/bin/telegraf --config /etc/telegraf/telegraf.conf --config-directory /etc/telegraf/telegraf.d & 44 | status=$? 45 | if [ $status -ne 0 ]; then 46 | echo "Failed to start telegraf: $status" 47 | exit $status 48 | fi 49 | 50 | set -a; . /etc/sysconfig/grafana-server; set +a 51 | 52 | cd /usr/share/grafana 53 | 54 | # Preconfigure grafana with required plugins and dashboards 55 | mkdir -p /var/lib/grafana/dashboards 56 | grafana-cli plugins install grafana-piechart-panel 57 | curl ${GRAFANA_DASHBOARD_URL} > /var/lib/grafana/dashboards/grafana_powerwall.json 58 | chown -R grafana:grafana /var/lib/grafana 59 | 60 | /usr/sbin/grafana-server \ 61 | --config=${CONF_FILE} \ 62 | --pidfile=${PID_FILE_DIR}/grafana-server.pid \ 63 | --packaging=rpm \ 64 | cfg:default.paths.logs=${LOG_DIR} \ 65 | cfg:default.paths.data=${DATA_DIR} \ 66 | cfg:default.paths.plugins=${PLUGINS_DIR} \ 67 | cfg:default.paths.provisioning=${PROVISIONING_CFG_DIR} 68 | 69 | while sleep 60; do 70 | ps aux |grep influxd |grep -q -v grep 71 | PROCESS_1_STATUS=$? 72 | ps aux |grep telegraf |grep -q -v grep 73 | PROCESS_2_STATUS=$? 74 | # If the greps above find anything, they exit with 0 status 75 | # If they are not both 0, then something is wrong 76 | if [ $PROCESS_1_STATUS -ne 0 -o $PROCESS_2_STATUS -ne 0 ]; then 77 | echo "One of the processes has already exited." 78 | exit 1 79 | fi 80 | done 81 | --------------------------------------------------------------------------------