Coder Social home page Coder Social logo

state-attribute-element's Introduction

State Attribute Element

This element is not all that useful as a card (it can be used for that to), the purpose of this is to give the option to add static text on a picture-elements card.

Options

Name Type Requirement Description
type string Required custom:state-attribute-element
entity string Required The entity_id of the entity you want to show.
attribute string Required The attribute of the entity you want to show.
prefix string Optional A string you want to show in front of the attribute, ex. "My prefix string: "
suffix string Optional A string you want to show after the attribute, ex. "My suffix string: "
show_empty boolean Optional Give you the possibility to show unavailable if the state is empty, default false

Installation

Step 1

Install state-attribute-element by copying state-attribute-element.jsfrom this repo to <config directory>/www/state-attribute-element.js on your Home Assistant instanse.

Example:

wget https://raw.githubusercontent.com/custom-cards/state-attribute-element/master/state-attribute-element.js
mv state-attribute-element.js /config/www/

Step 2

Link state-attribute-element inside you ui-lovelace.yaml.

resources:
  - url: /local/state-attribute-element.js?v=0
    type: js

Step 3

Add a custom element in your ui-lovelace.yaml

      - type: picture-elements
        image: /local/files/LUfuf8ow.jpg
        elements:
          - type: custom:state-attribute-element
            entity: sensor.my_sensor
            attribute: my_attribute
            prefix: "My prefix string: "

Example with styles

      - type: picture-elements
        image: /local/files/LUfuf8ow.jpg
        elements:
          - type: custom:state-attribute-element
            entity: sensor.tautulli__ludeeus
            attribute: friendly_name
            prefix: "<b style='font-weigth: bold; color: red'>Friendle name: </b>"
            style:
              top: 47%
              left: 5px
              transform: none

example

state-attribute-element's People

Contributors

ccmacaluso avatar ludeeus avatar nervetattoo avatar ohadbenita avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.