Skip to content

Commit

Permalink
🐛 修复勾选默认加载所有实体时报错的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
banto6 committed Jul 7, 2023
1 parent dd2cf70 commit 1405619
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions custom_components/haier/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):

coordinators = []
for device in filtered_devices:
_LOGGER.debug('Device Info: {}'.format(device.__dict__))
try:
sw_version = 'N/A'
if not device.is_virtual:
Expand Down Expand Up @@ -143,11 +144,12 @@ async def async_register_entity(hass: HomeAssistantType, entry: ConfigEntry, asy
_LOGGER.warning('{} not found in the data source'.format(spec['key']))
continue

if cfg[CONF_FILTER_TYPE] == 'exclude' and spec['key'] in cfg[CONF_TARGET_ENTITIES]:
continue
if cfg is not None:
if cfg[CONF_FILTER_TYPE] == 'exclude' and spec['key'] in cfg[CONF_TARGET_ENTITIES]:
continue

if cfg[CONF_FILTER_TYPE] == 'include' and spec['key'] not in cfg[CONF_TARGET_ENTITIES]:
continue
if cfg[CONF_FILTER_TYPE] == 'include' and spec['key'] not in cfg[CONF_TARGET_ENTITIES]:
continue

entities.append(platform(coordinator, spec))

Expand Down

0 comments on commit 1405619

Please sign in to comment.