├── .github └── workflows │ └── hacs.yml ├── CardSelect.png ├── CardViews.png ├── CodeEditor.png ├── GraphicalEditor.png ├── LICENSE ├── README.md ├── dist └── PlantPictureCard.js └── hacs.json /.github/workflows/hacs.yml: -------------------------------------------------------------------------------- 1 | name: HACS Validate 2 | 3 | on: 4 | push: 5 | pull_request: 6 | schedule: 7 | - cron: "0 0 * * *" 8 | 9 | jobs: 10 | validate: 11 | runs-on: "ubuntu-latest" 12 | steps: 13 | - uses: "actions/checkout@v2" 14 | - name: HACS validation 15 | uses: "hacs/integration/action@master" 16 | with: 17 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 18 | CATEGORY: "plugin" 19 | -------------------------------------------------------------------------------- /CardSelect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badguy99/PlantPictureCard/eb06132a1cf6b450e835872c55f35b07d9f459f3/CardSelect.png -------------------------------------------------------------------------------- /CardViews.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badguy99/PlantPictureCard/eb06132a1cf6b450e835872c55f35b07d9f459f3/CardViews.png -------------------------------------------------------------------------------- /CodeEditor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badguy99/PlantPictureCard/eb06132a1cf6b450e835872c55f35b07d9f459f3/CodeEditor.png -------------------------------------------------------------------------------- /GraphicalEditor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/badguy99/PlantPictureCard/eb06132a1cf6b450e835872c55f35b07d9f459f3/GraphicalEditor.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 badguy99 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PlantPictureCard 2 | 3 | [](https://github.com/custom-components/hacs) 4 | 5 | [](https://www.codacy.com/manual/badguy99/PlantPictureCard?utm_source=github.com&utm_medium=referral&utm_content=badguy99/PlantPictureCard&utm_campaign=Badge_Grade) 6 | 7 | This adds a new custom card, which is like a picture glance card, but takes a plant entity rather than other entities. It provides all the plant data across the bottom bar in one go. 8 | The data should be exactly the same as that displayed by the plant card. And an image should be configured, which is displayed above the plant data. 9 | 10 | ## Card Configuration 11 | The card can be added through usual web interface. 12 |  13 | 14 | Entity and Image are required. Title is optional. 15 | The configuration can be done via the visual editor or code editor. 16 | 17 |  18 |  19 | 20 | ## Card Use in Lovelace 21 | The card should look ok full size or within a 2x2 horizontal and vertical stack 22 | 23 |  24 | -------------------------------------------------------------------------------- /dist/PlantPictureCard.js: -------------------------------------------------------------------------------- 1 | const LitElement = Object.getPrototypeOf( 2 | customElements.get("ha-panel-lovelace") 3 | ); 4 | const html = LitElement.prototype.html; 5 | const css = LitElement.prototype.css; 6 | 7 | class PlantPictureCard extends HTMLElement { 8 | 9 | static getConfigElement() { 10 | return document.createElement("plant-picture-card-editor"); 11 | } 12 | 13 | static getStubConfig() { 14 | return {entity: "", 15 | image: "" }; 16 | } 17 | 18 | constructor() { 19 | super(); 20 | this.attachShadow({ mode: "open" }); 21 | } 22 | 23 | _click(entity) { 24 | this._fire("hass-more-info", { entityId: entity }); 25 | } 26 | 27 | _fire(type, detail) { 28 | 29 | const event = new Event(type, { 30 | bubbles: true, 31 | cancelable: false, 32 | composed: true 33 | }); 34 | event.detail = detail || {}; 35 | this.shadowRoot.dispatchEvent(event); 36 | return event; 37 | } 38 | 39 | set hass(hass) { 40 | const config = this.config; 41 | 42 | var _title = config.title; 43 | 44 | if(!config.title){ 45 | _title = hass.states[config.entity].attributes.friendly_name; 46 | } 47 | 48 | this.shadowRoot.getElementById("box").innerHTML = ` 49 |