Skip to content

Commit

Permalink
⛔ Forbid manual setup of integration
Browse files Browse the repository at this point in the history
The integration is made to be setup via auto-discovery. It led to bug
when launching integration configuration manually.

Change-Id: Id20f041de789ad94bbd32b972d1f360004ef13af
  • Loading branch information
kamaradclimber committed Dec 12, 2022
1 parent 4a592ce commit cb546ce
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions custom_components/aquarea/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ async def async_step_confirm(
) -> FlowResult:
"""Confirm setup to user and create the entry"""

if not self._prefix:
return self.async_abort(reason="unsupported_manual_setup")

data = {"discovery_prefix": self._prefix}

if user_input is None:
Expand Down
3 changes: 2 additions & 1 deletion custom_components/aquarea/strings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"config": {
"abort": {
"single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]"
"single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]",
"unsupported_manual_setup": "Configuration is only supported via auto-discovery. Check HeishaMon is connected to your MQTT server and sending messages. Also check that Home Assistant is connected to the MQTT server. The integration will then be discovered automatically."
},
"step": {
"confirm": {
Expand Down
3 changes: 2 additions & 1 deletion custom_components/aquarea/translations/en.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"config": {
"abort": {
"single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]"
"single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]",
"unsupported_manual_setup": "Configuration is only supported via auto-discovery. Check HeishaMon is connected to your MQTT server and sending messages. Also check that Home Assistant is connected to the MQTT server. The integration will then be discovered automatically."
},
"step": {
"confirm": {
Expand Down

0 comments on commit cb546ce

Please sign in to comment.