Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
figorr committed Jan 6, 2025
1 parent 6cb7fe3 commit c3c3b3b
Show file tree
Hide file tree
Showing 25 changed files with 175 additions and 5,227 deletions.
59 changes: 32 additions & 27 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
{
"name": "Platinum Weather Card ES Development",
"image": "ludeeus/container:monster",
"context": "..",
"appPort": ["5123:5000", "9123:8123"],
"postCreateCommand": "npm install",
"runArgs": [
"-v",
"${env:HOME}${env:USERPROFILE}/.ssh:/tmp/.ssh" // This is added so you can push from inside the container
],
"extensions": [
"github.vscode-pull-request-github",
"eamodio.gitlens",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"bierner.lit-html",
"runem.lit-plugin",
"davidanson.vscode-markdownlint",
"redhat.vscode-yaml"
],
"settings": {
"files.eol": "\n",
"editor.tabSize": 4,
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true
}
"name": "Platinum Weather Card Development",
"image": "thomasloven/hass-custom-devcontainer",
"postCreateCommand": "sudo -E container run-dev && npm add",
"containerEnv": {
"DEVCONTAINER": "1"
},
"forwardPorts": [8123],
"mounts": [
"source=${localWorkspaceFolder},target=/config/www/workspace,type=bind",
"source=${localWorkspaceFolder}/test,target=/config/test,type=bind",
"source=${localWorkspaceFolder}/test/configuration.yaml,target=/config/configuration.yaml,type=bind"
],
"runArgs": ["--env-file", "${localWorkspaceFolder}/test/.env"],
"extensions": [
"github.vscode-pull-request-github",
"esbenp.prettier-vscode",
"spmeesseman.vscode-taskexplorer"
],
"settings": {
"files.eol": "\n",
"editor.tabSize": 2,
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"files.trimTrailingWhitespace": true
}
}
30 changes: 6 additions & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,23 @@ name: 'Build'
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master

jobs:
build:
name: Build Main
name: Build Master
runs-on: ubuntu-latest
env:
NODE_ENV: production
steps:
- uses: actions/checkout@v4

- name: Cache Node.js modules
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- uses: actions/checkout@v2
- name: Build
run: |
rm -rf node_modules
rm -rf /home/runner/work/platinum-weather-card/platinum-weather-card/node_modules
npm install
npm run lint && npm run rollup -c rollup.config.js
ls -R dist
# Descomenta esta sección si necesitas la validación de HACS
ls -R /home/runner/work/platinum-weather-card/platinum-weather-card/dist
# - name: HACS validation
# uses: 'hacs/action@main'
# with:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@ jobs:
permissions: write-all
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v1

# Build
- name: Build the file
run: |
rm -rf /home/runner/work/platinum-weather-card-es/platinum-weather-card-es/node_modules
cd /home/runner/work/platinum-weather-card-es/platinum-weather-card-es
rm -rf /home/runner/work/platinum-weather-card/platinum-weather-card/node_modules
cd /home/runner/work/platinum-weather-card/platinum-weather-card
npm install
npm run build
ls -R /home/runner/work/platinum-weather-card/platinum-weather-card-es/dist
ls -R /home/runner/work/platinum-weather-card/platinum-weather-card/dist
# Upload build file to the releas as an asset.
- name: Upload javascript to release
uses: svenstaro/upload-release-action@v2

