dahlb / ha_carrier

Carrier Infinity Integration for Home Assistant
MIT License
48 stars 4 forks source link

TypeError: 'list_reverseiterator' object is not subscriptable #6

Closed fcorrao1 closed 1 year ago

fcorrao1 commented 1 year ago

It looks like I'm able to pull all the tstat data, but there seems to be a parsing problem:

2023-03-02 02:05:26.601 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant 2023-03-02 02:05:26.602 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration ha_carrier which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant 2023-03-02 02:05:30.695 DEBUG (MainThread) [custom_components.ha_carrier] async setup 2023-03-02 02:05:30.715 DEBUG (MainThread) [custom_components.ha_carrier] async setup entry: {'entry_id': '7747b0737e0073a0f4d1bd619b980e95', 'version': 1, 'domain': 'ha_carrier', 'title': 'XXXX@XXXX.com', 'data': {'username': 'XXXX', 'password': 'XXXX'}, 'options': {}, 'pref_disable_new_entities': False, 'pref_disable_polling': False, 'source': 'user', 'unique_id': None, 'disabled_by': None} 2023-03-02 02:05:32.368 DEBUG (MainThread) [custom_components.ha_carrier.carrier_data_update_coordinator] {'serial': 'XXXX', 'name': 'home', 'profile': {'model': 'SYSTXCCWIC01-B', 'brand': 'Carrier', 'firmware': 'CESR131626-04.31', 'indoor_model': 'FE4ANB006', 'indoor_serial': 'XXXX', 'outdoor_model': '25VNA860A00300', 'outdoor_serial': 'XXXX ', 'zone_ids': ['1']}, 'status': {'outdoor_temperature': 37.0, 'mode': 'hpheat', 'temperature_unit': 'F', 'filter_used': 100, 'is_disconnected': False, 'airflow_cfm': 0, 'zones': [{'id': '1', 'name': 'ZONE 1', 'current_activity': 'sleep', 'temperature': 64.0, 'humidity': 48, 'fan': 'off', 'hold': False, 'occupancy': False, 'hold_until': None, 'heat_set_point': 64.0, 'cool_set_point': 73.0, 'conditioning': 'active_heat'}]}, 'config': {'temperature_unit': 'F', 'static_pressure': 1.2766666412353516, 'mode': 'heat', 'limit_min': 50, 'limit_max': 90, 'zones': [{'api_id': '1', 'name': 'ZONE 1', 'hold_activity': None, 'hold': False, 'hold_until': None, 'activities': [{'api_id': 'away', 'fan': 'off', 'heat_set_point': 50.0, 'cool_set_point': 80.0}, {'api_id': 'home', 'fan': 'off', 'heat_set_point': 66.0, 'cool_set_point': 73.0}, {'api_id': 'manual', 'fan': 'off', 'heat_set_point': 66.0, 'cool_set_point': 73.0}, {'api_id': 'sleep', 'fan': 'off', 'heat_set_point': 64.0, 'cool_set_point': 73.0}, {'api_id': 'wake', 'fan': 'off', 'heat_set_point': 68.0, 'cool_set_point': 73.0}, {'api_id': 'vacation', 'fan': 'off', 'heat_set_point': 60.0, 'cool_set_point': 80.0}]}]}} 2023-03-02 02:05:32.368 DEBUG (MainThread) [custom_components.ha_carrier.carrier_data_update_coordinator] Finished fetching ha_carrier-home data in 0.392 seconds (success: True) 2023-03-02 02:05:32.375 DEBUG (MainThread) [custom_components.ha_carrier.climate] setting up climate entry 2023-03-02 02:05:32.375 DEBUG (MainThread) [custom_components.ha_carrier.climate] infinite_hold:True 2023-03-02 02:05:32.376 DEBUG (MainThread) [custom_components.ha_carrier.climate] carrier mode:heat;ha_mode:heat 2023-03-02 02:05:32.376 DEBUG (MainThread) [custom_components.ha_carrier.climate] carrier mode:heat;ha_mode:heat 2023-03-02 02:05:32.376 DEBUG (MainThread) [custom_components.ha_carrier.climate] carrier mode:heat;ha_mode:heat 2023-03-02 02:05:32.376 DEBUG (MainThread) [custom_components.ha_carrier.climate] carrier mode:heat;ha_mode:heat 2023-03-02 02:05:32.377 ERROR (MainThread) [homeassistant.components.climate] Error adding entities for domain climate with platform ha_carrier Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 442, in async_add_entities await asyncio.gather(tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 717, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 807, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 559, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 602, in _async_write_ha_state attr.update(self.state_attributes or {}) File "/usr/src/homeassistant/homeassistant/components/climate/init.py", line 306, in state_attributes self.target_temperature, File "/config/custom_components/ha_carrier/climate.py", line 128, in target_temperature return self.target_temperature_low File "/config/custom_components/ha_carrier/climate.py", line 174, in target_temperature_low return self._current_activity().heat_set_point File "/config/custom_components/ha_carrier/climate.py", line 166, in _current_activity return self._config_zone.current_activity() File "/usr/local/lib/python3.10/site-packages/carrier_api/config.py", line 73, in current_activity return self.find_activity(safely_get_json_value(yesterday_active_periods[-1], "activity", ActivityNames)) TypeError: 'list_reverseiterator' object is not subscriptable 2023-03-02 02:05:32.379 ERROR (MainThread) [homeassistant.components.climate] Error while setting up ha_carrier platform for climate Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 301, in _async_setup_platform await asyncio.gather(pending) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 442, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 717, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 807, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 559, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 602, in _async_write_ha_state attr.update(self.state_attributes or {}) File "/usr/src/homeassistant/homeassistant/components/climate/init.py", line 306, in state_attributes self.target_temperature, File "/config/custom_components/ha_carrier/climate.py", line 128, in target_temperature return self.target_temperature_low File "/config/custom_components/ha_carrier/climate.py", line 174, in target_temperature_low return self._current_activity().heat_set_point File "/config/custom_components/ha_carrier/climate.py", line 166, in _current_activity return self._config_zone.current_activity() File "/usr/local/lib/python3.10/site-packages/carrier_api/config.py", line 73, in current_activity return self.find_activity(safely_get_json_value(yesterday_active_periods[-1], "activity", ActivityNames)) TypeError: 'list_reverseiterator' object is not subscriptable

dahlb commented 1 year ago

thanks for writing this issue up, I've fixed it with https://github.com/dahlb/carrier_api/commit/de9834d54376d76fa301012115f78ce35f4cc015 and released it in version 1.9.1