Skip to content

Commit

Permalink
Commit first final version
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Kissling committed Oct 4, 2022
1 parent fd3deee commit 918176e
Show file tree
Hide file tree
Showing 5,546 changed files with 7,412 additions and 2,984 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
{
"name": "Boilerplate Card Development",
"name": "Clock Weather Card Development",
"image": "ludeeus/container:monster",
"context": "..",
"appPort": ["5000:5000", "9123:8123"],
Expand Down
6 changes: 3 additions & 3 deletions .devcontainer/ui-lovelace.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
resources:
- url: http://127.0.0.1:5000/boilerplate-card.js
- url: http://127.0.0.1:5000/clock-weather-card.js
type: module
views:
- cards:
- type: custom:boilerplate-card
name: Boilerplate Card Development
- type: custom:clock-weather-card
name: Clock Weather Card Development
entity: sun.sun
test_gui: true
1 change: 0 additions & 1 deletion .github/FUNDING.yml

This file was deleted.

Binary file added .github/assets/card.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions .github/workflows/hacs-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: HACS Action

on:
push:
pull_request:
schedule:
- cron: "0 0 * * *"

jobs:
hacs:
name: HACS Action
runs-on: "ubuntu-latest"
steps:
- name: HACS Action
uses: "hacs/action@main"
with:
category: "plugin"
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
# Build
- name: Build the file
run: |
cd /home/runner/work/boilerplate-card/boilerplate-card
cd /home/runner/work/clock-weather-card/clock-weather-card
npm install
npm run build
Expand All @@ -24,7 +24,7 @@ jobs:

with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: /home/runner/work/boilerplate-card/boilerplate-card/dist/boilerplate-card.js
asset_name: boilerplate-card.js
file: /home/runner/work/clock-weather-card/clock-weather-card/dist/clock-weather-card.js
asset_name: clock-weather-card.js
tag: ${{ github.ref }}
overwrite: true
overwrite: true
5 changes: 4 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
MIT License

Copyright (c) 2020 Custom cards for Home Assistant
Copyright (c) 2022 Patrick Kissling

Copyright for portions of project Clock Weather Card are held by [Bas Milius, 2020-2022]
as part of project weather-icons.

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
145 changes: 52 additions & 93 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,119 +1,78 @@
# Boilerplate Card by [@iantrich](https://www.github.com/iantrich)
[![hacs_badge](https://img.shields.io/badge/HACS-Default-41BDF5.svg)](https://github.com/hacs/integration)
[![GitHub all releases](https://img.shields.io/github/downloads/pkissling/clock-weather-card/total)](https://github.com/pkissling/clock-weather-card/releases)
[![GitHub release (latest by SemVer)](https://img.shields.io/github/downloads/pkissling/clock-weather-card/latest/total?sort=semver)](https://github.com/pkissling/clock-weather-card/releases/latest)

A community driven boilerplate of best practices for Home Assistant Lovelace custom cards
# Clock Weather Card

[![GitHub Release][releases-shield]][releases]
[![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)
A [Home Assistant Dashboard Card](https://www.home-assistant.io/dashboards/) available through the [Home Assistant Community Store](https://hacs.xyz)
showing the current date, time and a weather forecast.

![Project Maintenance][maintenance-shield]
[![GitHub Activity][commits-shield]][commits]
Credits go to [basmilius](https://github.com/basmilius) for the awesome [weather icons](https://github.com/basmilius/weather-icons).

[![Discord][discord-shield]][discord]
[![Community Forum][forum-shield]][forum]
![Clock Weather Card](.github/assets/card.gif)
[^1]

## Support
## Installation

Hey dude! Help me out for a couple of :beers: or a :coffee:!
### Manual Installation

[![coffee](https://www.buymeacoffee.com/assets/img/custom_images/black_img.png)](https://www.buymeacoffee.com/zJtVxUAgH)
1. Download the [clock-weather-card](https://www.github.com/pkissling/clock-weather-card/releases/latest/download/clock-weather-card.js)
2. Place the file in your `config/www` folder
3. Add the configuration to your `ui-lovelace.yaml`

## Options
```yaml
resources:
- url: /local/clock-weather-card.js
type: module
```
| Name | Type | Requirement | Description | Default |
| ----------------- | ------- | ------------ | ------------------------------------------- | ------------------- |
| type | string | **Required** | `custom:boilerplate-card` |
| name | string | **Optional** | Card name | `Boilerplate` |
| show_error | boolean | **Optional** | Show what an error looks like for the card | `false` |
| show_warning | boolean | **Optional** | Show what a warning looks like for the card | `false` |
| entity | string | **Optional** | Home Assistant entity ID. | `none` |
| tap_action | object | **Optional** | Action to take on tap | `action: more-info` |
| hold_action | object | **Optional** | Action to take on hold | `none` |
| double_tap_action | object | **Optional** | Action to take on double tap | `none` |
4. Write [configuration](#configuration) for the card in your `ui-lovelace.yaml`

## Action Options
### Installation and tracking with `hacs`

| Name | Type | Requirement | Description | Default |
| --------------- | ------ | ------------ | -------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| action | string | **Required** | Action to perform (more-info, toggle, call-service, navigate url, none) | `more-info` |
| navigation_path | string | **Optional** | Path to navigate to (e.g. /lovelace/0/) when action defined as navigate | `none` |
| url | string | **Optional** | URL to open on click when action is url. The URL will open in a new tab | `none` |
| service | string | **Optional** | Service to call (e.g. media_player.media_play_pause) when action defined as call-service | `none` |
| service_data | object | **Optional** | Service data to include (e.g. entity_id: media_player.bedroom) when action defined as call-service | `none` |
| haptic | string | **Optional** | Haptic feedback _success, warning, failure, light, medium, heavy, selection_ | `none` |
| repeat | number | **Optional** | How often to repeat the `hold_action` in milliseconds. | `none` |
1. Make sure the [HACS](https://github.com/custom-components/hacs) component is installed and working.
2. Search for `clock-weather-card` and add it through HACS
3. Add the configuration to your `ui-lovelace.yaml`

## Starting a new card from boilerplate-card
```yaml
resources:
- url: /hacsfiles/clock-weather-car/clock-weather-card.js
type: module
```

### Step 1
4. Refresh home-assistant.

Click the "Use this template" button on the main page and clone the new repository to your machine
## Configuration

### Step 2

Install necessary modules (verified to work in node 8.x)
`yarn install` or `npm install`

### Step 3

Do a test lint & build on the project. You can see available scripts in the package.json
`npm run build`

### Step 4

Search the repository for all instances of "TODO" and handle the changes/suggestions

### Step 5

Customize to suit your needs and contribute it back to the community

## Starting a new card from boilerplate-card with [devcontainer][devcontainer]

Note: this is available only in vscode ensure you have the [Remote Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension installed.

1. Fork and clone the repository.
2. Open a [devcontainer][devcontainer] terminal and run `npm start` when it's ready.
3. The compiled `.js` file will be accessible on
`http://127.0.0.1:5000/boilerplate-card.js`.
4. On a running Home Assistant installation add this to your Lovelace
`resources:`
### Minimal configuration

```yaml
- url: 'http://127.0.0.1:5000/boilerplate-card.js'
type: module
- type: custom:clock-weather-card
entity: weather.home
```

_Change "127.0.0.1" to the IP of your development machine._
### Options

### Bonus
| Name | Type | Requirement | Description | Default |
|-------------------|------------------|--------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|-----------|
| type | string | **Required** | `custom:clock-weather-card` | |
| entity | string | **Required** | ID of the weather entity | |
| sun_entity | boolean | **Optional** | ID of the sun entity. Used to determine whether to show a day or night icon. If sun integration is not enabled, day icon will be shown | `sun.sun` |
| weather_icon_type | `fill` \| `line` | **Optional** | Appearance of the large weather icon | `line` |
| animated_icon | boolean | **Optional** | Whether the large weather icon should be animated | `true` |
| forecast_days | number | **Optional** | Days of weather forecast to show | `5` |
| locale | string[^2] | **Optional** | Language to use for date/time formatting and language specific text. If not provided, falls back to the locale set in HA | `en` |

If you need a fresh test instance you can install a fresh Home Assistant instance inside the devcontainer as well.
## FAQ

1. Run the command `container start`.
2. Home Assistant will install and will eventually be running on port `9123`
- [Why don't I see the current day in my weather forecast?](#why-dont-i-see-the-current-day-in-my-weather-forecast)

## [Troubleshooting](https://github.com/thomasloven/hass-config/wiki/Lovelace-Plugins)
### Why don't I see the current day in my weather forecast?

NB This will not work with node 9.x if you see the following errors try installing node 8.10.0
Your weather provider may not provide today's weather as part of their weather forecast. You may consider switching to a different weather provider.
[OpenWeatherMap](https://www.home-assistant.io/integrations/openweathermap/) is one of the weather integrations providing today's weather.

```yarn install
yarn install v1.3.2
[1/4] 🔍 Resolving packages...
warning [email protected]: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-commonjs.
[2/4] 🚚 Fetching packages...
error @typescript-eslint/[email protected]: The engine "node" is incompatible with this module. Expected version "^8.10.0 || ^10.13.0 || >=11.10.1".
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
```
## Footnotes

[commits-shield]: https://img.shields.io/github/commit-activity/y/custom-cards/boilerplate-card.svg?style=for-the-badge
[commits]: https://github.com/custom-cards/boilerplate-card/commits/master
[devcontainer]: https://code.visualstudio.com/docs/remote/containers
[discord]: https://discord.gg/5e9yvq
[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
[forum]: https://community.home-assistant.io/c/projects/frontend
[license-shield]: https://img.shields.io/github/license/custom-cards/boilerplate-card.svg?style=for-the-badge
[maintenance-shield]: https://img.shields.io/maintenance/yes/2021.svg?style=for-the-badge
[releases-shield]: https://img.shields.io/github/release/custom-cards/boilerplate-card.svg?style=for-the-badge
[releases]: https://github.com/custom-cards/boilerplate-card/releases
[^1]: Theme used: [lovelace-ios-themes](https://github.com/basnijholt/lovelace-ios-themes).
[^2]: Supported languages: `en`
10 changes: 0 additions & 10 deletions elements/formfield.js

This file was deleted.

8 changes: 0 additions & 8 deletions elements/ignore/select.js

This file was deleted.

1 change: 0 additions & 1 deletion elements/ignore/switch.js

This file was deleted.

1 change: 0 additions & 1 deletion elements/ignore/textfield.js

This file was deleted.

53 changes: 0 additions & 53 deletions elements/select.js

This file was deleted.

17 changes: 0 additions & 17 deletions elements/switch.js

This file was deleted.

18 changes: 0 additions & 18 deletions elements/textfield.js

This file was deleted.

4 changes: 2 additions & 2 deletions hacs.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "Boilerplate Card",
"name": "Clock Weather Card",
"render_readme": true,
"filename": "boilerplate-card.js"
"filename": "clock-weather-card.js"
}
Loading

0 comments on commit 918176e

Please sign in to comment.