Skip to content

Commit

Permalink
add translations for service
Browse files Browse the repository at this point in the history
  • Loading branch information
Roeland authored and Roeland committed Sep 11, 2024
1 parent 47dfd0c commit ae5a4d2
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 16 deletions.
4 changes: 2 additions & 2 deletions custom_components/entsoe/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def check_update_needed(self, now):
return True
if len(self.get_data_today()) != 24:
return True
if len(self.get_data_tomorrow()) != 24 and now.hour > 12:
if len(self.get_data_tomorrow()) != 24 and now.hour > 11:
return True
return False

Expand Down Expand Up @@ -167,7 +167,7 @@ async def get_energy_prices(self, start_date, end_date):
for k, v in self.data.items()
if k.date() >= start_date.date() and k.date() <= end_date.date()
}
return await self.fetch_prices(start_date, end_date)
return self.parse_hourprices(await self.fetch_prices(start_date, end_date))

def today_data_available(self):
return len(self.get_data_today()) == 24
Expand Down
2 changes: 1 addition & 1 deletion custom_components/entsoe/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
def __get_date(date_input: str | None) -> date | datetime:
"""Get date."""
if not date_input:
return dt_util.now().date()
return dt_util.now()

if value := dt_util.parse_datetime(date_input):
return value
Expand Down
46 changes: 33 additions & 13 deletions custom_components/entsoe/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
"config": {
"step": {
"user": {
"description": "Please add the ENTSO-e Transparency Platform API key and area",
"data": {
"api_key": "Your API Key",
"area": "Area*",
"advanced_options": "I want to set VAT, template and calculation method (next step)",
"modifyer": "Price Modifyer Template (Optional)",
"currency": "Currency of the modified price (Optional)",
"name": "Name (Optional)"
}
"description": "Please add the ENTSO-e Transparency Platform API key and area",
"data": {
"api_key": "Your API Key",
"area": "Area*",
"advanced_options": "I want to set VAT, template and calculation method (next step)",
"modifyer": "Price Modifyer Template (Optional)",
"currency": "Currency of the modified price (Optional)",
"name": "Name (Optional)"
}
},
"extra": {
"data":{
"data": {
"VAT_value": "VAT tariff",
"modifyer": "Price Modifyer Template (Optional)",
"currency": "Currency of the modified price (Optional)"
Expand All @@ -24,7 +24,7 @@
"invalid_template": "Invalid template, check https://github.com/JaccoR/hass-entso-e",
"missing_current_price": "'current_price' is missing from the template, check https://github.com/JaccoR/hass-entso-e",
"already_configured": "Integration instance with the same name already exists"
}
}
},
"options": {
"step": {
Expand All @@ -44,6 +44,26 @@
"invalid_template": "Invalid Template, Check https://github.com/JaccoR/hass-entso-e",
"missing_current_price": "'current_price' is missing from the template, check https://github.com/JaccoR/hass-entso-e",
"already_configured": "Integration instance with the same name already exists"
}
},
"services": {
"get_energy_prices": {
"name": "Get energy prices",
"description": "Request prices for a specified range from entso-e",
"fields": {
"config_entry": {
"name": "Config Entry",
"description": "The config entry to use for this service."
},
"start": {
"name": "Start",
"description": "Specifies the date and time from which to retrieve prices. Defaults to today if omitted."
},
"end": {
"name": "End",
"description": "Specifies the date and time until which to retrieve prices. Defaults to today if omitted."
}
}
}
}
}
}
}
20 changes: 20 additions & 0 deletions custom_components/entsoe/translations/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,25 @@
"missing_current_price": "'current_price' is missing from the template",
"already_configured": "Integration instance with the same name already exists"
}
},
"services": {
"get_energy_prices": {
"name": "Get energy prices",
"description": "Request prices for a specified range from entso-e",
"fields": {
"config_entry": {
"name": "Config Entry",
"description": "The config entry to use for this service."
},
"start": {
"name": "Start",
"description": "Specifies the date and time from which to retrieve prices. Defaults to today if omitted."
},
"end": {
"name": "End",
"description": "Specifies the date and time until which to retrieve prices. Defaults to today if omitted."
}
}
}
}
}

0 comments on commit ae5a4d2

Please sign in to comment.