2021.3.3 Upgrade Fails - The following integrations and platforms could not be set up: automation

Trying to upgrade my functioning install of 2021.2.3 to either 2021.3.2 or 2021.3.3 causes my automations to fail to load. Has anyone else run into this and found a fix? I fear I’m going to have to scrap my entire install and start from scratch which I find puzzling since everything is/was working very well in version 2021.2.3.

If it’s worth mentioning, I did skip versions 2021.3.0 & 2021.3.1. Is it possible that they performed a required upgrade migration step that I’m not getting by trying to go straight from 2021.2.3 to 2021.3.2 or 2021.3.3?

I’m running in a 3.8 virtualenv if that’s helpful. Here are the two log details that I can’t quiet make heads or tails of.

Logger: homeassistant.setup
Source: setup.py:138
First occurred: 10:43:10 AM (1 occurrences)
Last logged: 10:43:10 AM

Setup failed for automation: Invalid config.

And there is also this one.

Logger: homeassistant.config
Source: util/aiohttp.py:51
First occurred: 10:43:10 AM (1 occurrences)
Last logged: 10:43:10 AM

Unknown error calling automation config validator
Traceback (most recent call last):
  File "/home/ha/HA.VirtualEnvs/3.8/lib/python3.8/site-packages/homeassistant/config.py", line 776, in async_process_component_config
    return await config_validator.async_validate_config(  # type: ignore
  File "/home/ha/HA.VirtualEnvs/3.8/lib/python3.8/site-packages/homeassistant/components/automation/config.py", line 103, in async_validate_config
    await asyncio.gather(
  File "/home/ha/HA.VirtualEnvs/3.8/lib/python3.8/site-packages/homeassistant/components/automation/config.py", line 85, in _try_async_validate_config_item
    config = await async_validate_config_item(hass, config, full_config)
  File "/home/ha/HA.VirtualEnvs/3.8/lib/python3.8/site-packages/homeassistant/components/automation/config.py", line 63, in async_validate_config_item
    config[CONF_TRIGGER] = await async_validate_trigger_config(
  File "/home/ha/HA.VirtualEnvs/3.8/lib/python3.8/site-packages/homeassistant/helpers/trigger.py", line 47, in async_validate_trigger_config
    platform = await _async_get_trigger_platform(hass, conf)
  File "/home/ha/HA.VirtualEnvs/3.8/lib/python3.8/site-packages/homeassistant/helpers/trigger.py", line 34, in _async_get_trigger_platform
    return integration.get_platform("trigger")
  File "/home/ha/HA.VirtualEnvs/3.8/lib/python3.8/site-packages/homeassistant/loader.py", line 499, in get_platform
    cache[full_name] = self._import_platform(platform_name)
  File "/home/ha/HA.VirtualEnvs/3.8/lib/python3.8/site-packages/homeassistant/loader.py", line 504, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/ha/HA.VirtualEnvs/3.8/lib/python3.8/site-packages/homeassistant/components/webhook/__init__.py", line 14, in <module>
    from homeassistant.util.aiohttp import MockRequest
  File "/home/ha/HA.VirtualEnvs/3.8/lib/python3.8/site-packages/homeassistant/util/aiohttp.py", line 26, in <module>
    class MockRequest:
  File "/home/ha/HA.VirtualEnvs/3.8/lib/python3.8/site-packages/homeassistant/util/aiohttp.py", line 51, in MockRequest
    def query(self) -> MultiDict[str]:
TypeError: 'type' object is not subscriptable

Any assistance or ideas on how to resolve this issue would be greatly appreciated.

Do you use the automation UI editor to make your automations or do you write them manually in yaml?

Looks like all my automations were made manually and are in my automations.yaml file

OK, since they are in automations.yaml it won’t be quite as easy as it would otherwise be.

Normally I would just tell you to comment out all of the automations and reload automations so the config checker wouldn’t look at them. But since they are located where they are if you comment them out the system will automatically delete all of them because you cant have comments in the automations.yaml file. Makes no sense but is the way it is.

Alternatively, what I would do is copy all of the automations from that file (the entire contents…) and paste them intro a different temporary file. Then delete all of the contents from the automations.yaml file and reload automations. At that point you should be error free.

Then copy the automations one at a time back into the automations.yaml file, reloading automations each time, until the error comes back. At that point you will know which automation is causing the error and you can try to fix it.

1 Like

Thanks finity. I was hoping for something easier but I can work on this and get things working again by recreating them all in the UI now.

1 Like

I don’t know that I would start writing automations (or scripts) using the UI editors if you already know how to write them using yaml.

There are so many little “gotcha’s” in the UI editors that I find it not worth using. I still write all of mine in yaml.

But, obviously, you do whatever you think fits your needs the best.

Yeah, I’m stuck already on my first automation. I can’t seem to figure out how to change the RGB color or transition for the LIFX bulb like I used to do in my automations.yaml file.

Is the automations.yaml file now deprecated which is what caused mine to break? Otherwise I’d be happier to keep using it if I could only figure out what went wrong with my install that broke all the automations.

Maybe it would make sense to use the configuration check add-on to pinpoint what is wrong, there have been minor syntax changes and that may point you in the right direction.

I never upgrade without running it and studying the output.

1 Like

Here are a couple of things I do with Lifx. My automations are all by hand in a file that relates to the device or the process by name.

- id: "Tree on at 6:30 weekdays"
  alias: 'Tree on at 6:30 weekdays'
  trigger:
    - platform: time
      at: '06:30:00'
  condition:
    - condition: time
      weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
  action:
    - service: lifx.set_state
      data:
        entity_id: group.tree
        brightness: "175"
        kelvin: "3750"
        power: "on"

- id: "Tree blink at 7:30 weekdays"
  alias: 'Tree blink at 7:30 weekdays'
  trigger:
    - platform: time
      at: '07:30:00'
  condition:
    - condition: time
      weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
  action:
    - service: lifx.effect_pulse
      data:
        entity_id: group.tree
        cycles: "10"
        mode: "breathe"
        power_on: "true"
        color_name: "blue"

No the automations.yaml file is not deprecated.

However, I would create a different file to put all of your yaml automations into so that the system doesn’t reformat your code and remove comments.

in your configuration.yaml file you should have a line that says:

automation: !include automations.yaml

to use a different file for your yaml automations just add another line to that file:

automation yaml: !include automations_manual.yaml

You can call the file any name you want and you can change the “yaml” part in the beginning (automation yaml <-- this) to anything you want too as long as you leave the “automation” part there.

Then create the file you specified and put all of your yaml automations in there.

But again, do it one at a time with reloads in between to find your original issue…hopefully… :wink:

1 Like

Thanks mattlward. I definitely see some syntax in there that differs from my working 2021.2.3 config, this will help a lot.

Thanks finity. I’m doing just as you suggested. I moved to automations_manual.yaml and I’m converting them one automation at a time. I’m nearly done.

Any idea when the syntax changes occurred that I missed? I would have hoped for a larger heads up/warning or maybe even an automatic conversion to the newer syntax.

TBH, I’m not sure what the actual syntax changes were that caused the issues.

You really haven’t given any specifics on what, if anything, that you’ve changed.