Setup failed for shelly: Integration not found - but my shelly is running MQTT & works!

My garage door control application is working well with a Shelly in MQTT mode. So there are no operational errors. But every time I restart HA, I get an error message in Notifications. The log shows:
ERROR (MainThread) [homeassistant.setup] Setup failed for shelly: Integration not found.

There is no shelly: line in any yaml file.
grep shelly *.yaml
automations.yaml:- id: mqtt_shelly_announce
configuration.yaml: position_topic: “shellies/shelly1-garage/input/0”
configuration.yaml: command_topic: “shellies/shelly1-garage/relay/0/command”
configuration.yaml: availability_topic: “shellies/shelly1-garage/online”

Home Assistant running in a venv on Linux. At one time I did have ShellyForHass installed by HACS, but I removed that integration once I discovered it could not handle disconnected mode and the built-in Shelly MQTT could show the switch status.

While I can dismiss the error every time I restart HA, I am looking for ways to make the error go away.

1 Like

My first try was to shutdown HA and delete the home-assistant_v2.db Unfortunately, no joy.

Since every device that I’ve ever configured is still listed on the integrations page, I suspect the answer for me would be to blow away the venv HA instance and recreate it. I can disable entities, but the devices never seem to go away.

You may need to stop home assistant, then delete all references to it in $CONFIG/.storage

Thank you! Those were the files that were filled with devices I had experimented with but no longer used.

My first attempt was to carefully edit the files to remove all references to shelly devices and a test device I created with esphome. I used grep to find the files to edit and tried to remove just the sections with issues.

But I managed to mess up /home/homeassistant/.homeassistant/.storage/core.config_entries. I could verify that the all the { were matched by } for example, but HA complained of JSON errors and would not start.

So I just deleted the .storage directory and restarted HA. Finally joy! I had to create a login and establish my location, but that was much easier than editing JSON files.

Always backup your files before editing!

I agree that making a backup is best practices before editing files. But unless the changes are very minor, I suggest just deleting the .storage directory. The time to get HA going again was much less than the time it would take to correctly edit these JSON files. Deleting the files is certain to eliminate all the random bits of devices that no longer exist.

Thanks! Helped me, I had to remove the following from config/storage/core.config_entries

        {
            "connection_class": "cloud_poll",
            "data": {},
            "domain": "shelly",
            "entry_id": "9227bc2f50334c25be99166dd68b8a90",
            "options": {},
            "source": "import",
            "system_options": {
                "disable_new_entities": true
            },
            "title": "configuration.yaml",
            "unique_id": null,
            "version": 1
        },
2 Likes

I have this same problem: Shelly works via MQTT but I’m unable to get the native integration to work as I get the “Failed to connect” error when entering the device IP address. I’ve checked the following:

  • Shelly devices work via MQTT
  • Shelly firmware updated
  • CoIOT enabled with HA ip:5683
  • Shelly devices rebooted
  • nothing in config files with “Shelly”
  • HA restarted

Any ideas why HA Shelly integration would not be able to connect to the devices?

Is it battery powered you need wake the device up first.

Can you ping the device from ha?

Thanks nickrout, I actually could not ping the devices. After I connected my HA to the same wifi I was able to find them via the native integration. All good now!