chrisc123 / jebao_aqua-homeassistant

Home Assistant integration to control Wi-Fi enabled Jebao wavemaker devices
9 stars 5 forks source link

AttributeError: 'NoneType' object has no attribute 'get' #12

Open EvoSems opened 1 month ago

EvoSems commented 1 month ago

This error originated from a custom integration.

Logger: homeassistant Source: custom_components/jebao_aqua/switch.py:36 integration: Jebao Aqua Aquarium Pump (documentation) First occurred: 16:02:05 (15 occurrences) Last logged: 16:02:33

Error doing job: Task exception was never retrieved (None) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _handle_refresh_interval await self._async_refresh(log_failures=True, scheduled=True) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 453, in _async_refresh self.async_update_listeners() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners update_callback() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 533, in _handle_coordinator_update self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1005, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1130, in _async_write_ha_state self.async_calculate_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1067, in async_calculate_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1011, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1670, in state if (is_on := self.is_on) is None: ^^^^^^^^^^ File "/config/custom_components/jebao_aqua/switch.py", line 36, in is_on return device_data.get('attr', {}).get(self._attribute['name'], False) ^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'get'

2024-09-24 19:37:29.845 DEBUG (MainThread) [custom_components.jebao_aqua] Successfully parsed local device data: {'SwitchON': True, 'PulseTide': False, 'FeedSwitch': False, 'TimerON': False, 'Mode': '正弦造浪', 'Linkage': '独立', 'Flow': 30, 'Frequency': 30, 'FeedTime': 10, 'Fault_Overcurrent': False, 'Fault_Overvoltage': False, 'Fault_OverTemp': False, 'Fault_Undervoltage': False, 'Fault_Lockedrotor': False, 'Fault_no_liveload': False, 'Fault_UART': False} 2024-09-24 19:37:29.847 DEBUG (MainThread) [custom_components.jebao_aqua] Coordinator ran _async_update_data and updated device data: {'did': 'YSeYB3neNknWrSJl8nUm1r', 'attr': {'SwitchON': True, 'PulseTide': False, 'FeedSwitch': False, 'TimerON': False, 'Mode': '正弦造浪', 'Linkage': '独立', 'Flow': 30, 'Frequency': 30, 'FeedTime': 10, 'Fault_Overcurrent': False, 'Fault_Overvoltage': False, 'Fault_OverTemp': False, 'Fault_Undervoltage': False, 'Fault_Lockedrotor': False, 'Fault_no_liveload': False, 'Fault_UART': False}} 2024-09-24 19:37:29.847 DEBUG (MainThread) [custom_components.jebao_aqua] Trying to get device data from URL: https://usapi.gizwits.com/app/devdata/jUhBu5pRu/latest 2024-09-24 19:37:29.847 ERROR (MainThread) [custom_components.jebao_aqua] Exception while fetching device data from Gizwits API: Session is closed 2024-09-24 19:37:29.848 DEBUG (MainThread) [custom_components.jebao_aqua] Coordinator ran _async_update_data and updated device data: None 2024-09-24 19:37:29.848 DEBUG (MainThread) [custom_components.jebao_aqua] Finished fetching jebao_aqua data in 0.033 seconds (success: True) 2024-09-24 19:37:29.849 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)

This error originated from a custom integration.

Logger: custom_components.jebao_aqua Source: custom_components/jebao_aqua/api.py:111 integration: Jebao Aqua Aquarium Pump (documentation) First occurred: 20:05:48 (148 occurrences) Last logged: 20:10:38

Exception while fetching device data from Gizwits API: Session is closed

EvoSems commented 1 month ago

Hi Guys. getting the above error running 2 wave makers in master/slave and then trying to turn the on/off switch

EvoSems commented 1 month ago

I can get the switch to work on/off but the status of the switch isnt being handled. in master/slave I can turn off/on both wave makers with just the one "master" switch. pretty cool