{"id":22624612,"url":"https://github.com/barrettotte/smarter-ac-unit","last_synced_at":"2026-04-05T23:35:41.443Z","repository":{"id":173177161,"uuid":"625309629","full_name":"barrettotte/smarter-ac-unit","owner":"barrettotte","description":"Making my AC unit a little smarter with MQTT and Home Assistant","archived":false,"fork":false,"pushed_at":"2023-06-06T21:29:39.000Z","size":5292,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-03T13:13:14.746Z","etag":null,"topics":["arduino","esp8266","home-assistant","ir-sensor","mqtt"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/barrettotte.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-08T18:01:01.000Z","updated_at":"2023-06-11T23:14:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"e3c11770-7773-415f-9594-e01f0a2e4aef","html_url":"https://github.com/barrettotte/smarter-ac-unit","commit_stats":null,"previous_names":["barrettotte/smarter-ac-unit"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barrettotte%2Fsmarter-ac-unit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barrettotte%2Fsmarter-ac-unit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barrettotte%2Fsmarter-ac-unit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barrettotte%2Fsmarter-ac-unit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/barrettotte","download_url":"https://codeload.github.com/barrettotte/smarter-ac-unit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246131335,"owners_count":20728303,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","esp8266","home-assistant","ir-sensor","mqtt"],"created_at":"2024-12-09T00:17:02.305Z","updated_at":"2025-12-30T23:18:58.637Z","avatar_url":"https://github.com/barrettotte.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# smarter-ac-unit\n\nMaking my AC unit a little smarter with MQTT and Home Assistant\n\n## Summary\n\nUses Home Assistant, MQTT, and an infrared transmitter to control parts of my AC unit that I care about. \nThis is only meant to work with my AC unit model, [LG LP1017WSR](https://www.lg.com/us/air-conditioners/lg-LP1017WSR-portable-air-conditioner).\n\nFeatures:\n\n- Set temperature between 60°F-86°F, defaulting to 70°F\n- Toggle power - off, on (cool mode)\n- Change fan speed - low, high\n\n![images/home-assistant.png](images/home-assistant.png)\n\nI also added a manual sync button to my circuit to allow resyncing both Home Assistant and the AC unit\nback to the state stored on the ESP8266.\nThis solves any rare problems where states get out of sync and start behaving strangely.\n\n\u003ca href=\"images/final-build.jpg\"\u003e\n  \u003cimg src=\"images/final-build.jpg\" alt=\"final build\" width=\"75%\" height=\"75%\"/\u003e\n\u003c/a\u003e\n\n## Hardware\n\n### Parts List\n\n- 1x ESP8266\n- 1x 2N3904 NPN transistor\n- 1x IR LED\n- 1x Red LED\n- 1x 10KΩ resistor\n- 1x 47Ω resistor\n- 1x 470Ω resistor\n- 1x pushbutton\n- 4x 2.5x8mm hex button screws\n\n![images/circuit.png](images/circuit.png)\n\n\u003ca href=\"images/protoboard.jpg\"\u003e\n  \u003cimg src=\"images/protoboard.jpg\" alt=\"protoboard\" width=\"75%\" height=\"75%\"/\u003e\n\u003c/a\u003e\n\n## Infrastructure\n\n### MQTT Broker\n\nUsed Eclipse Mosquitto for my MQTT broker, I used Docker to run it.\n\n```yml\n# docker-compose.yml\n\nmosquitto:\n  container_name: mosquitto\n  image: eclipse-mosquitto:2\n  ports:\n    - '1883:1883' # MQTT\n    - '9011:9011' # MQTT over websocket\n  volumes:\n  - /etc/timezone:/etc/timezone:ro\n  - /etc/localtime:/etc/localtime:ro\n  - ./mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf\n  - /home/docker/data/mosquitto/data:/mosquitto/data\n  - /home/docker/data/mosquitto/logs:/mosquitto/log\n  network_mode: host\n  restart: unless-stopped\n```\n\n```conf\n# mosquitto.conf\n\nlistener 1883\n\nlistener 9011\nprotocol websockets\n\npersistence true\npersistence_location /mosquitto/data/\n\nlog_dest stdout\n```\n\n### Home Assistant\n\nI also self-host Home Assistant in Docker\n\n```yml\nhome-assistant:\n    container_name: home-assistant\n    image: homeassistant/home-assistant:2023.3\n    ports:\n      - '8123:8123'\n    volumes:\n      - /etc/timezone:/etc/timezone:ro\n      - /etc/localtime:/etc/localtime:ro\n      - './home-assistant:/config'\n    restart: unless-stopped\n```\n\nIf MQTT discovery is disabled in `config.h`, then this can be manually configured \nin the `configuration.yml`\n\n```yml\n# configuration.yml\n\nmqtt:\n  climate:\n    - name: Bedroom AC (LG LP1017WSR)\n      unique_id: smarter_ac_unit\n      qos: 0\n      optimistic: true\n      modes:\n        - \"off\"\n        - \"cool\"\n      fan_modes:\n        - \"high\"\n        - \"low\"\n      min_temp: 60\n      max_temp: 86\n      initial: 70\n      temperature_unit: F\n      temp_step: 1\n      mode_command_topic: \"smarter_ac_unit/mode/set\"\n      mode_command_template: \"{{ value if value == 'off' else 'on' }}\"\n      mode_state_topic: \"smarter_ac_unit/mode/state\"\n      fan_mode_command_topic: \"smarter_ac_unit/fan/set\"\n      fan_mode_state_topic: \"smarter_ac_unit/fan/state\"\n      temperature_command_topic: \"smarter_ac_unit/temperature/set\"\n      temperature_state_topic: \"smarter_ac_unit/temperature/state\"\n```\n\n## IR Codes\n\n```txt\nExample IR Code (via ir-sniffer):\n\nProtocol  : WHIRLPOOL_AC\nCode      : 0x830601A20000C000000000000063001100803800A9 (168 Bits)\nMesg Desc.: Model: 2 (DG11J191), Power Toggle: Off, Mode: 2 (Cool), \n            Temp: 26C, Fan: 1 (High), Swing: Off, Light: On, \n            Clock: 00:00, On Timer: Off, Off Timer: Off, \n            Sleep: Off, Super: Off, Command: 17 (Fan)\n```\n\nUsed [ir-sniffer](https://github.com/barrettotte/ir-sniffer) to manually gather all relevant IR codes\nof button presses and states for my AC unit.\nIR codes can be found in [docs/ir-codes.txt](docs/ir-codes.txt), these codes were used to create the table below.\n\nNote: I'm only looking at cool mode...other modes may effect the values below.\nAlso, not figuring out sleep and timer...I don't use these at all.\nSome of the mystery constants are probably part of this.\n\n| Indices | Values                          | Notes                                                                     |\n| ------- | ------------------------------- | ------------------------------------------------------------------------- |\n| 0:3     | 8306                            | model...I guess?                                                          |\n| 4:5     | 01,03                           | Fan: 1=High, 3=Low                                                        |\n| 6       | 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F | Temperature: 60F-75F                                                      |\n|         | 0,1,2,3,4,5,6,7,8,9,A           | Temperature: 76F-86F                                                      |\n| 7       | 2                               | Mode: 2=Cool                                                              |\n| 8:15    | 0000C000                        | ?                                                                         |\n| 16      | 0,4                             | Swing: 0=off, 4=high                                                      |\n| 17:25   | 000000000                       | ?                                                                         |\n| 26      | C,D,E,F,8,9,A,B,4,5,6,7,0,1,2,3 | Temperature: 60F-75F                                                      |\n|         | C,D,E,F,8,9,A,B,4,5,6           | Temperature: 76F-86F                                                      |\n| 27      | 3,1                             | Fan: 3=High, 1=Low                                                        |\n| 28:29   | 00                              | ?                                                                         |\n| 30:31   | 02,25                           | command (temperature change, power toggle)                                |\n| 32:33   | 00                              | ?                                                                         |\n| 34:36   | 003                             | cool mode, high/low fan, Temperature: 60F-75F, [temp change or power on]  |\n|         | 803                             | cool mode, high/low fan, Temperature: 76F-86F, [temp change or power on]  |\n|         | 002                             | cool mode, high/low fan, Temperature: 60F-75F, power off                  |\n|         | 802                             | cool mode, high/low fan, Temperature: 76F-86F, power off                  |\n| 37:39   | 800                             | ?                                                                         |\n| 40:41   | 3A                              | cool mode, high/low fan, Temperature: 60F-75F, temp change                |\n|         | BA                              | cool mode, high/low fan, Temperature: 76F-86F, temp change                |\n|         | 0D                              | cool mode, high/low fan, Temperature: 60F-75F, power off                  |\n|         | 8D                              | cool mode, high/low fan, Temperature: 76F-86F, power off                  |\n|         | 1D                              | cool mode, high/low fan, Temperature: 60F-75F, power on                   |\n|         | 9D                              | cool mode, high/low fan, Temperature: 76F-86F, power on                   |\n|         | 29                              | cool mode, high/low fan, Temperature: 60F-75F, fan toggle                 |\n|         | A9                              | cool mode, high/low fan, Temperature: 76F-86F, fan toggle                 |\n\n## References\n\n- https://github.com/Arduino-IRremote/Arduino-IRremote\n- https://www.home-assistant.io/integrations/climate.mqtt/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarrettotte%2Fsmarter-ac-unit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbarrettotte%2Fsmarter-ac-unit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarrettotte%2Fsmarter-ac-unit/lists"}