Skip to content

Commit

Permalink
general cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
iantrich committed Nov 3, 2019
1 parent e51e8e3 commit 68dee53
Show file tree
Hide file tree
Showing 11 changed files with 679 additions and 408 deletions.
11 changes: 0 additions & 11 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,6 @@ rules:
no-nested-ternary: 0
camelcase: 0
no-unused-vars: 0
import/prefer-default-export: 0
no-param-reassign: 0
import/no-unresolved: 0
operator-linebreak: 0
arrow-parens: 0
quotes:
- 2
- double
comma-dangle:
- 2
- never
globals:
window: true
Event: true
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Custom cards for Home Assistant
Copyright (c) 2019 Ian Richardson

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
66 changes: 27 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Config Template Card Card by [@iantrich](https://www.github.com/iantrich)
# Config Template Card Card

📝 Templatable Configuration Card

[![GitHub Release][releases-shield]][releases]
[![GitHub Activity][commits-shield]][commits]
[![custom_updater][customupdaterbadge]][customupdater]
[![License][license-shield]](LICENSE.md)
[![hacs_badge](https://img.shields.io/badge/HACS-Default-orange.svg?style=for-the-badge)](https://github.com/custom-components/hacs)

![Project Maintenance][maintenance-shield]
[![BuyMeCoffee][buymecoffeebadge]][buymecoffee]
[![GitHub Activity][commits-shield]][commits]

[![Discord][discord-shield]][discord]
[![Community Forum][forum-shield]][forum]
Expand All @@ -17,53 +17,44 @@

This card is for [Lovelace](https://www.home-assistant.io/lovelace) on [Home Assistant](https://www.home-assistant.io/) that allows you to use pretty much any valid Javascript on the hass object in your configuration

## Options

| Name | Type | Requirement | Description
| ---- | ---- | ------- | -----------
| type | string | **Required** | `custom:config-template-card`
| card | object | **Required** | Card object
| entities | list | **Optional** | List of entity strings that should be watched for updates
| variables | list | **Optional** | List of variables, which can be templates, that can be used in your `config` and indexed using `vars`

## Installation

### Step 1
## Support

Save [config-template-card](https://github.com/custom-cards/config-template-card/raw/master/dist/config-template-card.js) to `<config directory>/www/config-template-card.js` on your Home Assistant instanse.
Hey dude! Help me out for a couple of :beers: or a :coffee:!

**Example:**
[![coffee](https://www.buymeacoffee.com/assets/img/custom_images/black_img.png)](https://www.buymeacoffee.com/zJtVxUAgH)

```bash
wget https://raw.githubusercontent.com/custom-cards/config-template-card/master/dist/config-template-card.js
mv config-template-card.js /config/www/
```
This card is for [Lovelace](https://www.home-assistant.io/lovelace) on [Home Assistant](https://www.home-assistant.io/) that display a [Roku](https://www.roku.com/) remote.

### Step 2
## Installation

Link `config-template-card` inside your `ui-lovelace.yaml` or Raw Editor in the UI Editor
Use [HACS](https://hacs.xyz) or follow this [guide](https://github.com/thomasloven/hass-config/wiki/Lovelace-Plugins)

```yaml
resources:
- url: /local/config-template-card.js
type: module
url: /local/config-template-card.js
type: module
```
### Step 3
## Options
Add a custom element in your `ui-lovelace.yaml` or in the UI Editor as a Manual Card
| Name | Type | Requirement | Description |
| --------- | ------ | ------------ | ----------------------------------------------------------------------------------------------------- |
| type | string | **Required** | `custom:config-template-card` |
| card | object | **Required** | Card object |
| entities | list | **Optional** | List of entity strings that should be watched for updates |
| variables | list | **Optional** | List of variables, which can be templates, that can be used in your `config` and indexed using `vars` |

### Available variables for templating
`this.hass` - The [hass](https://developers.home-assistant.io/docs/en/frontend_data.html) object

`states` - The [states](https://developers.home-assistant.io/docs/en/frontend_data.html#hassstates) object

`user` - The [user](https://developers.home-assistant.io/docs/en/frontend_data.html#hassuser) object

`vars` - Defined by `variables` configuration and accessible in your templates starting at the 0th index as your firstly defined variable to help clean up your templates
| Variable | Description |
| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `this.hass` | The [hass](https://developers.home-assistant.io/docs/en/frontend_data.html) object |
| `states` | The [states](https://developers.home-assistant.io/docs/en/frontend_data.html#hassstates) object |
| `user` | The [user](https://developers.home-assistant.io/docs/en/frontend_data.html#hassuser) object |
| `vars` | Defined by `variables` configuration and accessible in your templates starting at the 0th index as your firstly defined variable to help clean up your templates |

```yaml
type: 'custom:config-template-card'
type: "custom:config-template-card"
variables:
- states['light.bed_light'].state
- states['cover.garage_door'].state
Expand All @@ -90,16 +81,13 @@ card:
[Troubleshooting](https://github.com/thomasloven/hass-config/wiki/Lovelace-Plugins)

## Developers

Fork and then clone the repo to your local machine. From the cloned directory run

`npm install && npm run build`

[buymecoffee]: https://www.buymeacoffee.com/iantrich
[buymecoffeebadge]: https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg?style=for-the-badge
[commits-shield]: https://img.shields.io/github/commit-activity/y/custom-cards/config-template-card.svg?style=for-the-badge
[commits]: https://github.com/custom-cards/config-template-card/commits/master
[customupdater]: https://github.com/custom-components/custom_updater
[customupdaterbadge]: https://img.shields.io/badge/custom__updater-true-success.svg?style=for-the-badge
[discord]: https://discord.gg/Qa5fW2R
[discord-shield]: https://img.shields.io/discord/330944238910963714.svg?style=for-the-badge
[forum-shield]: https://img.shields.io/badge/community-forum-brightgreen.svg?style=for-the-badge
Expand Down
Loading

0 comments on commit 68dee53

Please sign in to comment.