diff --git a/pkgs/servers/home-assistant/custom-components/homematicip_local/package.nix b/pkgs/servers/home-assistant/custom-components/homematicip_local/package.nix index d06117ec7f898..53899f975139d 100644 --- a/pkgs/servers/home-assistant/custom-components/homematicip_local/package.nix +++ b/pkgs/servers/home-assistant/custom-components/homematicip_local/package.nix @@ -3,6 +3,7 @@ buildHomeAssistantComponent, fetchFromGitHub, hahomematic, + home-assistant, }: buildHomeAssistantComponent rec { @@ -17,6 +18,13 @@ buildHomeAssistantComponent rec { hash = "sha256-H5Gf09C9/s2JYVTjgiYNe28mV18mqTiJ0ZDR6rnuojo="; }; + postPatch = '' + min_ha_version="$(sed -nr 's/^HMIP_LOCAL_MIN_HA_VERSION.*= "([0-9.]+)"$/\1/p' custom_components/homematicip_local/const.py)" + test \ + "$(echo "$min_ha_version\n${home-assistant.version}" | sort -V | head -n1)" = "$min_ha_version" \ + || (echo "error: only Home Assistant >= $min_ha_version is supported" && exit 1) + ''; + dependencies = [ hahomematic ];