Skip to content

Commit

Permalink
feat: add list of services without PG (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
legendik authored Jan 24, 2025
1 parent 94e763a commit e4a290d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
11 changes: 5 additions & 6 deletions custom_components/jablotron_cloud/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from homeassistant.core import HomeAssistant
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed

from .const import DOMAIN, SERVICE_ID, SERVICE_TYPE
from .const import DOMAIN, SERVICE_ID, SERVICE_TYPE, SERVICES_WITHOUT_PG

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -131,10 +131,10 @@ async def _async_update_data(self):
service_type = service[SERVICE_TYPE]

_LOGGER.debug("Loading data for service %d", service_id)
if service_type == 'LOGBOOK':
if service_type in SERVICES_WITHOUT_PG:
_LOGGER.debug("Service type %s not supported. Skipping service %d", service_type, service_id)
continue

try:
gates = await self.hass.async_add_executor_job(
self.bridge.get_programmable_gates, service_id, service_type
Expand All @@ -143,7 +143,7 @@ async def _async_update_data(self):
self.api_fail_count += 1
_LOGGER.debug(f"Failed to get gates data for service {service_id}")
raise UpdateFailed(f"Failed to get gates data for service {service_id}") from error

try:
sections = await self.hass.async_add_executor_job(
self.bridge.get_sections, service_id, service_type
Expand All @@ -162,7 +162,7 @@ async def _async_update_data(self):
_LOGGER.debug(f"Failed to get thermo data for service {service_id}")
raise UpdateFailed(f"Failed to get thermo data for service {service_id}") from error


data[service_id] = {}
data[service_id]["service"] = service
data[service_id]["gates"] = gates
Expand All @@ -175,4 +175,3 @@ async def _async_update_data(self):

self.is_first_update = False
return data

1 change: 1 addition & 0 deletions custom_components/jablotron_cloud/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
PG_STATE = "state"
PG_STATE_OFF = "OFF"

SERVICES_WITHOUT_PG = ["FUTURA2", "AMBIENTA", "VOLTA", "LOGBOOK"]

class Actions(StrEnum):
"""Actions to control sections."""
Expand Down

0 comments on commit e4a290d

Please sign in to comment.