diff --git a/CHANGELOG.md b/CHANGELOG.md index f6eb170..a95d615 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,21 @@ All notable changes to this project will be documented in this file. Dates are displayed in UTC. +#### [0.3.31](https://github.com/sarbuk/AirCon/compare/0.3.29...0.3.31) +> 27 June 2025 + +- added additional definitions in ```__main__.py``` to expose additional topics for the following, outside of the HA climate control: + - economy_mode [switch] + - powerful_mode [switch] + - af_vertical_direction [integer 1-4] + - outdoor_temperature [sensor] + +#### [0.3.29](https://github.com/sarbuk/AirCon/compare/0.3.24...0.3.29) +> 25 June 2025 + +- add temp_step = 0.5 to allow half degree increments in HA +- other changes due to forking from xury77 + #### [0.3.24](https://github.com/xury77/AirCon/compare/0.3.23...0.3.24) > 18 November 2024 diff --git a/README.md b/README.md index cdc3379..aad26a7 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ If using [HomeAssistant], this is the preferred method. 1. In the HomeAssistant UI, enter **Supervisor → Add-on Store**. 1. Click **⋮ menu → Repositories**. -1. Add `https://github.com/xury77/AirCon` to the list. +1. Add `https://github.com/sarbuk/AirCon` to the list. 1. Choose **HiSense Air Conditioner** and install it. 1. Update the configuration as detailed within the add-on. 1. Start the add-on. Do not forget to enable **Start on boot** and **Watchdog**. diff --git a/aircon/__init__.py b/aircon/__init__.py index cf6614f..015e62e 100644 --- a/aircon/__init__.py +++ b/aircon/__init__.py @@ -1,2 +1,2 @@ from . import * -__version__ = '0.3.24' +__version__ = '0.3.31' diff --git a/aircon/__main__.py b/aircon/__main__.py index e49d841..4990adf 100644 --- a/aircon/__main__.py +++ b/aircon/__main__.py @@ -192,6 +192,7 @@ async def run(parsed_args): mqtt_client.will_set(mqtt_topics['lwt'], payload='offline', retain=True) mqtt_client.connect(parsed_args.mqtt_host, parsed_args.mqtt_port) mqtt_client.publish(mqtt_topics['lwt'], payload='online', retain=True) + print(f"[DEBUG] Devices loaded: {len(devices)}", file=sys.stderr) for device in devices: config = { 'unique_id': device.mac_address, @@ -211,9 +212,21 @@ async def run(parsed_args): }, ], 'precision': device.get_temp_precision(), + 'temp_step': 0.5, 'temperature_unit': 'F' if device.is_fahrenheit else 'C' } topics = device.topics + # [PATCH] Extend topics manually for known-but-omitted features + fallback_keys = [ + 'economy_mode', + 'powerful_mode', + 'af_vertical_direction', + 'outdoor_temperature', + ] + for key in fallback_keys: + if key not in topics: + topics[key] = key + print(f"[DEBUG] Patched topics for {device.name}: {topics.keys()}", file=sys.stderr) if 'env_temp' in topics: config['current_temperature_topic'] = mqtt_topics['pub'].format( device.mac_address, topics['env_temp']) @@ -254,6 +267,69 @@ async def run(parsed_args): mqtt_client.publish(mqtt_topics['discovery'].format(device.mac_address), payload=json.dumps(config), retain=True) + if 'economy_mode' in topics: + mqtt_client.publish( + f"{parsed_args.mqtt_discovery_prefix}/switch/{device.mac_address}/economy_mode/config", + payload=json.dumps({ + "name": f"{device.name} Economy Mode", + "unique_id": f"{device.mac_address}_economy_mode", + "state_topic": mqtt_topics['pub'].format(device.mac_address, topics['economy_mode']), + "command_topic": mqtt_topics['sub'].format(device.mac_address, topics['economy_mode']), + "payload_on": "ON", + "payload_off": "OFF", + "availability": [{"topic": mqtt_topics['lwt']}], + "device": config["device"] + }), + retain=True + ) + + if 'powerful_mode' in topics: + mqtt_client.publish( + f"{parsed_args.mqtt_discovery_prefix}/switch/{device.mac_address}/powerful_mode/config", + payload=json.dumps({ + "name": f"{device.name} Powerful Mode", + "unique_id": f"{device.mac_address}_powerful_mode", + "state_topic": mqtt_topics['pub'].format(device.mac_address, topics['powerful_mode']), + "command_topic": mqtt_topics['sub'].format(device.mac_address, topics['powerful_mode']), + "payload_on": "ON", + "payload_off": "OFF", + "availability": [{"topic": mqtt_topics['lwt']}], + "device": config["device"] + }), + retain=True + ) + + if 'af_vertical_direction' in topics: + mqtt_client.publish( + f"{parsed_args.mqtt_discovery_prefix}/number/{device.mac_address}/af_vertical_direction/config", + payload=json.dumps({ + "name": f"{device.name} Vertical Airflow", + "unique_id": f"{device.mac_address}_af_vertical_direction", + "state_topic": mqtt_topics['pub'].format(device.mac_address, topics['af_vertical_direction']), + "command_topic": mqtt_topics['sub'].format(device.mac_address, topics['af_vertical_direction']), + "min": 1, + "max": 4, + "step": 1, + "availability": [{"topic": mqtt_topics['lwt']}], + "device": config["device"] + }), + retain=True + ) + + if 'outdoor_temperature' in topics: + mqtt_client.publish( + f"{parsed_args.mqtt_discovery_prefix}/sensor/{device.mac_address}/outdoor_temperature/config", + payload=json.dumps({ + "name": f"{device.name} Outdoor Temperature", + "unique_id": f"{device.mac_address}_outdoor_temperature", + "state_topic": mqtt_topics['pub'].format(device.mac_address, topics['outdoor_temperature']), + "unit_of_measurement": "°C", + "device_class": "temperature", + "availability": [{"topic": mqtt_topics['lwt']}], + "device": config["device"] + }), + retain=True + ) device.add_property_change_listener(mqtt_client.mqtt_publish_update) async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(connect=5.0)) as session: diff --git a/hassio/config.json b/config.json similarity index 90% rename from hassio/config.json rename to config.json index ab54d7e..2e87b5f 100644 --- a/hassio/config.json +++ b/config.json @@ -1,11 +1,11 @@ { "name": "HiSense Air Conditioners", - "version": "0.3.24", + "version": "0.3.31", "slug": "hisense_ac", "description": "Interface for controlling Air Conditioners, e.g. with HiSense modules.", - "url": "https://github.com/xury77/AirCon", - "image": "ghcr.io/xury77/aircon", + "url": "https://github.com/sarbuk/AirCon", "arch": ["armhf", "armv7", "aarch64", "amd64", "i386"], + "build": true, "startup": "application", "boot": "auto", "host_network": true, diff --git a/docker-compose.yaml b/docker-compose.yaml index 6a3e366..04c3e2c 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -10,7 +10,7 @@ services: hisense_ac: depends_on: - copy_config - image: ghcr.io/xury77/aircon:0.3.24 + build: . container_name: hisense_ac healthcheck: disable: true diff --git a/hassio/DOCS.md b/hassio/DOCS.md index 9fc9572..a36f6be 100644 --- a/hassio/DOCS.md +++ b/hassio/DOCS.md @@ -13,7 +13,7 @@ # Configuration 1. Find your application code from the list - [here](https://github.com/xury77/AirCon#prerequisites). + [here](https://github.com/sarbuk/AirCon#prerequisites). 1. Set the configuration as follows: ```yaml app: diff --git a/hassio/README.md b/hassio/README.md index 2cd85bb..84bfedb 100644 --- a/hassio/README.md +++ b/hassio/README.md @@ -4,7 +4,7 @@ ## About -Use this add-on to add support for Hisense Air Conditioners. See [here](https://github.com/xury77/AirCon) for more details. +Use this add-on to add support for Hisense Air Conditioners. See [here](https://github.com/sarbuk/AirCon/) for more details. [aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg [amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg diff --git a/new_version.sh b/new_version.sh index 8287e92..b79474e 100755 --- a/new_version.sh +++ b/new_version.sh @@ -46,6 +46,6 @@ git tag -d "$NEW_VERSION" git tag -a "$NEW_VERSION" -m "$NEW_VERSION_MSG" docker buildx rm --all-inactive --force docker buildx create --name multiarch --driver docker-container --use || true -docker buildx build --platform linux/arm/v7,linux/arm64,linux/amd64,linux/386 -t xury77/aircon:$NEW_VERSION --push . +docker buildx build --platform linux/arm/v7,linux/arm64,linux/amd64,linux/386 -t sarbuk/aircon:$NEW_VERSION --push . git push git push --tags diff --git a/repository.json b/repository.json index b94a3b7..c512123 100644 --- a/repository.json +++ b/repository.json @@ -1,5 +1,5 @@ { "name": "Home Assistant Add-on: HiSense Air Conditioners", - "url": "https://github.com/xury77/AirCon", - "maintainer": "Xury77 xury@poczta.onet.pl" + "url": "https://github.com/sarbuk/AirCon", + "maintainer": "sarbuk" } diff --git a/setup.py b/setup.py index 6cb9b82..87b6804 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ description='Interface for controlling Air Conditioners, e.g. with HiSense modules.', long_description=long_description, long_description_content_type='text/markdown', - url='https://github.com/xury77/AirCon', + url='https://github.com/sarbuk/AirCon', author='Dror Eiger', author_email='droreiger@gmail.com', license='GPL 3.0',