Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: pantherale0/ha-fuelprices
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2025.1.0
Choose a base ref
...
head repository: pantherale0/ha-fuelprices
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
  • 17 commits
  • 25 files changed
  • 1 contributor

Commits on Jan 28, 2025

  1. bump pyfuelprices

    pantherale0 authored Jan 28, 2025
    Copy the full SHA
    0e27c58 View commit details

Commits on Feb 3, 2025

  1. UpdateFailedError log exception message rather than raising updatefai…

    …led error (#33)
    
    add pyfuelprices as a logger (#33)
    pantherale0 authored Feb 3, 2025
    Copy the full SHA
    d7b97d1 View commit details
  2. update config flow version (#33)

    remove jet and morrisons in config version 3 as migration path (#33)
    pantherale0 authored Feb 3, 2025
    Copy the full SHA
    3fabd23 View commit details

Commits on Feb 11, 2025

  1. 2025.2.0 (#34)

    * bump pyfuelprices
    
    * Add PetrolPrices
    Config wizard updates
    CheapestFuelSensor entities now only update once per update interval
    Services now expose optional source parameter
    All entities can now contain the source config entry
    Runtime data now contains config entry
    
    * Add documentation to repo
    
    * fix Service find_fuel_station has a field source with no name and is not in the translations file
    
    * Update en translation
    
    * update docs url
    
    * restructure docs
    
    * fix documentation build script
    
    * update coordinator exception handling
    
    * fix FuelStationTracker spelling
    
    * auto release creator
    pantherale0 authored Feb 11, 2025
    Copy the full SHA
    56511e7 View commit details
  2. fix version template

    pantherale0 authored Feb 11, 2025
    Copy the full SHA
    cd64755 View commit details
  3. update workflows

    pantherale0 authored Feb 11, 2025
    Copy the full SHA
    d64e0df View commit details
  4. Copy the full SHA
    421225f View commit details
  5. update version template

    pantherale0 authored Feb 11, 2025
    Copy the full SHA
    b6f001c View commit details
  6. update release drafter

    pantherale0 authored Feb 11, 2025
    Copy the full SHA
    97a9d46 View commit details
  7. update workflow

    pantherale0 authored Feb 11, 2025
    Copy the full SHA
    3e6a536 View commit details
  8. FEAT: Add country codes to config flow (#36)

    * Update release drafter
    
    * Add country codes to data source selector
    pantherale0 authored Feb 11, 2025
    Copy the full SHA
    5354454 View commit details
  9. Copy the full SHA
    bf855ec View commit details
  10. Update Automated Release Workflow Config (#40)

    * downgrade release drafter
    
    * update release drafter config
    pantherale0 authored Feb 11, 2025
    Copy the full SHA
    29310c9 View commit details
  11. Copy the full SHA
    b9e5360 View commit details

Commits on Feb 12, 2025

  1. Copy the full SHA
    1664bbc View commit details
  2. UK: Add support for podpoint (#42)

    * Bump pyfuelprices to 2025.2.5
    pantherale0 authored Feb 12, 2025
    Copy the full SHA
    1904197 View commit details
  3. Update README.md (#43)

    pantherale0 authored Feb 12, 2025
    Copy the full SHA
    f4185dd View commit details
47 changes: 47 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
include-pre-releases: true
categories:
- title: Breaking Changes 🛠
labels:
- breaking-change
- title: 'New Features 🎉'
labels:
- 'feature'
- 'enhancement'
- title: 'Bug Fixes 🛠'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: 'Documentation'
labels:
- 'docs'
- title: '👒 Dependencies and extras'
collapse-after: 3
labels:
- 'chore'
- 'dependencies'
exclude-labels:
- 'ignore-for-release'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&'
autolabeler:
- label: 'docs'
branch:
- '/docs{0,1}\/.+/'
- label: 'chore'
files:
- '*.md'
- '*.yml'
branch:
- '/docs{0,1}\/.+/'
- '/chore\/.+/'
- label: 'bug'
branch:
- '/fix\/.+/'
- label: 'enhancement'
branch:
- '/feature\/.+/'
template: |
## Changes
$CHANGES
20 changes: 20 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
changelog:
exclude:
labels:
- ignore-for-release
categories:
- title: Breaking Changes 🛠
labels:
- breaking-change
- title: New Features 🎉
labels:
- enhancement
- title: Bug Fixes 🛠
labels:
- bug-fix
- title: 👒 Dependencies
labels:
- dependencies
- title: Other Changes
labels:
- "*"
31 changes: 31 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: documentation
on:
push:
branches:
- main
paths:
- "docs/**"
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- name: "Install requirements"
run: python3 -m pip install -r "${{ github.workspace }}/requirements.docs.txt"
- run: mkdocs gh-deploy --force
25 changes: 14 additions & 11 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -4,6 +4,9 @@ on:
push:
branches:
- "main"
paths-ignore:
- "docs/**"
- ".github/**"
pull_request:
branches:
- "main"
@@ -13,17 +16,17 @@ jobs:
name: "Ruff"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout the repository"
uses: "actions/checkout@v4.1.0"
- name: "Checkout the repository"
uses: "actions/checkout@v4.1.0"

- name: "Set up Python"
uses: actions/setup-python@v4.7.1
with:
python-version: "3.12"
cache: "pip"
- name: "Set up Python"
uses: actions/setup-python@v4.7.1
with:
python-version: "3.12"
cache: "pip"

- name: "Install requirements"
run: python3 -m pip install -r requirements.txt
- name: "Install requirements"
run: python3 -m pip install -r requirements.txt

- name: "Run"
run: python3 -m ruff check .
- name: "Run"
run: python3 -m ruff check .
36 changes: 36 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Release Drafter

on:
push:
branches:
- main
paths:
- "**"
- "!docs/**"
- "!.github/**"
pull_request:
types: [opened, reopened, synchronize]

permissions:
contents: read

jobs:
update_release_draft:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Generate CalVer version
id: calver
run: |
export CALVER=$(date "+%Y.%-m")
echo "version=${CALVER}" >> $GITHUB_OUTPUT
echo "Version set to ${CALVER}"
- uses: release-drafter/release-drafter@v6.0.0
with:
name: ${{ steps.calver.outputs.version }}
tag: ${{ steps.calver.outputs.version }}
version: ${{ steps.calver.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25 changes: 14 additions & 11 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -3,10 +3,13 @@ name: "Validate"
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
- cron: "0 0 * * *"
push:
branches:
- "main"
paths-ignore:
- "docs/**"
- ".github/**"
pull_request:
branches:
- "main"
@@ -16,20 +19,20 @@ jobs:
name: "Hassfest Validation"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout the repository"
uses: "actions/checkout@v4.1.0"
- name: "Checkout the repository"
uses: "actions/checkout@v4.1.0"

- name: "Run hassfest validation"
uses: "home-assistant/actions/hassfest@master"
- name: "Run hassfest validation"
uses: "home-assistant/actions/hassfest@master"

hacs: # https://github.com/hacs/action
name: "HACS Validation"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout the repository"
uses: "actions/checkout@v4.1.0"
- name: "Checkout the repository"
uses: "actions/checkout@v4.1.0"

- name: "Run HACS validation"
uses: "hacs/action@main"
with:
category: "integration"
- name: "Run HACS validation"
uses: "hacs/action@main"
with:
category: "integration"
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@

[![GitHub Release][releases-shield]][releases]
[![GitHub Activity][commits-shield]][commits]
![Install Stats][stats]
[![License][license-shield]](LICENSE)

![Project Maintenance][maintenance-shield]
@@ -56,6 +57,7 @@ If you want to contribute to this please read the [Contribution guidelines](CONT
[buymecoffee]: https://www.buymeacoffee.com/pantherale0
[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/pantherale0/ha-fuelprices.svg?style=for-the-badge
[stats]: https://img.shields.io/badge/dynamic/json?color=41BDF5&logo=home-assistant&label=integration%20usage&suffix=%20installs&cacheSeconds=15600&url=https://analytics.home-assistant.io/custom_integrations.json&query=$.fuel_prices.total&style=for-the-badge
[commits]: https://github.com/pantherale0/ha-fuelprices/commits/main
[discord]: https://discord.gg/Qa5fW2R
[discord-shield]: https://img.shields.io/discord/330944238910963714.svg?style=for-the-badge
2 changes: 1 addition & 1 deletion config/configuration.yaml
Original file line number Diff line number Diff line change
@@ -11,4 +11,4 @@ logger:
# Enable VSCode debugging
debugpy:
start: true
wait: true
wait: false
34 changes: 22 additions & 12 deletions custom_components/fuel_prices/__init__.py
Original file line number Diff line number Diff line change
@@ -39,6 +39,7 @@ class FuelPricesConfig:

coordinator: FuelPricesCoordinator
areas: list[dict]
config: ConfigEntry


type FuelPricesConfigEntry = ConfigEntry[FuelPricesConfig]
@@ -92,10 +93,11 @@ async def handle_fuel_lookup(call: ServiceCall) -> ServiceResponse:
lat = call.data.get("location", {}).get("latitude", default_lat)
long = call.data.get("location", {}).get("longitude", default_long)
fuel_type = call.data.get("type")
source = call.data.get("source", "")
try:
return {
"fuels": await fuel_prices.find_fuel_from_point(
(lat, long), radius, fuel_type
(lat, long), radius, fuel_type, source
)
}
except ValueError as err:
@@ -110,9 +112,10 @@ async def handle_fuel_location_lookup(call: ServiceCall) -> ServiceResponse:
radius = radius / 1609
lat = call.data.get("location", {}).get("latitude", default_lat)
long = call.data.get("location", {}).get("longitude", default_long)
source = call.data.get("source", "")
try:
locations = await fuel_prices.find_fuel_locations_from_point(
(lat, long), radius
(lat, long), radius, source
)
except ValueError as err:
raise HomeAssistantError(
@@ -140,7 +143,8 @@ async def handle_force_update(call: ServiceCall):

hass.services.async_register(DOMAIN, "force_update", handle_force_update)

entry.runtime_data = FuelPricesConfig(coordinator=coordinator, areas=areas)
entry.runtime_data = FuelPricesConfig(
coordinator=coordinator, areas=areas, config=entry)

await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)

@@ -168,26 +172,32 @@ async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry):
_LOGGER.debug("Migrating configuration from version %s",
config_entry.version)

if config_entry.version > 1:
new_data = {**config_entry.data}
if config_entry.options:
new_data = {**config_entry.options}

if config_entry.version > 2:
# This means the user has downgraded from a future version
return False

if config_entry.version == 1:
if config_entry.version == 2:
_LOGGER.warning("Removing jet and morrisons from config entry.")
if "morrisons" in new_data[CONF_SOURCES]:
new_data[CONF_SOURCES].remove("morrisons")
hass.config_entries.async_update_entry(
config_entry, data=new_data, version=3
)

new_data = {**config_entry.data}
if config_entry.options:
new_data = {**config_entry.options}
if config_entry.version == 1:
for area in new_data[CONF_AREAS]:
_LOGGER.debug("Upgrading area definition for %s", area[CONF_NAME])
area[CONF_CHEAPEST_SENSORS] = False
area[CONF_CHEAPEST_SENSORS_COUNT] = 5
area[CONF_CHEAPEST_SENSORS_FUEL_TYPE] = ""

hass.config_entries.async_update_entry(
config_entry, data=new_data, version=2)

_LOGGER.debug("Migration to configuration version %s successful",
config_entry.version)
_LOGGER.info("Migration to configuration version %s successful",
config_entry.version)

return True

Loading