Skip to content

Commit

Permalink
Add support for "Other" manufacturer
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexwijn committed Jan 21, 2025
1 parent a35a1aa commit 41161bc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
12 changes: 11 additions & 1 deletion custom_components/sat/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,9 @@ async def async_step_automatic_gains(self, _user_input: dict[str, Any] | None =
if not self.data[CONF_AUTOMATIC_GAINS]:
return await self.async_step_pid_controller()

if self.data[CONF_MODE] == MODE_SIMULATOR:
return await self.async_step_finish()

return await self.async_step_manufacturer()

return self.async_show_form(
Expand Down Expand Up @@ -440,6 +443,9 @@ async def async_step_overshoot_protection(self, _user_input: dict[str, Any] | No
_user_input[CONF_MINIMUM_SETPOINT]
)

if self.data[CONF_MODE] == MODE_SIMULATOR:
return await self.async_step_finish()

return await self.async_step_manufacturer()

return self.async_show_form(
Expand All @@ -457,6 +463,10 @@ async def async_step_pid_controller(self, _user_input: dict[str, Any] | None = N

if _user_input is not None:
self.data.update(_user_input)

if self.data[CONF_MODE] == MODE_SIMULATOR:
return await self.async_step_finish()

return await self.async_step_manufacturer()

return self.async_show_form(
Expand All @@ -479,7 +489,7 @@ async def async_step_manufacturer(self, _user_input: dict[str, Any] | None = Non

try:
manufacturers = ManufacturerFactory.resolve_by_member_id(coordinator.member_id)
default_manufacturer = manufacturers[0].name if len(manufacturers) > 0 else None
default_manufacturer = manufacturers[0].name if len(manufacturers) > 0 else -1
finally:
await coordinator.async_will_remove_from_hass()

Expand Down
2 changes: 1 addition & 1 deletion custom_components/sat/manufacturer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from typing import List, Optional

MANUFACTURERS = {
"Simulator": {"module": "simulator", "class": "Simulator", "id": -1},
"ATAG": {"module": "atag", "class": "ATAG", "id": 4},
"Baxi": {"module": "baxi", "class": "Baxi", "id": 4},
"Brotge": {"module": "brotge", "class": "Brotge", "id": 4},
Expand All @@ -18,6 +17,7 @@
"Radiant": {"module": "radiant", "class": "Radiant", "id": 41},
"Nefit": {"module": "nefit", "class": "Nefit", "id": 131},
"Intergas": {"module": "intergas", "class": "Intergas", "id": 173},
"Other": {"module": "other", "class": "Other", "id": -1},
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from ..manufacturer import Manufacturer


class Simulator(Manufacturer):
class Other(Manufacturer):
@property
def name(self) -> str:
return 'Simulator'
return 'Other'

0 comments on commit 41161bc

Please sign in to comment.