Skip to content

Commit

Permalink
Merge pull request #70 from andrew-codechimp/options-flow-fix
Browse files Browse the repository at this point in the history
Options flow fix & min version bump
  • Loading branch information
megakid authored Jan 27, 2025
2 parents 27a628e + 4fc14fb commit 7f631e9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
13 changes: 12 additions & 1 deletion custom_components/hildebrand_glow_ihd_mqtt/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""The hildebrand_glow_ihd_mqtt component."""
import logging

from awesomeversion.awesomeversion import AwesomeVersion
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_DEVICE_ID
from homeassistant.const import __version__ as HA_VERSION, CONF_DEVICE_ID # noqa: N812
from homeassistant.core import HomeAssistant

from .const import (
Expand All @@ -11,6 +12,7 @@
CONF_TOPIC_PREFIX,
DEFAULT_TOPIC_PREFIX,
DOMAIN,
MIN_HA_VERSION,
)

_LOGGER = logging.getLogger(__name__)
Expand All @@ -20,6 +22,15 @@
async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the Hildebrand Glow IHD MQTT integration."""

if AwesomeVersion(HA_VERSION) < AwesomeVersion(MIN_HA_VERSION): # pragma: no cover
msg = (
"This integration requires at least HomeAssistant version "
f" {MIN_HA_VERSION}, you are running version {HA_VERSION}."
" Please upgrade HomeAssistant to continue use of this integration."
)
_LOGGER.critical(msg)
return False

if DOMAIN not in hass.data:
hass.data[DOMAIN] = {}

Expand Down
8 changes: 1 addition & 7 deletions custom_components/hildebrand_glow_ihd_mqtt/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from homeassistant.config_entries import (
ConfigFlow,
ConfigEntry,
CONN_CLASS_LOCAL_PUSH,
OptionsFlow,
)
Expand Down Expand Up @@ -81,16 +80,11 @@ async def async_step_user(self, user_input=None):
@callback
def async_get_options_flow(config_entry):
"""Get the options flow for this handler."""
return HildebrandGlowIHDMQTTOptionsFlowHandler(config_entry)

return HildebrandGlowIHDMQTTOptionsFlowHandler()

class HildebrandGlowIHDMQTTOptionsFlowHandler(OptionsFlow):
"""Handle a option flow for HildebrandGlowIHDMQTT."""

def __init__(self, config_entry: ConfigEntry) -> None:
"""Initialize options flow."""
self.config_entry = config_entry

async def async_step_init(self, user_input=None):
"""Handle options flow."""
if user_input is not None:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/hildebrand_glow_ihd_mqtt/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from enum import Enum

DOMAIN: Final = "hildebrand_glow_ihd"

MIN_HA_VERSION = "2024.12"

ATTR_NAME = "name"
ATTR_ACTIVITY = "activity"
Expand Down
2 changes: 1 addition & 1 deletion hacs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"render_readme": true,
"domains": ["sensor"],
"country": ["GB"],
"homeassistant": "2021.9.0"
"homeassistant": "2024.12.0"
}

0 comments on commit 7f631e9

Please sign in to comment.