twrecked / hass-virtual

Virtual Components for Home Assistant
GNU General Public License v3.0
154 stars 25 forks source link

Exception in log for _parse_old_config #76

Open NINE78 opened 9 months ago

NINE78 commented 9 months ago

Trying to run version 0.9. Virtual devices are failing to set up with following log messages. Seems like type mismatch somewhere (string index vs key/value struct index). Thanks!

2023-11-23 10:11:19.395 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 880, in async_init flow, result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/config_entries.py", line 908, in _async_init result = await self._async_handle_step(flow, flow.init_step, data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 389, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/virtual/config_flow.py", line 69, in async_step_import UpgradeCfg.import_yaml(import_data) File "/config/custom_components/virtual/cfg.py", line 403, in import_yaml devices = _parse_old_config(devices, config.get(platform, []), str(platform)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/virtual/cfg.py", line 189, in _parse_old_config if config[CONF_PLATFORM] != COMPONENT_DOMAIN:


TypeError: string indices must be integers, not 'str'
2023-11-23 10:11:19.422 ERROR (MainThread) [homeassistant.components.light] The virtual platform for the light integration does not support platform setup. Please remove it from your config.
twrecked commented 9 months ago

I guess I missed something on the import code.

Can you enable debug and try the latest alpha release? It might not fix it but it adds some debug. You can add this to the config to see the debug.

logger:
  default: info
  logs:
    custom_components.virtual: debug

You'll need to:

You'll see some logs with the words not dictionary= in them.