Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dext0r committed Dec 10, 2023
1 parent 68b4741 commit ecb80ed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions custom_components/airmx/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
_LOGGER = logging.getLogger(__name__)

ADDON_HOSTNAME = "a06532c7-airmx-addon"
ADDON_MQTT_PORT = 25883
DEFAULT_MQTT_PORT = 1883


@dataclass
Expand Down Expand Up @@ -116,7 +116,7 @@ async def async_step_select_model(self, user_input: ConfigType | None = None) ->
CONF_MODEL: device.model,
CONF_SIGN_KEY: device.sign_key,
CONF_MQTT_HOST: ADDON_HOSTNAME,
CONF_MQTT_PORT: ADDON_MQTT_PORT,
CONF_MQTT_PORT: DEFAULT_MQTT_PORT,
}
)
return self._create_or_update_config_entry(self._data)
Expand All @@ -138,7 +138,7 @@ async def async_step_manual(self, user_input: ConfigType | None = None) -> data_
vol.Required(CONF_ID): cv.positive_int,
vol.Required(CONF_SIGN_KEY): cv.string,
vol.Required(CONF_MQTT_HOST, default=ADDON_HOSTNAME): cv.string,
vol.Required(CONF_MQTT_PORT, default=ADDON_MQTT_PORT): cv.positive_int,
vol.Required(CONF_MQTT_PORT, default=DEFAULT_MQTT_PORT): cv.positive_int,
}
)
return self.async_show_form(step_id="manual", data_schema=schema)
Expand Down
5 changes: 2 additions & 3 deletions custom_components/airmx/humidifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from homeassistant.components.humidifier import (
MODE_AUTO,
MODE_NORMAL,
HumidifierDeviceClass,
HumidifierEntity,
HumidifierEntityFeature,
Expand Down Expand Up @@ -77,7 +76,7 @@ def target_humidity(self) -> int | None:
def mode(self) -> str | None:
return {
AirWaterMode.SLEEP: MODE_SLEEP,
AirWaterMode.MANUAL: MODE_NORMAL,
AirWaterMode.MANUAL: MODE_MANUAL,
}.get(self._device.status.mode, MODE_AUTO)

async def async_turn_on(self, **kwargs: Any) -> None:
Expand All @@ -93,7 +92,7 @@ async def async_set_mode(self, mode: str) -> None:
await self._device.async_set_mode(
{
MODE_SLEEP: AirWaterMode.SLEEP,
MODE_NORMAL: AirWaterMode.MANUAL,
MODE_MANUAL: AirWaterMode.MANUAL,
}.get(mode, AirWaterMode.AUTO)
)

Expand Down

0 comments on commit ecb80ed

Please sign in to comment.