{"id":14962074,"url":"https://github.com/swicago/heatpump","last_synced_at":"2025-05-15T23:02:32.117Z","repository":{"id":37663807,"uuid":"78368476","full_name":"SwiCago/HeatPump","owner":"SwiCago","description":"Arduino library to control Mitsubishi Heat Pumps via connector cn105","archived":false,"fork":false,"pushed_at":"2024-09-25T21:24:28.000Z","size":456,"stargazers_count":915,"open_issues_count":4,"forks_count":238,"subscribers_count":81,"default_branch":"master","last_synced_at":"2025-05-15T23:01:48.652Z","etag":null,"topics":["airconditioning","arduino","arduino-library","c-library","esp8266","heatpump","home-assistant","hvac","kumocloud","melcloud","mitsubishi","mqtt","openhab","serial","wifi"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SwiCago.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":"2017-01-08T20:25:38.000Z","updated_at":"2025-05-15T19:34:26.000Z","dependencies_parsed_at":"2023-01-28T01:16:25.461Z","dependency_job_id":"f51bb091-f420-4da7-a603-d76bb7f17e69","html_url":"https://github.com/SwiCago/HeatPump","commit_stats":{"total_commits":232,"total_committers":40,"mean_commits":5.8,"dds":"0.48275862068965514","last_synced_commit":"5d1e146771d2f458907a855bf9d5d4b9bf5ff033"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiCago%2FHeatPump","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiCago%2FHeatPump/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiCago%2FHeatPump/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiCago%2FHeatPump/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SwiCago","download_url":"https://codeload.github.com/SwiCago/HeatPump/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254436943,"owners_count":22070946,"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":["airconditioning","arduino","arduino-library","c-library","esp8266","heatpump","home-assistant","hvac","kumocloud","melcloud","mitsubishi","mqtt","openhab","serial","wifi"],"created_at":"2024-09-24T13:29:02.714Z","updated_at":"2025-05-15T23:02:32.073Z","avatar_url":"https://github.com/SwiCago.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"Support Chat here -\u003e [![Join the chat at https://gitter.im/Mitsubishi-Heat-Pump](https://badges.gitter.im/Join%20Chat.svg)](https://app.gitter.im/#/room/#Mitsubishi-Heat-Pump_Lobby:gitter.im)  \u003c-Support Chat here\n\n# HeatPump\n\nArduino library to control Mitsubishi Heat Pumps via connector CN105.\n\n## Quick start\n\n### Controlling the heat pump\n\n```c++\nHeatPump hp;\nhp.connect(\u0026Serial);\n\nheatpumpSettings settings = {\n    \"ON\",  /* ON/OFF */\n    \"FAN\", /* HEAT/COOL/FAN/DRY/AUTO */\n    26,    /* Between 16 and 31 */\n    \"4\",   /* Fan speed: 1-4, AUTO, or QUIET */\n    \"3\",   /* Air direction (vertical): 1-5, SWING, or AUTO */\n    \"|\"    /* Air direction (horizontal): \u003c\u003c, \u003c, |, \u003e, \u003e\u003e, \u003c\u003e, or SWING */\n}; \n\nhp.setSettings(settings);\n// OR individual settings\n// hp.setModeSetting(\"COOL\");\n\n// hp.setFastSync(true); // enable fast sync mode, we only request RQST_PKT_SETTINGS, RQST_PKT_ROOM_TEMP and RQST_PKT_STATUS\nhp.update();\n```\n\n[See heatPump_test.ino](examples/heatPump_test/heatPump_test.ino)\n\nYou can make the library automatically send new settings to the heat pump by calling `enableAutoUpdate()`. When auto update is enabled the call to `update()` in the above example is not necessary, the new settings will be sent to the heat pump on the next call to `sync()` in `loop()`.\n\n### Getting updates from the heat pump\n\n```c++\nvoid setup() {\n  HeatPump hp;\n  hp.connect(\u0026Serial);\n}\n\nvoid loop() {\n  hp.sync();\n\n  /* get settings from heatpump, including room temperature in settings.roomTemperature */\n  heatpumpSettings settings = hp.getSettings();\n}\n\n```\n\nBy default the library ignores changes made from other sources (usually, the IR remote) and reverts them the next time `sync()` is called. This is the intendend behavior when the heat pump is fully controlled by automation.\n\nIf you want to also allow manual control and allow the library to update its settings from the current state of the heat pump you need to call `enableExternalUpdate()`. This will also enable automatic updates.\n\n### Support for installer settings/functions\nImportant: This is only tested on PVA (P-Series air handler) units and is not known to work on any other models. \n\nYou can refer to page 6 of this document to see the generic list of functions: https://www.mitsubishitechinfo.ca/sites/default/files/Installation_Manual_69-2426-01_0.pdf. Note that what each setting does is model specific. For example, this document lists the available codes and values for PVAs: https://www.mitsubishitechinfo.ca/sites/default/files/IM_PVA_A12_42AA7_PA79D213H09.pdf, page 22.\n\n```c++\nheatpumpFunctions functions = hp.getFunctions();\n\nheatpumpFunctionCodes codes = functions.getAllCodes();\nfor (int i = 0; i \u003c MAX_FUNCTION_CODE_COUNT; ++i) {\n  if (codes.valid[i]) {\n    int code = codes.code[i];\n    int value = functions.getValue(code);\n    // handle value\n  }\n}\n\n\nif (!functions.setValue(code, value)) {\n  // handle error\n}\n\nif (!hp.setFunctions(functions)) {\n  // handle error\n}\n```\n\nIt is recommended to call `getFunctions()` every time when you need to make a change to the values in order to get a fresh `heatpumpFunctions`. Otherwise you might accidentally write out stale values and overwrite changes that might have happened through other sources.\n\n### Callbacks\n\nInstead of manually checking settings changes on each loop, you can set callback functions to be called when the current heat pump status or settings change:\n\n```\nvoid hpSettingsChanged() {\n  // ...\n}\n\nvoid hpStatusChanged(heatpumpStatus currentStatus) {\n  // ...\n}\n\nvoid setup() {\n  hp.setSettingsChangedCallback(hpSettingsChanged);\n  hp.setStatusChangedCallback(hpStatusChanged);\n\n  hp.connect(\u0026Serial);\n}\n```\n\nThe callbacks will be called as necessary by the `sync()` method.\n\nYou can see this in use in the [MQTT example](examples/mitsubishi_heatpump_mqtt_esp8266_esp32/mitsubishi_heatpump_mqtt_esp8266_esp32.ino).\n\n## Contents\n\n- sources\n- sample usage code\n- Demo circuit using ESP-01\n\n## Installation\n\n- PULL or download zip.\n- Move contents into Arduino library directory\n- Restart IDE, samples should be avaliable\n- NOTE: Requires arduino json 6, older commits before 20190505 support json 5.\n- If you find this all a little confusing, check out this write up blog/install by Chris Davis\n    - https://chrdavis.github.io/hacking-a-mitsubishi-heat-pump-Part-1/\n    - https://chrdavis.github.io/hacking-a-mitsubishi-heat-pump-Part-2/\n        - Note: some people report problems with Wemos D1 due to usb serial pulling RX high when usb idle! Fix is to cut a trace, so maybe use an alternative, if following the above blog links.\n## Notes\n\n- Tested with ESP8266\n- Tested with Arduino Micro Pro / Arduino Nano\n- Tested with Mitsubishi HeatPump MSZ-FH/GE(wall units) and SEZ-KD (ducted units) [complete list](https://github.com/SwiCago/HeatPump/wiki/Supported-models)\n\n## Demo Circuit\n\n\u003cimg src=\"https://github.com/SwiCago/HeatPump/blob/master/CN105_ESP8266.png\"/\u003e\n\n## Parts\n\n### Parts required to make a CN105 female connector\n\n- PAP-05V-S CONN HOUSING PA 5POS 2MM WHITE \n    - Digi-Key Part Number \t455-1489-ND \n    - \u003chttps://www.digikey.com/product-detail/en/jst-sales-america-inc/PAP-05V-S/455-1489-ND/759977\u003e\n- SPHD-002T-P0.5  CONN TERM PHD CRIMP 24-28AWG TIN  \n    - Digi-Key Part Number \t455-1313-1-ND\n    - \u003chttps://www.digikey.com/product-detail/en/jst-sales-america-inc/SPHD-002T-P0.5/455-1313-1-ND/608809\u003e\n- JUMPER SPHD-001T-P0.5 X2 12\" (pre-crimped alternative to 455-1313-1-ND connectors)\n    - Digi-Key Part Number    455-3086-ND\n    - \u003chttps://www.digikey.co.uk/product-detail/en/jst-sales-america-inc/APAPA22K305/455-3086-ND/6009462\u003e\n\n### Other part suggestions\n\n- Premade pigtails\n    - \u003chttps://m.aliexpress.com/item/1005002904897793.html\u003e select 5P option\n- ESP-01 module (4pk)\n    - \u003chttps://www.amazon.com/gp/product/B01EA3UJJ4/\u003e\n- Cheap 5V to 3.3V regulator (10pk), for those that don't want to make one\n    - \u003chttps://www.amazon.com/gp/product/B00XAGSHY2/\u003e\n- ESP-01 breakout with prewired level shifters and regulator\n    - \u003chttps://www.amazon.com/gp/product/B01M09B43H/\u003e\n\n\n## Special thanks\n\n... to Hadley in New Zealand. His blog post, describing baud rate and details of cn105, Raspberry Pi Python code:\n\n\u003chttps://nicegear.co.nz/blog/hacking-a-mitsubishi-heat-pump-air-conditioner/\u003e\n\nWayback machine link as the site no longer exists:\n\u003chttps://web.archive.org/web/20171007190023/https://nicegear.co.nz/blog/hacking-a-mitsubishi-heat-pump-air-conditioner/\u003e\n\n## License\n\nLicensed under the GNU Lesser General Public License.\nhttps://www.gnu.org/licenses/lgpl-3.0.txt\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswicago%2Fheatpump","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswicago%2Fheatpump","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswicago%2Fheatpump/lists"}