GithubHelp home page GithubHelp logo

covrig / homeassistant-hline Goto Github PK

View Code? Open in Web Editor NEW
21.0 4.0 3.0 74 KB

Used to separate entities in a Home Assistant group

HTML 64.09% Shell 35.91%
homeassistant home-assistant state-card horizontal-line line customization frontend

homeassistant-hline's Introduction

Horizontal line state card for Home Assistant

Used to separate entities in a Home Assistant group



Features

  • Highly customizable: width, thickness, borders, images, color, dashes, double lines etc.
  • More than one can be added to the interface.
  • Disabled more-info card.

KNOWN PROBLEMS: Not all options exposed in the customize section.



Installation

  • Download /www/custom_ui/state-card-hline.html and /www/custom_ui/state-card-hline_es5.html to <your-hass-configuration-dir>/www/custom_ui/ (create the folder structure if you don't have it - mind the permissions)
  • Add it to your configuration.yaml:
frontend:
  extra_html_url:
    - /local/custom_ui/state-card-hline.html
  extra_html_url_es5:
    - /local/custom_ui/state-card-hline_es5.html
  • Create one or more sensors, binary_sensor(s), input_text(s) etc. in your configuration.yaml. If you plan to use only one design for you horizontal line just create one sensor and use it in the groups you want.
sensor:
  - platform: template
    sensors:
      hline_1:
        value_template: hline
      hline_2:
        value_template: hline
  • Add your sensor to a group between the entities you would like to split E.g.:
group:
  your_group:
    name: ' '   > in this format the chart will not have a name above (recommeded)
    entities:
      - sensor.1
      - sensor.hline_1
      - sensor.2   
      - sensor.hline_2
- Create more lines if you want to insert more than one in a group (a line acts like a sensor: can't be repeated more than once in a group). 
  • Convert your newly created sensor (or an existing one that you don't use) to a horizontal line in the customize section or your customize.yaml file:
  customize:
    sensor.hline_1:
      custom_ui_state_card: state-card-hline
    sensor.hline_2:
      custom_ui_state_card: state-card-hline

or in the customize_glob.yaml file:

    sensor.hline_*:
     custom_ui_state_card: state-card-hline
  • Customize your horizontal line in the customize section or the customize.yaml file:
- The config options are more or less CSS, so the combination matters in the final result!
    sensor.hline_1:
     custom_ui_state_card: state-card-hline
     config:
       width: 90 --> in percents
       height: 0 --> in pixels, adds to bordertop
       backgroundcolor: white
       bordertop: '1px solid black'
   sensor.hline_2:
     custom_ui_state_card: state-card-hline
     config:
       width: 90 --> in percents
       height: 0 --> in pixels, adds to bordertop
       backgroundcolor: white
       bordertop: '1px dashed red'
   sensor.hline_3:
     custom_ui_state_card: state-card-hline
     config:
       width: 65 --> in percents
       height: 0 --> in pixels, adds to bordertop
       backgroundcolor: white
       bordertop: '2px double green'
   sensor.hline_4:
     custom_ui_state_card: state-card-hline
     config:
       width: 85 --> in percents
       height: 1 --> in pixels, adds to bordertop
       backgroundcolor: white
       bordertop: none
       backgroundimage: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0))
default values:
      config:
       width: 90
       height: 0
       backgroundcolor: white
       bordertop: '1px solid black'
       backgroundimage: none

Changelog

Version 20180211:
+Fixed a couple of bugs in the CSS.
Version 20180215:
+Added ES5 file.
On 20180418:
+Updated installation instructions

Some ideas for customizing:

homeassistant-hline's People

Contributors

covrig avatar sguernion avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

homeassistant-hline's Issues

Small fix to ready() function

The following lines in ready() function produce errors:

      '--width': (config.width)+'%' ? (config.width)+'%' : '85%',
      '--height': config.height+'px' ? config.height+'px' : '0px',

Here is the fix:

      '--width': config.width ? config.width+'%' : '85%',
      '--height': config.height ? config.height+'px' : '0px',

You should also init config object like this, otherwise if there is no config defined in yaml file it will produce errors in lines above.

var config = this.config || {};

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.