Skip to content

Commit

Permalink
LT translation, workflow, some cleanup of init
Browse files Browse the repository at this point in the history
  • Loading branch information
Brunas committed Jul 22, 2024
1 parent b938772 commit 42f159e
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 7 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: HACS validation

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

jobs:
validate:
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: "actions/checkout@v3"
- name: Hassfest
uses: "home-assistant/actions/hassfest@master"
- name: HACS validation
uses: "hacs/action@main"
with:
CATEGORY: integration
13 changes: 7 additions & 6 deletions custom_components/meteo_lt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,12 @@
from .const import DOMAIN, LOGGER
from .coordinator import MeteoLtCoordinator

async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Meteo.Lt component."""
LOGGER.info("Setting up Meteo.Lt")
hass.data.setdefault(DOMAIN, {})
return True

async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Meteo.Lt from a config entry."""
LOGGER.info("Setting up Meteo.Lt from config entry")

hass.data.setdefault(DOMAIN, {})

api = MeteoLtAPI()
latitude = entry.data.get("latitude", hass.config.latitude)
longitude = entry.data.get("longitude", hass.config.longitude)
Expand All @@ -29,6 +25,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
coordinator = MeteoLtCoordinator(hass, api, nearest_place)
await coordinator.async_refresh()

entry.async_on_unload(entry.add_update_listener(_async_update_listener))
hass.data[DOMAIN][entry.entry_id] = {
"api": api,
"nearest_place": nearest_place,
Expand All @@ -48,3 +45,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
hass.data[DOMAIN].pop(entry.entry_id)

return unload_ok

async def _async_update_listener(hass: HomeAssistant, entry: ConfigEntry) -> None:
"""Update listener."""
await hass.config_entries.async_reload(entry.entry_id)
2 changes: 1 addition & 1 deletion custom_components/meteo_lt/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"domain": "meteo_lt",
"name": "Meteo.LT",
"version": "0.1.4",
"version": "0.1.5",
"codeowners": ["@Brunas"],
"config_flow": true,
"documentation": "https://github.com/Brunas/meteo_lt",
Expand Down
27 changes: 27 additions & 0 deletions custom_components/meteo_lt/translations/lt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"title": "Meteo.Lt integracija",
"config": {
"step": {
"user": {
"title": "Konfigūruoti Meteo.Lt",
"description": "Nustatyti Meteo.Lt integraciją su Home Assistant.",
"data": {
"latitude": "Platuma (latitude)",
"longitude": "Ilguma (longitude)"
}
},
"reconfigure": {
"title": "Perkonfigūruoti Meteo.Lt",
"description": "Atnaujinti Meteo.Lt integracijos nustatymus.",
"data": {
"latitude": "Platuma (latitude)",
"longitude": "Ilguma (longitude)"
}
},
"reconfigure_confirm": {
"title": "Patvirtinti perkonfigūravimą",
"description": "Ar jūs tikrai norite perkonfigūruoti Meteo.Lt integraciją?"
}
}
}
}

0 comments on commit 42f159e

Please sign in to comment.