Skip to content

Commit c4dbce2

Browse files
committed
Remove unnecessary user configuration field
1 parent 8c77f9d commit c4dbce2

File tree

2 files changed

+16
-20
lines changed

2 files changed

+16
-20
lines changed

README.md

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,24 +39,24 @@ The above configuration can be managed in the Configuration -> Dashboards -> Res
3939
| Name | Type | Default | Description |
4040
|--------|--------|-----------------|-------------------------------------------|
4141
| type | string | **Required** | `custom:github-entity-row` |
42-
| user | string | **Required** | Your GitHub user name |
43-
| repo | string | **Required** | Your GitHub repository |
42+
| repo | string | **Required** | Your GitHub repository path |
4443
| sensor | string | `<user>_<repo>` | Specify a custom sensor entity (optional) |
4544
| name | string | `repo` | Override repository name |
4645
| icon | string | `mdi:github` | Override default entity icon |
4746

48-
The `user` and `repo` fields need to exactly match your GitHub user and repository names. If you rename the sensor
49-
entity IDs from the GitHub integration, you can specify the updated sensor ID with the `sensor` field (without the
50-
domain and type suffix). For example, if the integration exposes `sensor.custom_sensor_id_latest_release`, you should
51-
specify `custom_sensor_id`.
47+
The `repo` field needs to exactly match your GitHub user and repository path, i.e. `benct/lovelace-github-entity-row`.
48+
49+
If you rename the sensor entity IDs from the GitHub integration, you can specify the updated sensor ID with the `sensor`
50+
field (without the domain and type suffix). For example, if the integration
51+
exposes `sensor.custom_sensor_id_latest_release`, you should specify `custom_sensor_id`.
5252

5353
## Migrate to version 2
5454

5555
The GitHub [integration](https://www.home-assistant.io/integrations/github/) was changed in HA version `2022.2.0` to
5656
include several sensors for each GitHub repository. If you are using the latest HA installation, you need to upgrade to
57-
version `>2.0.0` of this card. The main change is that the `entity` field has been replaced by `user` and `repo`. You
58-
might also need to manually enable the following sensors from your GitHub integration; `Stars`, `Issues`
59-
and `Pull Requests`.
57+
version `>2.0.0` of this card. The main change is that the `entity` field has been replaced by ~~user
58+
and~~ `repo` (`user` removed in `2.1.0`). You might also need to manually enable the following sensors from your GitHub
59+
integration; `Stars`, `Issues` and `Pull Requests`.
6060

6161
## Example
6262

@@ -67,19 +67,15 @@ type: entities
6767
title: GitHub
6868
entities:
6969
- type: custom:github-entity-row
70-
user: benct
71-
repo: home-assistant-config
70+
repo: benct/home-assistant-config
7271
name: HA Config
7372
- type: custom:github-entity-row
74-
user: benct
75-
repo: lovelace-github-entity-row
73+
repo: benct/lovelace-github-entity-row
7674
icon: mdi:github
7775
- type: custom:github-entity-row
78-
user: benct
79-
repo: lovelace-multiple-entity-row
76+
repo: benct/lovelace-multiple-entity-row
8077
- type: custom:github-entity-row
81-
user: benct
82-
repo: lovelace-xiaomi-vacuum-card
78+
repo: benct/lovelace-xiaomi-vacuum-card
8379
```
8480

8581
## My cards

github-entity-row.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ class GithubEntityRow extends Polymer.Element {
4646

4747
goto(event, path) {
4848
event.stopPropagation();
49-
window.open(`https://github.com/${this._config.user}/${this._config.repo}/${path}`);
49+
window.open(`https://github.com/${this._config.repo}/${path}`);
5050
}
5151

5252
setConfig(config) {
53-
if (!config.user || !config.repo) throw new Error('Please define a GitHub user and repository.');
53+
if (!config.repo) throw new Error('Please define a GitHub repository path.');
5454

55-
const sensor = config.sensor || `${config.user}_${config.repo}`.replaceAll('-', '_');
55+
const sensor = config.sensor || config.repo.replaceAll('-', '_').replaceAll('/', '_');
5656
this._config = {
5757
...config,
5858
name: config.name || config.repo,

0 commit comments

Comments
 (0)