Skip to content

Commit

Permalink
Quota not supported in GB (#134)
Browse files Browse the repository at this point in the history
* Quota not supported in GB

* Add word NOT to error message

---------

Co-authored-by: Rudolf Offereins <[email protected]>
  • Loading branch information
ColinRobbins and Sholofly authored Oct 23, 2024
1 parent 08e7eca commit 2cc9210
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion custom_components/lghorizon/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
from homeassistant.core import HomeAssistant
from .const import (
API,
DOMAIN,
CONF_COUNTRY_CODE,
COUNTRY_CODES,
DOMAIN
)
from datetime import timedelta
import logging
Expand All @@ -23,6 +25,12 @@ async def async_setup_entry(
) -> None:
"""Setup platform"""
sensors = []

country = COUNTRY_CODES[entry.data[CONF_COUNTRY_CODE]][0:2]
if country == "gb":
_LOGGER.debug("Recording capacity feature not available in GB. No sensor added.")
return

api: LGHorizonApi = hass.data[DOMAIN][entry.entry_id][API]
capacity = await hass.async_add_executor_job(api.get_recording_capacity)
if not capacity:
Expand Down

0 comments on commit 2cc9210

Please sign in to comment.