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

Remove option to change exposed entity #52

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 0 additions & 42 deletions custom_components/ta_coe/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ async def async_step_init(
menu_options=[
"general",
"add_send_values",
"change_send_values",
"delete_send_values",
],
)
Expand Down Expand Up @@ -278,47 +277,6 @@ async def async_step_add_send_values(
errors=errors,
)

async def async_step_change_send_values(
self, user_input: dict[str, Any] | None = None
) -> FlowResult:
"""Handle options change sensors send via CoE."""
errors: dict[str, Any] = {}

if user_input is not None:
new_id = user_input[CONF_ENTITIES_TO_SEND]
old_id = user_input["old_value"]

if (
(
old_id in self.data[CONF_ENTITIES_TO_SEND].values()
or new_id not in self.data[CONF_ENTITIES_TO_SEND].values()
)
and old_id not in FREE_SLOT_MARKERS
and new_id not in FREE_SLOT_MARKERS
):
index = [
k
for k, v in self.data[CONF_ENTITIES_TO_SEND].items()
if v == old_id
][0]

self.data[CONF_ENTITIES_TO_SEND][index] = new_id

return self.async_create_entry(title="", data=self.data)

errors["base"] = "invalid_entity"

return self.async_show_form(
step_id="change_send_values",
data_schema=vol.Schema(
{
vol.Required(CONF_ENTITIES_TO_SEND): cv.string,
vol.Required("old_value"): cv.string,
}
),
errors=errors,
)

async def async_step_delete_send_values(self, user_input=None):
"""Handle options remove sensors send via CoE."""
errors: dict[str, Any] = {}
Expand Down
7 changes: 0 additions & 7 deletions custom_components/ta_coe/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,6 @@
"entities_to_send": "Entity id to send"
}
},
"change_send_values": {
"title": "Change sensors",
"data": {
"old_value": "ID to override",
"entities_to_send": "New ID"
}
},
"delete_send_values": {
"title": "Delete sensors",
"data": {
Expand Down
7 changes: 0 additions & 7 deletions custom_components/ta_coe/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,6 @@
"entities_to_send": "ID der Entität zum senden"
}
},
"change_send_values": {
"title": "Sensoren ändern",
"data": {
"old_value": "Alte ID",
"entities_to_send": "Neu ID"
}
},
"delete_send_values": {
"title": "Sensoren löschen",
"data": {
Expand Down
7 changes: 0 additions & 7 deletions custom_components/ta_coe/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,6 @@
"entities_to_send": "Entity id to send"
}
},
"change_send_values": {
"title": "Change sensors",
"data": {
"old_value": "ID to override",
"entities_to_send": "New ID"
}
},
"delete_send_values": {
"title": "Delete sensors",
"data": {
Expand Down