wxt9861 / esxi_stats

ESXi component for Home Assistant
MIT License
146 stars 40 forks source link

ESXi Component stopped to report any data - sensor.esxi_stats_xxxx does not exist #15

Closed mirekmal closed 5 years ago

mirekmal commented 5 years ago

Describe the bug Suddenly ESXi integration component stopper to work. Automatically created sensor.esxi_stats_xxxx is not there and in consequence any sensor template created upo is reporting unknown status. Side note: at the same time I noticed lots of problems with custom cards components that to not initiate properly (might be related?). These are working showing valid/no/defective data when configured previously. New card configuration not possible, causing error: Cannot read property ‘setConfig’ of undefined and editor windo goes red.

To Reproduce Steps to reproduce the behavior: Nothing specific, this behavior noticed at one point in time without any clear action taken. Since that was around the time of restoring configuration after SD crash it might be related to upgrade of either hassio or component itself.

Expected behavior Sensors created and usable.

Screenshots If applicable, add screenshots to help explain your problem.

ESXi environment (please complete the following information):

Additional context Entries related to ESXi component setup from log file (unrelated one removed for clarity):

2019-09-16 08:57:28 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for esxi_stats which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.

2019-09-16 08:57:30 DEBUG (MainThread) [homeassistant.bootstrap] Setting up {'lovelace', 'system_health', 'tradfri', 'config', 'api', 'conversation', 'light', 'life360', 'switch', 'remote', 'zeroconf', 'speedtestdotnet', 'media_player', 'sensor', 'http', 'webhook', 'input_text', 'zwave', 'updater', 'auth', 'onboarding', 'mobile_app', 'logbook', 'websocket_api', 'input_number', 'shopping_list', 'audiconnect', 'ssdp', 'map', 'cast', 'hacs', 'device_tracker', 'timer', 'discovery', 'emulated_hue', 'netatmo', 'hassio', 'ios', 'script', 'cloud', 'group', 'history', 'weather', 'input_boolean', 'tts', 'sun', 'default_config', 'person', 'automation', 'panel_custom', 'heos', 'zone', 'frontend', 'esxi_stats'}

2019-09-16 08:57:43 INFO (MainThread) [homeassistant.setup] Setting up esxi_stats 2019-09-16 08:57:43 INFO (MainThread) [custom_components.esxi_stats]

esxi_stats Version: 0.4.1 This is a custom component If you have any issues with this you need to open an issue here: https://github.com/wxt9861/esxi_stats/issues


2019-09-16 08:57:43 DEBUG (MainThread) [custom_components.esxi_stats] Setting up host 192.168.52.20 2019-09-16 08:57:43 DEBUG (MainThread) [custom_components.esxi_stats.esxi] Logged in - session 52922c42-f369-dd55-5cda-2ee1489da3a7 2019-09-16 08:57:43 DEBUG (MainThread) [custom_components.esxi_stats.esxi] Checking license type 2019-09-16 08:57:43 DEBUG (MainThread) [custom_components.esxi_stats.esxi] Found VMware ESX Server license 2019-09-16 08:57:43 DEBUG (MainThread) [custom_components.esxi_stats.esxi] Logged out - session 52922c42-f369-dd55-5cda-2ee1489da3a7 2019-09-16 08:57:43 INFO (MainThread) [custom_components.esxi_stats] Service calls are disabled - 192.168.52.20 doesn't have a supported license 2019-09-16 08:57:43 INFO (MainThread) [homeassistant.setup] Setup of domain esxi_stats took 0.3 seconds. 2019-09-16 08:57:43 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 192.168.52.20 for esxi_stats Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 190, in async_setup hass, self File "/config/custom_components/esxi_stats/init.py", line 201, in async_setup_entry if config_entry.data["licenses"]: KeyError: 'licenses' 2019-09-16 08:57:43 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=esxi_stats>

.... lots of lines regarding setting specific template sensors....

2019-09-16 08:58:07 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.esxi_stats

2019-09-16 08:58:08 ERROR (MainThread) [homeassistant.components.sensor] esxi_stats: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 292, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 439, in async_device_update await self.async_update() File "/config/custom_components/esxi_stats/sensor.py", line 40, in async_update await self.hass.data[DOMAIN_DATA]["client"].update_data() KeyError: 'client' 2019-09-16 08:58:08 ERROR (MainThread) [homeassistant.components.sensor] esxi_stats: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 292, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 439, in async_device_update await self.async_update() File "/config/custom_components/esxi_stats/sensor.py", line 40, in async_update await self.hass.data[DOMAIN_DATA]["client"].update_data() KeyError: 'client'

Again lots of errors similar to: 2019-09-16 08:58:11 WARNING (MainThread) [homeassistant.components.template.sensor] Could not render template ESXi Host GHz Used, the state is unknown. 2019-09-16 08:58:11 DEBUG (Dummy-5) [libopenzwave] notif_callback : new notification 2019-09-16 08:58:11 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.esx_host_cpuusage_ghz, old_state=<state sensor.esx_host_cpuusage_ghz=unknown; friendly_name=ESXi Host GHz Used @ 2019-09-16T08:57:53.337484+02:00>, new_state=<state sensor.esx_host_cpuusage_ghz=unknown; friendly_name=ESXi Host GHz Used, icon=mdi:chip @ 2019-09-16T08:57:53.337484+02:00>> 2019-09-16 08:58:11 DEBUG (Dummy-5) [libopenzwave] notif_callback : Notification type : 8, nodeId : 1

wxt9861 commented 5 years ago

Hi @mirekmal, this looks like the error from the 0.4.0 breaking change.

Delete/Re-add the integration configuration.

  1. Go to Configuration > Integrations > ESXi Stats and click on Delete in the upper right
  2. Restart Home Assistant
  3. Add the Integration back from the Integrations UI

Looks like some of the other errors are related since they are break out sensors that depend on this component.

mirekmal commented 5 years ago

Yes, I tried this already but did not worked. However I just added one more step - i removed and added component from HACS and then again removed and added integration and it started to work again!

wxt9861 commented 5 years ago

Perfect - I will add these steps as another solution.