feat: rename the project to Infrarize

This commit is contained in:
2026-07-01 23:00:26 +02:00
parent d23eae2030
commit 6f9d598a6d
24 changed files with 160 additions and 162 deletions
@@ -18,16 +18,16 @@ from homeassistant.helpers.typing import ConfigType
_LOGGER = logging.getLogger(__name__)
DOMAIN = 'smartir'
DOMAIN = 'infrarize'
VERSION = '1.18.1'
MANIFEST_URL = (
"https://raw.githubusercontent.com/"
"kobimx/SmartIR/{}/"
"custom_components/smartir/manifest.json")
"kobimx/Infrarize/{}/"
"custom_components/infrarize/manifest.json")
REMOTE_BASE_URL = (
"https://raw.githubusercontent.com/"
"kobimx/SmartIR/{}/"
"custom_components/smartir/")
"kobimx/Infrarize/{}/"
"custom_components/infrarize/")
COMPONENT_ABS_DIR = os.path.dirname(
os.path.abspath(__file__))
@@ -43,7 +43,7 @@ CONFIG_SCHEMA = vol.Schema({
}, extra=vol.ALLOW_EXTRA)
async def async_setup(hass, config):
"""Set up the SmartIR component."""
"""Set up the Infrarize component."""
conf = config.get(DOMAIN)
if conf is None:
@@ -68,7 +68,7 @@ async def async_setup(hass, config):
async def async_setup_entry(hass, entry):
"""Set up SmartIR from a config entry (UI-configured device)."""
"""Set up Infrarize from a config entry (UI-configured device)."""
platform = entry.data.get('platform')
if not platform:
return False
@@ -85,7 +85,7 @@ async def _async_options_updated(hass, entry):
async def async_unload_entry(hass, entry):
"""Unload a SmartIR config entry."""
"""Unload an Infrarize config entry."""
platform = entry.data.get('platform')
if not platform:
return True
@@ -106,21 +106,21 @@ async def _update(hass, branch, do_update=False, notify_if_latest=True):
if notify_if_latest:
hass.components.persistent_notification.async_create(
"You're already using the latest version!",
title='SmartIR')
title='Infrarize')
return
if StrictVersion(current_ha_version) < StrictVersion(min_ha_version):
hass.components.persistent_notification.async_create(
"There is a new version of SmartIR integration, but it is **incompatible** "
"with your system. Please first update Home Assistant.", title='SmartIR')
"There is a new version of Infrarize integration, but it is **incompatible** "
"with your system. Please first update Home Assistant.", title='Infrarize')
return
if do_update is False:
hass.components.persistent_notification.async_create(
"A new version of SmartIR integration is available ({}). "
"Call the ``smartir.update_component`` service to update "
"A new version of Infrarize integration is available ({}). "
"Call the ``infrarize.update_component`` service to update "
"the integration. \n\n **Release notes:** \n{}"
.format(last_version, release_notes), title='SmartIR')
.format(last_version, release_notes), title='Infrarize')
return
# Begin update
@@ -139,12 +139,12 @@ async def _update(hass, branch, do_update=False, notify_if_latest=True):
if has_errors:
hass.components.persistent_notification.async_create(
"There was an error updating one or more files of SmartIR. "
"Please check the logs for more information.", title='SmartIR')
"There was an error updating one or more files of Infrarize. "
"Please check the logs for more information.", title='Infrarize')
else:
hass.components.persistent_notification.async_create(
"Successfully updated to {}. Please restart Home Assistant."
.format(last_version), title='SmartIR')
.format(last_version), title='Infrarize')
except Exception:
_LOGGER.error("An error occurred while checking for updates.")
@@ -21,7 +21,7 @@ from .controller import get_controller
_LOGGER = logging.getLogger(__name__)
DEFAULT_NAME = "SmartIR Climate"
DEFAULT_NAME = "Infrarize Climate"
DEFAULT_DELAY = 0.5
CONF_UNIQUE_ID = 'unique_id'
@@ -54,7 +54,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
async def async_setup_entry(hass, entry, async_add_entities):
"""Set up SmartIR Climate from a config entry."""
"""Set up Infrarize Climate from a config entry."""
config = {**entry.data, **entry.options}
config.pop('platform', None)
config.setdefault('unique_id', entry.unique_id)
@@ -63,7 +63,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the IR Climate platform."""
_LOGGER.debug("Setting up the smartir platform")
_LOGGER.debug("Setting up the infrarize platform")
device_code = config.get(CONF_DEVICE_CODE)
device_files_subdir = os.path.join('codes', 'climate')
device_files_absdir = os.path.join(COMPONENT_ABS_DIR, device_files_subdir)
@@ -80,7 +80,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
try:
codes_source = ("https://raw.githubusercontent.com/"
"kobimx/SmartIR/master/"
"kobimx/Infrarize/master/"
"codes/climate/{}.json")
await Helper.downloader(codes_source.format(device_code), device_json_path)
@@ -101,13 +101,13 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
_LOGGER.error("The device JSON file is invalid")
return
async_add_entities([SmartIRClimate(
async_add_entities([InfrarizeClimate(
hass, config, device_data
)])
class SmartIRClimate(ClimateEntity, RestoreEntity):
class InfrarizeClimate(ClimateEntity, RestoreEntity):
def __init__(self, hass, config, device_data):
_LOGGER.debug(f"SmartIRClimate init started for device {config.get(CONF_NAME)} supported models {device_data['supportedModels']}")
_LOGGER.debug(f"InfrarizeClimate init started for device {config.get(CONF_NAME)} supported models {device_data['supportedModels']}")
self.hass = hass
self._unique_id = config.get(CONF_UNIQUE_ID)
self._name = config.get(CONF_NAME)
@@ -1,4 +1,4 @@
"""Config flow for SmartIR — 6-step UI wizard with device list selection."""
"""Config flow for Infrarize — 6-step UI wizard with device list selection."""
from __future__ import annotations
import json
@@ -47,7 +47,7 @@ from .const import (
PLATFORMS,
)
DOMAIN = "smartir"
DOMAIN = "infrarize"
_LOGGER = logging.getLogger(__name__)
@@ -63,7 +63,7 @@ async def _load_device_json(platform: str, device_code: int) -> dict | None:
if not os.path.exists(path):
source = (
"https://raw.githubusercontent.com/"
f"kobimx/SmartIR/master/codes/{subdir}/{device_code}.json"
f"kobimx/Infrarize/master/codes/{subdir}/{device_code}.json"
)
try:
await Helper.downloader(source, path)
@@ -120,7 +120,7 @@ def _options_schema(platform: str, defaults: dict | None = None) -> vol.Schema:
return vol.Optional(key)
# Power sensors are only ever checked for on/off state (see
# SmartIRClimate._async_power_sensor_changed and the equivalent methods in
# InfrarizeClimate._async_power_sensor_changed and the equivalent methods in
# fan.py, light.py, media_player.py, which compare .state to STATE_ON/STATE_OFF)
# so restrict the picker to domains that expose a binary on/off state.
power_sensor_selector = EntitySelector(
@@ -237,8 +237,8 @@ def _device_placeholders(device_data: dict, platform: str) -> dict:
# ── Config Flow ───────────────────────────────────────────────────────────────
class SmartIRConfigFlow(ConfigFlow, domain=DOMAIN):
"""Handle multi-step UI config flow for SmartIR."""
class InfrarizeConfigFlow(ConfigFlow, domain=DOMAIN):
"""Handle multi-step UI config flow for Infrarize."""
VERSION = 1
@@ -518,7 +518,7 @@ class SmartIRConfigFlow(ConfigFlow, domain=DOMAIN):
self._delay = DEFAULT_DELAY
uid = (
f"smartir_{self._platform}_{self._device_code}"
f"infrarize_{self._platform}_{self._device_code}"
f"_{self._controller_data}"
)
await self.async_set_unique_id(uid)
@@ -576,21 +576,21 @@ class SmartIRConfigFlow(ConfigFlow, domain=DOMAIN):
}
options.update(_parse_options(self._platform, options_input))
mfr = self._device_data.get("manufacturer", "SmartIR")
mfr = self._device_data.get("manufacturer", "Infrarize")
title = f"{mfr}{self._device_name}"
return self.async_create_entry(title=title, data=data, options=options)
@staticmethod
@callback
def async_get_options_flow(config_entry: ConfigEntry) -> SmartIROptionsFlow:
return SmartIROptionsFlow(config_entry)
def async_get_options_flow(config_entry: ConfigEntry) -> InfrarizeOptionsFlow:
return InfrarizeOptionsFlow(config_entry)
# ── Options Flow ──────────────────────────────────────────────────────────────
class SmartIROptionsFlow(OptionsFlow):
"""Edit controller and sensor settings for an existing SmartIR entry."""
class InfrarizeOptionsFlow(OptionsFlow):
"""Edit controller and sensor settings for an existing Infrarize entry."""
def __init__(self, config_entry: ConfigEntry) -> None:
self._entry = config_entry
@@ -1,4 +1,4 @@
"""Constants for the SmartIR config flow and platforms."""
"""Constants for the Infrarize config flow and platforms."""
from __future__ import annotations
# ── Sentinels ──────────────────────────────────────────────────────────────────
@@ -38,10 +38,10 @@ PLATFORM_SUBDIR: dict[str, str] = {
}
DEFAULT_DEVICE_NAMES: dict[str, str] = {
"climate": "SmartIR Climate",
"fan": "SmartIR Fan",
"media_player": "SmartIR Media Player",
"light": "SmartIR Light",
"climate": "Infrarize Climate",
"fan": "Infrarize Fan",
"media_player": "Infrarize Media Player",
"light": "Infrarize Light",
}
# ── Controller metadata ────────────────────────────────────────────────────────
@@ -24,7 +24,7 @@ from .controller import get_controller
_LOGGER = logging.getLogger(__name__)
DEFAULT_NAME = "SmartIR Fan"
DEFAULT_NAME = "Infrarize Fan"
DEFAULT_DELAY = 0.5
CONF_UNIQUE_ID = 'unique_id'
@@ -46,7 +46,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
async def async_setup_entry(hass, entry, async_add_entities):
"""Set up SmartIR Fan from a config entry."""
"""Set up Infrarize Fan from a config entry."""
config = {**entry.data, **entry.options}
config.pop('platform', None)
config.setdefault('unique_id', entry.unique_id)
@@ -71,7 +71,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
try:
codes_source = ("https://raw.githubusercontent.com/"
"kobimx/SmartIR/master/"
"kobimx/Infrarize/master/"
"codes/fan/{}.json")
await Helper.downloader(codes_source.format(device_code), device_json_path)
@@ -92,11 +92,11 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
_LOGGER.error("The device JSON file is invalid")
return
async_add_entities([SmartIRFan(
async_add_entities([InfrarizeFan(
hass, config, device_data
)])
class SmartIRFan(FanEntity, RestoreEntity):
class InfrarizeFan(FanEntity, RestoreEntity):
def __init__(self, hass, config, device_data):
self.hass = hass
self._unique_id = config.get(CONF_UNIQUE_ID)
@@ -27,7 +27,7 @@ from .controller import get_controller
_LOGGER = logging.getLogger(__name__)
DEFAULT_NAME = "SmartIR Light"
DEFAULT_NAME = "Infrarize Light"
DEFAULT_DELAY = 0.5
CONF_UNIQUE_ID = "unique_id"
@@ -57,7 +57,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
async def async_setup_entry(hass, entry, async_add_entities):
"""Set up SmartIR Light from a config entry."""
"""Set up Infrarize Light from a config entry."""
config = {**entry.data, **entry.options}
config.pop('platform', None)
config.setdefault('unique_id', entry.unique_id)
@@ -90,7 +90,7 @@ async def async_setup_platform(
try:
codes_source = (
"https://raw.githubusercontent.com/"
"kobimx/SmartIR/master/"
"kobimx/Infrarize/master/"
"codes/light/{}.json"
)
@@ -117,7 +117,7 @@ async def async_setup_platform(
_LOGGER.error("The device JSON file is invalid")
return
async_add_entities([SmartIRLight(hass, config, device_data)])
async_add_entities([InfrarizeLight(hass, config, device_data)])
# find the closest match in a sorted list
@@ -137,7 +137,7 @@ def closest_match(value, list):
return len(list) - 1
class SmartIRLight(LightEntity, RestoreEntity):
class InfrarizeLight(LightEntity, RestoreEntity):
def __init__(self, hass, config, device_data):
self.hass = hass
self._unique_id = config.get(CONF_UNIQUE_ID)
@@ -1,7 +1,7 @@
{
"domain": "smartir",
"name": "SmartIR",
"documentation": "https://github.com/kobimx/SmartIR",
"domain": "infrarize",
"name": "Infrarize",
"documentation": "https://github.com/kobimx/Infrarize",
"dependencies": [],
"codeowners": ["@kobimx"],
"requirements": ["aiofiles>=0.6.0"],
@@ -19,7 +19,7 @@ from .controller import get_controller
_LOGGER = logging.getLogger(__name__)
DEFAULT_NAME = "SmartIR Media Player"
DEFAULT_NAME = "Infrarize Media Player"
DEFAULT_DEVICE_CLASS = "tv"
DEFAULT_DELAY = 0.5
@@ -44,7 +44,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
async def async_setup_entry(hass, entry, async_add_entities):
"""Set up SmartIR Media Player from a config entry."""
"""Set up Infrarize Media Player from a config entry."""
config = {**entry.data, **entry.options}
config.pop('platform', None)
config.setdefault('unique_id', entry.unique_id)
@@ -69,7 +69,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
try:
codes_source = ("https://raw.githubusercontent.com/"
"kobimx/SmartIR/master/"
"kobimx/Infrarize/master/"
"codes/media_player/{}.json")
await Helper.downloader(codes_source.format(device_code), device_json_path)
@@ -90,11 +90,11 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
_LOGGER.error("The device JSON file is invalid")
return
async_add_entities([SmartIRMediaPlayer(
async_add_entities([InfrarizeMediaPlayer(
hass, config, device_data
)])
class SmartIRMediaPlayer(MediaPlayerEntity, RestoreEntity):
class InfrarizeMediaPlayer(MediaPlayerEntity, RestoreEntity):
def __init__(self, hass, config, device_data):
self.hass = hass
self._unique_id = config.get(CONF_UNIQUE_ID)
@@ -0,0 +1,4 @@
check_updates:
description: Check for Infrarize updates.
update_component:
description: Update Infrarize component.
@@ -2,49 +2,49 @@
"config": {
"step": {
"user": {
"title": "SmartIR — Choose Platform",
"title": "Infrarize — Choose Platform",
"description": "Select the type of device you want to control via IR.",
"data": {
"platform": "Platform"
}
},
"controller_filter": {
"title": "SmartIR — Filter by Controller",
"title": "Infrarize — Filter by Controller",
"description": "Narrow the device list to a specific controller type, or show all.",
"data": {
"controller_type": "Controller Type"
}
},
"manufacturer": {
"title": "SmartIR — Select Manufacturer",
"title": "Infrarize — Select Manufacturer",
"description": "Choose your device manufacturer. Select **'Enter code manually'** if your device is not listed.",
"data": {
"manufacturer": "Manufacturer"
}
},
"device_select": {
"title": "SmartIR — Select Device",
"title": "Infrarize — Select Device",
"description": "Choose the device model for **{manufacturer}**. Each entry shows the numeric code and supported model names.",
"data": {
"device_code": "Device"
}
},
"device_manual": {
"title": "SmartIR — Enter Device Code",
"title": "Infrarize — Enter Device Code",
"description": "Enter the numeric device code. The file will be loaded from local storage or downloaded from GitHub.",
"data": {
"device_code": "Device Code"
}
},
"device_name": {
"title": "SmartIR — Confirm Device Name",
"title": "Infrarize — Confirm Device Name",
"description": "**{manufacturer}** — {models}\nController: {controller_type} | Code: {device_code}\n\nEdit the name shown in Home Assistant.",
"data": {
"name": "Device Name"
}
},
"controller": {
"title": "SmartIR — Controller Connection",
"title": "Infrarize — Controller Connection",
"description": "Controller type: **{controller_type}**\n\n{controller_hint}",
"data": {
"controller_data": "Controller Data",
@@ -52,7 +52,7 @@
}
},
"options_platform": {
"title": "SmartIR — Optional Settings",
"title": "Infrarize — Optional Settings",
"description": "**{manufacturer}** — {models}\nController: {controller_type}\n\nAll fields below are optional.",
"data": {
"temperature_sensor": "Temperature Sensor",
@@ -70,13 +70,13 @@
"unknown": "Unexpected error — check the Home Assistant logs."
},
"abort": {
"already_configured": "A SmartIR device with this code and controller is already configured."
"already_configured": "A Infrarize device with this code and controller is already configured."
}
},
"options": {
"step": {
"controller": {
"title": "SmartIR — Edit Controller",
"title": "Infrarize — Edit Controller",
"description": "Controller type: **{controller_type}**\n\n{controller_hint}",
"data": {
"controller_data": "Controller Data",
@@ -84,7 +84,7 @@
}
},
"options_platform": {
"title": "SmartIR — Edit Optional Settings",
"title": "Infrarize — Edit Optional Settings",
"description": "**{manufacturer}** — {models}\nController: {controller_type}",
"data": {
"temperature_sensor": "Temperature Sensor",
@@ -2,49 +2,49 @@
"config": {
"step": {
"user": {
"title": "SmartIR — Choose Platform",
"title": "Infrarize — Choose Platform",
"description": "Select the type of device you want to control via IR.",
"data": {
"platform": "Platform"
}
},
"controller_filter": {
"title": "SmartIR — Filter by Controller",
"title": "Infrarize — Filter by Controller",
"description": "Narrow the device list to a specific controller type, or show all.",
"data": {
"controller_type": "Controller Type"
}
},
"manufacturer": {
"title": "SmartIR — Select Manufacturer",
"title": "Infrarize — Select Manufacturer",
"description": "Choose your device manufacturer. Select **'Enter code manually'** if your device is not listed.",
"data": {
"manufacturer": "Manufacturer"
}
},
"device_select": {
"title": "SmartIR — Select Device",
"title": "Infrarize — Select Device",
"description": "Choose the device model for **{manufacturer}**. Each entry shows the numeric code and supported model names.",
"data": {
"device_code": "Device"
}
},
"device_manual": {
"title": "SmartIR — Enter Device Code",
"title": "Infrarize — Enter Device Code",
"description": "Enter the numeric device code. The file will be loaded from local storage or downloaded from GitHub.",
"data": {
"device_code": "Device Code"
}
},
"device_name": {
"title": "SmartIR — Confirm Device Name",
"title": "Infrarize — Confirm Device Name",
"description": "**{manufacturer}** — {models}\nController: {controller_type} | Code: {device_code}\n\nEdit the name shown in Home Assistant.",
"data": {
"name": "Device Name"
}
},
"controller": {
"title": "SmartIR — Controller Connection",
"title": "Infrarize — Controller Connection",
"description": "Controller type: **{controller_type}**\n\n{controller_hint}",
"data": {
"controller_data": "Controller Data",
@@ -52,7 +52,7 @@
}
},
"options_platform": {
"title": "SmartIR — Optional Settings",
"title": "Infrarize — Optional Settings",
"description": "**{manufacturer}** — {models}\nController: {controller_type}\n\nAll fields below are optional.",
"data": {
"temperature_sensor": "Temperature Sensor",
@@ -70,13 +70,13 @@
"unknown": "Unexpected error — check the Home Assistant logs."
},
"abort": {
"already_configured": "A SmartIR device with this code and controller is already configured."
"already_configured": "A Infrarize device with this code and controller is already configured."
}
},
"options": {
"step": {
"controller": {
"title": "SmartIR — Edit Controller",
"title": "Infrarize — Edit Controller",
"description": "Controller type: **{controller_type}**\n\n{controller_hint}",
"data": {
"controller_data": "Controller Data",
@@ -84,7 +84,7 @@
}
},
"options_platform": {
"title": "SmartIR — Edit Optional Settings",
"title": "Infrarize — Edit Optional Settings",
"description": "**{manufacturer}** — {models}\nController: {controller_type}",
"data": {
"temperature_sensor": "Temperature Sensor",
-4
View File
@@ -1,4 +0,0 @@
check_updates:
description: Check for SmartIR updates.
update_component:
description: Update SmartIR component.