Skip to content

Commit c901c1c

Browse files
Merge pull request #48 from BottlecapDave/develop
New release
2 parents 8a0dd10 + 757e873 commit c901c1c

File tree

9 files changed

+49
-42
lines changed

9 files changed

+49
-42
lines changed

.build/createGithubRelease.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1+
import { readFileSync } from 'fs';
2+
import { join } from 'path';
3+
14
const bodySuffix = "---\nEnjoying the integration? Why not make a one time or monthly [GitHub sponsorship](https://github.com/sponsors/bottlecapdave)?"
25

6+
function getMinimumHomeAssistantVersion() {
7+
const hacsFilePath = join(__dirname, '../hacs.json');
8+
const buffer = readFileSync(hacsFilePath);
9+
const content = JSON.parse(buffer.toString());
10+
return content.homeassistant;
11+
}
312
async function createGithubRelease(githubToken: string, githubOwnerRepo: string, tag: string, notes: string) {
413
if (!githubToken) {
514
throw new Error('Github token not specified');
@@ -45,9 +54,10 @@ async function createGithubRelease(githubToken: string, githubOwnerRepo: string,
4554
}
4655
}
4756

57+
const minimumHAVersionNote = `\n**Minimum HA Version**: ${getMinimumHomeAssistantVersion()}\n\n`;
4858
createGithubRelease(
4959
process.env.GITHUB_TOKEN,
5060
process.env.GITHUB_REPOSITORY,
5161
process.argv[2],
52-
`${process.argv[3]}\n${bodySuffix}`
62+
`${process.argv[3]}\n${minimumHAVersionNote}${bodySuffix}`
5363
).then(() => console.log('Success'));

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Main
22
on:
33
schedule:
4-
- cron: '0 1 * * *'
4+
- cron: '0 6 * * *'
55
push:
66
branches:
77
- develop

_docs/faq.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ The `ATCO code` for your stop can be found in the same way that [UK Transport](h
1111

1212
However, there have been reports of missing ATCO codes. Therefore alternatively, you can follow the following instructions:
1313

14-
1. Navigate to https://www.firstbus.co.uk/next-bus and type your location
14+
1. Navigate to [First Bus website](https://www.firstbus.co.uk/next-bus) and type your location
1515
2. Open up the development tools on your browser (usually F12) and go to the network tab
16-
3. Click on the stop that you're after and look at the network request. This should make a request to https://www.firstbus.co.uk/api/get-next-bus?stop=XXX. The value you're after will be in the response and also the value of XXX.
16+
3. Click on the stop that you're after and look at the network request. This should make a request to `https://www.firstbus.co.uk/api/get-next-bus?stop=XXX`. The value you're after will be in the response and also the value of XXX.
1717

1818
## How do I increase the logs for the integration?
1919

_docs/index.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,23 @@ This is unofficial and in no way endorsed by First Bus.
88

99
This component uses a private API used by [First Bus website](https://www.firstbus.co.uk/next-bus), so it could break at any time. I will do my best to keep the component working.
1010

11+
## How to install
12+
13+
### HACS
14+
15+
[![hacs_badge](https://img.shields.io/badge/HACS-Default-41BDF5.svg?style=for-the-badge)](https://github.com/hacs/integration)
16+
17+
This integration can be installed directly via HACS. To install:
18+
19+
* [Add the repository](https://my.home-assistant.io/redirect/hacs_repository/?owner=BottlecapDave&repository=homeassistant-firstbus&category=integration) to your HACS installation
20+
* Click `Download`
21+
22+
### Manual
23+
24+
You should take the latest [published release](https://github.com/BottlecapDave/HomeAssistant-FirstBus/releases). The current state of `develop` will be in flux and therefore possibly subject to change.
25+
26+
To install, place the contents of `custom_components` into the `<config directory>/custom_components` folder of your Home Assistant installation. Once installed, don't forget to restart your home assistant instance for the integration to be picked up.
27+
1128
## How to setup
1229

1330
Please follow the [setup guide](./setup.md) to setup your initial account. This guide details the configuration, along with the entities that will be available to you.
Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
import logging
21
from homeassistant.util.dt import utcnow
3-
import asyncio
42

53
from .const import (
64
DOMAIN,
75
)
86

7+
PLATFORMS = ["sensor"]
8+
99
async def async_setup_entry(hass, entry):
1010
"""This is called from the config flow."""
1111
hass.data.setdefault(DOMAIN, {})
1212

1313
# Forward our entry to setup our default sensors
14-
hass.async_create_task(
15-
hass.config_entries.async_forward_entry_setup(entry, "sensor")
16-
)
14+
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
1715

1816
return True
1917

@@ -24,10 +22,6 @@ async def options_update_listener(hass, entry):
2422
async def async_unload_entry(hass, entry):
2523
"""Unload a config entry."""
2624

27-
unload_ok = all(
28-
await asyncio.gather(
29-
*[hass.config_entries.async_forward_entry_unload(entry, "sensor")]
30-
)
31-
)
25+
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
3226

3327
return unload_ok

custom_components/first_bus/translations/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"Buses": "Buses"
1212
},
1313
"data_description": {
14-
"Stop": "Instructions to find your ATCO code can be found at https://github.com/BottlecapDave/HomeAssistant-FirstBus#atco-code",
14+
"Stop": "Instructions to find your ATCO code can be found at https://bottlecapdave.github.io/HomeAssistant-FirstBus/faq/#how-do-i-find-my-atco-code",
1515
"Buses": "You can filter to specific buses, comma separated, or leave blank to see all buses"
1616
}
1717
}

hacs.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"name": "First Bus",
3-
"render_readme": true
3+
"render_readme": true,
4+
"homeassistant": "2022.8.0"
45
}

package-lock.json

Lines changed: 9 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
},
2323
"homepage": "https://github.com/BottlecapDave/HomeAssistant-FirstBus#readme",
2424
"devDependencies": {
25-
"@semantic-release/changelog": "^6.0.1",
25+
"@semantic-release/changelog": "^6.0.3",
2626
"@semantic-release/exec": "^6.0.2",
2727
"@semantic-release/git": "^10.0.1",
2828
"commitizen": "^4.3.0",
2929
"conventional-changelog-eslint": "^3.0.9",
3030
"cz-customizable": "^6.3.0",
3131
"husky": "^4.3.8",
3232
"semantic-release": "^22.0.5",
33-
"ts-node": "^10.9.1",
33+
"ts-node": "^10.9.2",
3434
"typescript": "^5.2.2"
3535
},
3636
"config": {

0 commit comments

Comments
 (0)