with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: /home/runner/work/platinum-weather-card-es/platinum-weather-card-es/dist/*
file: /home/runner/work/platinum-weather-card/platinum-weather-card/dist/*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
7 changes: 1 addition & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,4 @@
/.rpt2_cache/
package-lock.json
/dist/*.js

# Entorno virtual
.venv/

# Variables de entorno
.env
.venv/
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
"detail": "npm run lint && npm run rollup"
}
]
}
}
52 changes: 24 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,27 @@
# Platinum Weather Card by [@makin-things](https://www.github.com/makin-things)
# (Another) Platinum Weather Card by [@altrdev](https://www.github.com/altrdev)

A highly configurable weather card with a graphical configuration.
A highly configurable weather card with a graphical configuration. Forked from [@makin-things](https://www.github.com/makin-things/platinum-weather-card)

[![hacs_badge](https://img.shields.io/badge/HACS-Default-orange.svg?style=for-the-badge)](https://github.com/hacs/integration)
[![hacs_badge](https://img.shields.io/badge/HACS-Custom-41BDF5.svg?style=for-the-badge)](https://github.com/hacs/integration)
[![GitHub Release][releases-shield]][releases]
[![License][license-shield]](LICENSE.md)
![Maintenance](https://img.shields.io/maintenance/yes/2022?style=for-the-badge)
![Maintenance](https://img.shields.io/maintenance/yes/2023?style=for-the-badge)

# Support

Hey dude! Help me out for a couple of :beers: or a :coffee:!
Hey dude! Help me maintain project with a couple of :beers: or a :coffee:!

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

If you like this card and would like to see me continue development of it a small donation would be greatly appreciated. I have already spent hundreds of hours working on this.
[![coffee](https://www.buymeacoffee.com/assets/img/custom_images/black_img.png)](https://www.buymeacoffee.com/altrdev)

# Need Help?

If you need help the best place to ask is in the Home Assistant Community. There is a thread that can be found [here](https://community.home-assistant.io/t/platinum-weather-card-support/449166).

Alternativley create an issue on github, but note that only a couple of people will see that and may be busy doing other things.
If you need help use [GitHub](https://github.com/altrdev/platinum-weather-card/discussions/categories/general) discussions.

# Overview

This is a fully customisable weather card with a graphical configuration. It has been patterned after the original Dark-Sky animated weather card (https://github.com/iammexx/home-assistant-config/tree/master/ui/darksky), and a forked variant, the BOM Weather Card (https://github.com/DavidFW1960/bom-weather-card). The aim is that this card is usable by people everywhere and be able to deal with your sensors no matter what integration(s) provides them. To get the most from the card you may need to look at what various weather integrations provide in addition to the standard weather entity.

![Platinum Weather card](https://raw.githubusercontent.com/Makin-Things/platinum-weather-card/master/images/platinum-weather-card.png)
![Platinum Weather card](https://raw.githubusercontent.com/altrdev/platinum-weather-card/master/images/platinum-weather-card.png)

The design goals for the card are:

Expand All @@ -49,15 +45,15 @@ After installing the card you can add as many instances of the card the the dash
You MUST have already configured at least one weather integration to provde data for the card to use. As with all cards they only visualise data from backend entities. There are numerous weather integrations available in both the core and HACS. You will need to find one that is best suited to your location (some countries have multiple options with varying degrees of accuracy). It is possible to use entities from multiple integrations (it may require the use of template sensors to extract what you need).
When you first create a card it will show nothing until you go and select the entities you want to use in the GUI config, so a card that looks like this is not an error, but just needs configuring.

![Unconfigured card](https://raw.githubusercontent.com/Makin-Things/platinum-weather-card/master/images/unconfigured-card.png)
![Unconfigured card](https://raw.githubusercontent.com/altrdev/platinum-weather-card/master/images/unconfigured-card.png)

Most of the configuration should be reasonably obvious, but the following sections give more details. It is recommended that you at least have a read of both the 'Concepts' and 'Sections'. After that it is more of a reference for the various parts of the card if you need more information.

# Concepts

The card has sections, any of these sections can be enabled/disabled and reordered to suit your individual needs. Each section has its own configuration pages for the selection of entities and to control display and styling.

![Platinum Weather card](https://raw.githubusercontent.com/Makin-Things/platinum-weather-card/master/images/all-sections-highlighted.png)
![Platinum Weather card](https://raw.githubusercontent.com/altrdev/platinum-weather-card/master/images/all-sections-highlighted.png)

It is understood that everyone's use case may be different (and you may have limited data depending on the weather integration you are using), the default settings are aimed at maintaining compatibiltiy with the old bom/custom/darksky weather card that we are aiming to deprecate.
There is no reason that all of your weather data needs to be shown on a single card. This card allows you to have multiple instances with different configurations to achieve what you want.
Expand All @@ -74,25 +70,25 @@ On the cards main configuration dialog, use the switch to completely remove a se

This section as the name suggests, adds an overview section to the card.

![Platinum Weather card](https://raw.githubusercontent.com/Makin-Things/platinum-weather-card/master/images/overview-section-highlighted.png)
![Platinum Weather card](https://raw.githubusercontent.com/altrdev/platinum-weather-card/master/images/overview-section-highlighted.png)

There are 4 different layout options to choose from for the overview section. There are 'complete', 'observations', 'forecast' and 'title only'.

<caption>Complete</caption>

![Platinum Weather card](https://raw.githubusercontent.com/Makin-Things/platinum-weather-card/master/images/overview-section-complete.png 'Complete')
![Platinum Weather card](https://raw.githubusercontent.com/altrdev/platinum-weather-card/master/images/overview-section-complete.png 'Complete')

<caption>Observations</caption>

![Platinum Weather card](https://raw.githubusercontent.com/Makin-Things/platinum-weather-card/master/images/overview-section-observations.png 'Observations')
![Platinum Weather card](https://raw.githubusercontent.com/altrdev/platinum-weather-card/master/images/overview-section-observations.png 'Observations')

<caption>Forecast</caption>

![Platinum Weather card](https://raw.githubusercontent.com/Makin-Things/platinum-weather-card/master/images/overview-section-forecast.png 'Forecast')
![Platinum Weather card](https://raw.githubusercontent.com/altrdev/platinum-weather-card/master/images/overview-section-forecast.png 'Forecast')

<caption>Title Only</caption>

![Platinum Weather card](https://raw.githubusercontent.com/Makin-Things/platinum-weather-card/master/images/overview-section-title-only.png 'Title Only')
![Platinum Weather card](https://raw.githubusercontent.com/altrdev/platinum-weather-card/master/images/overview-section-title-only.png 'Title Only')

The fields available to fill in will be altered based on the layout chosen.

Expand All @@ -115,7 +111,7 @@ The various entity fields can either be a sensor that provides the value in its

A section that shows todays detailed forecast. To use this section you will need a weather integration that provides a more detailed weather forecast (this does not exist within the standard weather.\* sensor). If it is not available for your location the best thing to do is to disable the extended section.

![Platinum Weather card](https://raw.githubusercontent.com/Makin-Things/platinum-weather-card/master/images/extended-section-highlighted.png)
![Platinum Weather card](https://raw.githubusercontent.com/altrdev/platinum-weather-card/master/images/extended-section-highlighted.png)

The following fields are available.

Expand All @@ -131,7 +127,7 @@ The following fields are available.

A section to show a set of data in 2 columns (with up to 8 rows). This section is highly configurable. As you select different options for the slots the set of entities that are needed gets dynamically updated to indicate what options should be set.

![Platinum Weather card](https://raw.githubusercontent.com/Makin-Things/platinum-weather-card/master/images/slots-section-highlighted.png)
![Platinum Weather card](https://raw.githubusercontent.com/altrdev/platinum-weather-card/master/images/slots-section-highlighted.png)

The following table describes what each slot value is intended to show. Note that what is available is very dependant on the weather integration in use.

Expand Down Expand Up @@ -170,17 +166,17 @@ The following table describes what each slot value is intended to show. Note tha

A section to show the daily forecast for a specified number of days in either a horizontal or vertical layout.

![Platinum Weather card](https://raw.githubusercontent.com/Makin-Things/platinum-weather-card/master/images/daily-forecast-section-highlighted.png)
![Platinum Weather card](https://raw.githubusercontent.com/altrdev/platinum-weather-card/master/images/daily-forecast-section-highlighted.png)

There are two posible layouts.

<caption>Horizontal</caption>

![Platinum Weather card](https://raw.githubusercontent.com/Makin-Things/platinum-weather-card/master/images/daily-forecast-section-horizontal.png 'Horizontal')
![Platinum Weather card](https://raw.githubusercontent.com/altrdev/platinum-weather-card/master/images/daily-forecast-section-horizontal.png 'Horizontal')

<caption>Vertical</caption>

![Platinum Weather card](https://raw.githubusercontent.com/Makin-Things/platinum-weather-card/master/images/daily-forecast-section-vertical.png 'Vertical')
![Platinum Weather card](https://raw.githubusercontent.com/altrdev/platinum-weather-card/master/images/daily-forecast-section-vertical.png 'Vertical')

The following fields are available.

Expand All @@ -203,7 +199,7 @@ For these entities you can either specify a weather.\* sensor (except for extend

This page contains options that don't neatly fit in other places (ie. they have an effect on multiple sections).

![Platinum Weather card](https://raw.githubusercontent.com/Makin-Things/platinum-weather-card/master/images/global-options.png)
![Platinum Weather card](https://raw.githubusercontent.com/altrdev/platinum-weather-card/master/images/global-options.png)

The following fields are available.

Expand Down Expand Up @@ -370,6 +366,6 @@ This reference is here for completeness. All settings can be configured using th
| daily_extended_forecast_days | Number | `7` | Show extended forecast. (only for vertical forecast `(1-7)`) |
| option_daily_color_fire_danger | Boolean | `true` | Use color attributes from fire danger if set (oly for vertical forecast) |

[license-shield]: https://img.shields.io/github/license/makin-things/platinum-weather-card.svg?style=for-the-badge
[releases-shield]: https://img.shields.io/github/release/makin-things/platinum-weather-card.svg?style=for-the-badge
[releases]: https://github.com/makin-things/platinum-weather-card/releases
[license-shield]: https://img.shields.io/github/license/altrdev/platinum-weather-card.svg?style=for-the-badge
[releases-shield]: https://img.shields.io/github/release/altrdev/platinum-weather-card.svg?style=for-the-badge
[releases]: https://github.com/altrdev/platinum-weather-card/releases
4 changes: 2 additions & 2 deletions hacs.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Platinum Weather Card ES",
"hacs": "1.1.3",
"name": "Platinum Weather Card",
"hacs": "1.26.0",
"render_readme": true,
"hide_default_branch": true
}
19 changes: 6 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "platinum-weather-card-es",
"name": "platinum-weather-card",
"version": "1.1.3",
"description": "platinum-weather-card-es",
"description": "platinum-weather-card",
"keywords": [
"home-assistant",
"homeassistant",
Expand All @@ -11,8 +11,8 @@
"custom-cards"
],
"module": "platinum-weather-card.js",
"repository": "[email protected]: /platinum-weather-card-es.git",
"author": "figorr",
"repository": "[email protected]: /platinum-weather-card.git",
"author": "Simon <[email protected]>",
"license": "MIT",
"dependencies": {
"@lit-labs/scoped-registry-mixin": "^1.0.1",
Expand Down Expand Up @@ -50,15 +50,8 @@
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-serve": "^1.1.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.30.0",
"typescript": "^4.8.4",
"tslib": "^2.3.0"
},
"resolutions": {
"lit": "^2.1.2",
"lit-html": "2.1.2",
"lit-element": "3.1.2",
"@lit/reactive-element": "1.2.1"
"rollup-plugin-typescript2": "^0.34.0",
"typescript": "^4.8.4"
},
"scripts": {
"start": "rollup -c rollup.config.dev.js --watch",
Expand Down
14 changes: 9 additions & 5 deletions rollup.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,19 @@ export default {
},
plugins: [
resolve(),
typescript({ transformers: [service => ({
before: [ keysTransformer(service.getProgram()) ],
after: []
})] }),
typescript({
transformers: [
(service) => ({
before: [keysTransformer(service.getProgram())],
after: [],
}),
],
}),
json(),
babel({
exclude: 'node_modules/**',
}),
// terser(),
terser(),
serve({
contentBase: './dist',
host: '0.0.0.0',
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions test/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
HASS_USERNAME=dev
HASS_PASSWORD=dev
LOVELACE_LOCAL_FILES=dist/platinum-weather-card.js
11 changes: 11 additions & 0 deletions test/configuration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
default_config:

demo:

lovelace:
mode: storage
dashboards:
lovelace-yaml:
mode: yaml
title: yaml
filename: test/lovelace.yaml
Loading

0 comments on commit c3c3b3b

Please sign in to comment.