Skip to content

Commit

Permalink
Added error logs for get_entity()
Browse files Browse the repository at this point in the history
  • Loading branch information
Big-Tree committed Jan 10, 2024
1 parent 9a83f2c commit 26f0a8f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion custom_components/optispark/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from .api import OptisparkApiClient
from .const import DOMAIN
from .const import DOMAIN, LOGGER

PLATFORMS: list[Platform] = [
Platform.SENSOR,
Expand Down Expand Up @@ -82,6 +82,10 @@ def get_entity(hass, entity_id):
entities_found.append(entity)
successful_domains.append(domain)
if len(entities_found) != 1:
LOGGER.error(f'({len(entities_found)}) entities found instead of 1')
LOGGER.error(f'successful_domains:\n {successful_domains}')
LOGGER.error(f'entities_found:\n {entities_found}')
LOGGER.error(f'hass.data.keys():\n {hass.data.keys()}')
raise OptisparkGetEntityError(f'({len(entities_found)}) entities found instead of 1')
return entities_found[0]

Expand Down
2 changes: 1 addition & 1 deletion custom_components/optispark/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

NAME = "Optispark"
DOMAIN = "optispark"
VERSION = "0.1.2"
VERSION = "0.1.3"
ATTRIBUTION = "Data provided by http://jsonplaceholder.typicode.com/"

LAMBDA_TEMP = 'temps'
Expand Down
2 changes: 1 addition & 1 deletion custom_components/optispark/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/Big-Tree/HomeAssistant-OptiSpark/issues",
"requirements": ["geopy==2.4.1"],
"version": "0.1.2"
"version": "0.1.3"
}

0 comments on commit 26f0a8f

Please sign in to comment.