From 5a249e2e16b6ad16621b4377ab4a4b70159615b4 Mon Sep 17 00:00:00 2001 From: Gerben ten Hove Date: Sun, 2 Dec 2018 15:56:41 +0100 Subject: [PATCH] Submodule for custom-cards-lovelace --- LICENSE | 2 +- README.md | 8 ++ power-wheel-card/README.md | 120 ++++++++++++++++++++++ power-wheel-card/example-card-dark.gif | Bin 0 -> 8671 bytes power-wheel-card/example-card.gif | Bin 0 -> 8536 bytes power-wheel-card/power-wheel-card.js | 132 +++++++++++++++++++++++++ 6 files changed, 261 insertions(+), 1 deletion(-) create mode 100644 README.md create mode 100644 power-wheel-card/README.md create mode 100644 power-wheel-card/example-card-dark.gif create mode 100644 power-wheel-card/example-card.gif create mode 100644 power-wheel-card/power-wheel-card.js diff --git a/LICENSE b/LICENSE index 261eeb9..fc29a70 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright [yyyy] [name of copyright owner] + Copyright 2018 Gerben ten Hove Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md new file mode 100644 index 0000000..9ce7739 --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +Custom-cards-lovelace +=== +My custom cards for the [Lovelace UI](https://www.home-assistant.io/lovelace) of [Home Assistant](https://www.home-assistant.io/). + +* [power-wheel-card](./power-wheel-card) + +## License +All custom cards are licensed under the [Apache License 2.0](./LICENSE). \ No newline at end of file diff --git a/power-wheel-card/README.md b/power-wheel-card/README.md new file mode 100644 index 0000000..b5eb321 --- /dev/null +++ b/power-wheel-card/README.md @@ -0,0 +1,120 @@ +power-wheel-card +==== + +## Features +Features of the custom power-wheel-card: +* Calculates the current power that your home is consuming: home power. + Input for the calculation is the (produced) solar power and the (consumed or produced) grid power. +* Displays the three power values (solar, grid and home) in 'a wheel'. +* Displays the transition between these powers as arrows. + E.g. if your solar power panels produce power, the arrow from solar to home turns active. + And if your solar power panels produce enough power to deliver some back to the grid, the arrow from solar to grid turns active. +* Works for default theme and custom themes that use [standard CSS vars](https://github.com/home-assistant/home-assistant-polymer/blob/master/src/resources/ha-style.js). + +![example1](./example-card.gif "The power-wheel-card in Default theme") +![example2](./example-card-dark.gif "The power-wheel-card in a random dark theme") + +## Requirements +1. You need to have a working sensor for your solar power. Write down the entity id of this sensor. This is *YOUR_SOLAR_POWER_SENSOR* in the instructions below. + - This sensor has a `unit_of_measurement` set up, e.g. `'W'` or `'kW'`. + - The sensor value should be of type *int* or *float*. + - The sensor value should be positive. + - The sensor could have an icon (optional) that will override the icon in the power-wheel-card. +1. You need to have a working sensor for your grid power. This is *YOUR_GRID_POWER_SENSOR* in the instructions below. + - This sensor has the `unit_of_measurement` set up as the sensor for solar power. + - The sensor value should be of type *int* or *float*. + - The sensor value should be **negative** for **producing** power to the grid and **positive** for **consuming** power of the grid. + - The sensor could have an icon (optional) that will override the icon in the power-wheel-card. + +### Example requirements configuration +This is not the configuration of the power-wheel-card itself, but an example configuration that's needed to have input sensors for the power-wheel-card. +An example configuration in `configuration.yaml` to comply to the requirements: + +```yaml +sensor: + - platform: template + sensors: + solar_power: + friendly_name: 'Solar power production' + unit_of_measurement: 'W' + value_template: '{{ states.sensor.youless.attributes.pwr }}' + grid_power: + friendly_name: 'Grid power consumption' + unit_of_measurement: 'W' + value_template: '{{ (1000 * (states.sensor.power_consumption.state | float - states.sensor.power_production.state | float)) | int }}' +``` + +In this example the sensors names for *YOUR_SOLAR_POWER_SENSOR* and *YOUR_GRID_POWER_SENSOR* are `solar_power` resp. `grid_power`. + +Not visible in the example above, but of course you have to have installed the hardware and configured it to feed your sensors. +In the example above I used a [rest sensor](https://www.home-assistant.io/components/sensor.rest/) for my [Youless](http://youless.nl/winkel/product/ls120.html) for the solar power. +For the grid power I used a [dsmr sensor](https://www.home-assistant.io/components/sensor.dsmr/) for my Iskra Smart Meter. +Because the dsmr sensor supplies 2 separate sensors for grid power consumption and grid power production, you have to combine them to one grid power sensor. +Because my solar power sensor and dsmr sensor don't report in the same unit of measurement, I had to convert that as well. + +## Instructions +1. Check the requirements above. If you don't comply to the requirements, the card won't be much of use for you or just won't work. +1. Download the file [power-wheel-card.js](https://raw.githubusercontent.com/gurbyz/custom-cards-lovelace/master/power-wheel-card/power-wheel-card.js). +1. Save the file in the `www` folder inside your Home Assistant config folder. +1. Include the card code in your `ui-lovelace.yaml` file: + +```yaml +resources: + - url: /local/power-wheel-card.js?v=1 + type: module +``` + +> Note: You can increase the number in `v=1` whenever updating code to avoid having to manually clear the cache of yours browsers/apps. + +5. Include a configuration for the power-wheel-card in your `ui-lovelace.yaml` file: + +```yaml +views: + - id: example_view + cards: + - type: "custom:power-wheel-card" + solar_power_entity: sensor.YOUR_SOLAR_POWER_SENSOR + grid_power_entity: sensor.YOUR_GRID_POWER_SENSOR +``` + +## Options + +| Option | Type | Mandatory? | Default | Description | +|--------|------|------------|---------|-------------| +|type|string|**required**||Type of the card. Use `"custom:power-wheel-card"`.| +|solar_power_entity|string|**required**||Entity id of your solar power sensor. E.g. `sensor.YOUR_SOLAR_POWER_SENSOR`. See requirements above.| +|grid_power_entity|string|**required**||Entity id of your grid power sensor. E.g. `sensor.YOUR_GRID_POWER_SENSOR`. See requirements above.| +|title|string|optional|`"Power wheel"`|Title of the card.| +|home_power_icon|string|optional|`"mdi:home"`|Icon for home power.| + +### More icons +The icons for solar power and grid power are taken from your own sensors for solar power and grid power. +If you haven't set up icons default icons will be used. For solar power: `mdi:weather-sunny`; and for grid power: `mdi:flash-circle`. + +An example for overriding the other two icons, to be put in `configuration.yaml`: + +```yaml +homeassistant: + [...] + customize: + sensor.solar_power: + icon: mdi:white-balance-sunny + sensor.grid_power: + icon: mdi:flash-circle +``` + +## Advanced configuration example +A more advanced example for in the `ui-lovelace.yaml` file: +```yaml +- type: "custom:power-wheel-card" + title: "Power distribution" + solar_power_entity: sensor.YOUR_SOLAR_POWER_SENSOR + grid_power_entity: sensor.YOUR_GRID_POWER_SENSOR + home_power_icon: "mdi:home-assistant" +``` + +## License +This custom card is licensed under the [Apache License 2.0](https://github.com/gurbyz/custom-cards-lovelace/blob/master/LICENSE). + +## Credits +* [gurbyz](https://github.com/gurbyz) \ No newline at end of file diff --git a/power-wheel-card/example-card-dark.gif b/power-wheel-card/example-card-dark.gif new file mode 100644 index 0000000000000000000000000000000000000000..bd92d71ea6b0170bdd87a16d51a25d32abf8149d GIT binary patch literal 8671 zcmbuDXCM@S|Nn2>9E!7Y#&KjE$w+ZV9NF1qyAUNx%DOYo*=H0=I;%uQk-hhx4Ku6k znLTp<@Av=zKl(lWeIC3Yz8}2bPd@LLuAYvvlCw3a2e=6Mzjs*?CVzujUV-t-4Va<^ ztD?pQMLD>VCPGP$OIeOhMT1X8j`NzfpsK9Uby@BkI36`!aWxE&x*j(c$BWgKz{(0} z-V(lPq;OMOSw~t_*94_!ET(6sc1z;2frXr*wU(izw2`%piM5=mm4dmQu{qk<0%c+$ zu59U`Z0%rSEoNscdc)2|_l~EggS(!Cmz$%AmJ=TDETrS=>EkNs?S?dWf1r=Q=ZC-a z#Dm|^^S+^%uZh^PVX*~auzUhEpUB`79#s^<_#l$( z8yOuMnOGbN^&`cUlE9B+;=jfKp2jBzCnkqcQX|q{&}g*(m)!qeg^nSR|GG&1SN_`x zfR09hhDSt3k)p{lv2pPUiAj{?l+?86FVZtIU%twEo&AQIlbe@c@b+Ed`=a6xA3v3p ze*RKc{0IXNiuFcA3Z+U zU1N(4YoyUALUb8^04@)wTmJ+KXTuSwuGt7UUX1Dn(eapzVo@Q_k@z?BoTHICM>+RF za4gnPjC3?hu6|AcvkLY-YK{{wtU|`o?5PWhs)|kk;6<6Ykv#YzOe&)`$T^P|u6!^G zNH)>&)Zx-Ehd0NhvDo}h){}YalzMhuPn5^)g$*pt4Z!}}$(C1wGX;-caVI)$iY#)= zmQ&wltD5YzXX4wAtY6u8sEEJjyk8-v=_12E1l5Hfw?iX1R`9ocd!81CJ%$YxVp$?J z@-IBUe~eFm<@a*gBc5ZW5G#v)p9N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A?j-6@UDQj^Zx7G_knoVc*zG>RIspKvzGGqCw&A~VYm6JH9 zb{ZjL&JiLqetBL?K9nnfPP(gB#UnccO1eYa=2AOeG>xd}&oKU%Wp%t{*;O%E+W9Zn z_juX%bmeff@lHX)@rt8K<>*l7PRXOBMcLFk4%Rl^m+ab$DrEfRZs%^z;qhPG=_)$2 z$zDC`WSwkMHN)4n*Q9Z>L5ZlEy#AP!D(*U*JUrQ@oz`3ldXI?l_Tu?X_TT)}bu_2J z*zb<0+0HOIUb12w40qM+ly)7j`7#dar)&3`O-?ow7)J}uC%nP(2A2hokJlq=kLFDn z2V;zry{_7m-7dz-;eQW%ejHd02eHJ#ym9bY9BUbl-4gd|8-9u(vzw#4&# 0 + && gridPowerState && parseFloat(homePowerStateStr) != 0 ? 'active' : 'inactive'; + const grid2homeClass = gridPowerState && parseFloat(gridPowerState.state) > 0 + && solarPowerState && parseFloat(homePowerStateStr) != 0 ? 'active' : 'inactive'; + + return html` + + +
+ ${title} +
+
+
+ +
${solarPowerStateStr} ${unitStr} +
+
+
+
+ +
+
+ +
+
+
+
+ +
${gridPowerStateStr} ${unitStr} +
+
+ +
+
+ +
${homePowerStateStr} ${unitStr} +
+
+
+ `; + } + + setConfig(config) { + if (!config.solar_power_entity) { + throw new Error('You need to define a solar_power_entity'); + } + if (!config.grid_power_entity) { + throw new Error('You need to define a grid_power_entity'); + } + this.config = config; + } + + getCardSize() { + return 5; + } +} + +customElements.define('power-wheel-card', PowerWheelCard); \ No newline at end of file