Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error importing config platform mqtt: cannot import name 'CONF_DISCOVERY_PREFIX' from 'homeassistant.components.mqtt.const' #72985

Closed
LeoCal opened this issue Jun 3, 2022 · 11 comments · Fixed by home-assistant/home-assistant.io#23058
Assignees

Comments

@LeoCal
Copy link
Contributor

LeoCal commented Jun 3, 2022

The problem

Hi,

I’ve just updated from HA 2022.6.0 to 2022.6.1 and I get an error when checking the config before restarting with the new version:

Screenshot 2022-06-03 at 15 54 46

Looking at the GIT diff of commits in 2022.6.1, the one that seems to be removing "CONF_DISCOVERY_PREFIX" might be:

Move MQTT config schemas and client to separate modules

What version of Home Assistant Core has the issue?

core-2022.6.1

What was the last working version of Home Assistant Core?

core-2022.6.0

What type of installation are you running?

Home Assistant Core

Integration causing the issue

MQTT

Link to integration documentation on our website

https://www.home-assistant.io/integrations/mqtt

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Error importing config platform mqtt: cannot import name 'CONF_DISCOVERY_PREFIX' from 'homeassistant.components.mqtt.const'

Additional information

No response

@probot-home-assistant
Copy link

mqtt documentation
mqtt source
(message by IssueLinks)

@probot-home-assistant
Copy link

Hey there @emontnemery, mind taking a look at this issue as it has been labeled with an integration (mqtt) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@pascallj
Copy link
Contributor

pascallj commented Jun 4, 2022

Same here. However if you restart Home Assistant anyway via Systemd or what have you, it starts fine without any errors.

@LeoCal
Copy link
Contributor Author

LeoCal commented Jun 7, 2022

Thanks Pascal for your input on this!

Yes, same here, I can confirm that ignoring the config warning and forcing a restart of HA via systemd worked just fine.

Hi @emontnemery

I feel there's something wrong here. However, given that there's a workaround, feel free to close the issue if you won't address this.

Thanks,
Leo

@emontnemery
Copy link
Contributor

@LeoCal This should get a proper fix even though there is a workaround of sorts

@emontnemery
Copy link
Contributor

I am not able to reproduce the bug. Can you give a detailed step-by-step description of what you do to provoke the error? After the forced restart, does checking the config still give the same error?

@pascallj
Copy link
Contributor

pascallj commented Jun 8, 2022

Run a Home Assistant 2022.6.0 instance with the MQTT integration. While it is running upgrade to 2022.6.1. Afterwards check the configuration file in the running instance.

The key here is updating while Home Assistant is running. I am not even sure if that is supported, but it keeps downtime to a minimum, which is why I do it that way.

After 2022.6.1 is installed and started, there are no problems. Only when 2022.6.0 is started but the 2022.6.1 files are already in place.

@LeoCal
Copy link
Contributor Author

LeoCal commented Jun 8, 2022 via email

@LeoCal
Copy link
Contributor Author

LeoCal commented Jun 8, 2022

The key here is updating while Home Assistant is running. I am not even sure if that is supported, but it keeps downtime to a minimum, which is why I do it that way.

I believe that should work (well, at least it has always worked for me so far).
However, here they suggest to do that via command prompt (see “Configuration Check” section):
https://www.home-assistant.io/common-tasks/core/

That’s a fair point though: not sure if they assume hass is not running when you launch it with --script check_config.

@emontnemery
Copy link
Contributor

emontnemery commented Jun 9, 2022

Home Assistant loads Python modules on demand which means the installation instructions are wrong: the Home Assistant service must be stopped before running pip to do the upgrade, otherwise behavior after running pip to do the upgrade is undefined until Home Assistant is restarted.

This PR changes the instructions: home-assistant/home-assistant.io#23058

I think we can close this issue.

@LeoCal
Copy link
Contributor Author

LeoCal commented Jun 9, 2022

Sounds good, thanks a lot for the clarification.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants