# Integrate HomeAssistant on NAS with HomeKit

# Background

* I am using a QNAP ARM CPU NAS, so its power efficiency is supposed to be a great advantage.
    
* I want to integrate the accessories, especially the IR remote, with HomeKit for a better user experience when controlling the old air conditioner. The BroadLink first-party app isn't very good.
    

# Step By Step

## Install HomeAssistant

> First, install `Container Station`.

Do not follow the online instructions to download the `ARM` version; simply pull the latest version from GitHub.

* Please add the GitHub repository instead of using the default DockerHub repo.
    
    * LINK: [https://ghcr.io](https://ghcr.io)
        
    * Choose `Others` tag
        
* Pull the image by selecting `homeassistant/home-assistant:2025.1.4`, which has been fully tested.
    
* Please note that you need to do two things:
    
    * Set the network mode to `Host`.
        
    * Create a volume on your NAS and map it to the `/config` folder.
        
* YES: You can visit the site at `http://{your_nas_ip}:8123`, then create your user and password.
    

# Setup the devices

* First, you need to set up your devices using the `BroadLink` app.
    
* Then, use the lightweight web dashboard to add all the remotes you want. Of course, all of them can be detected through the network.
    
* ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1738403422422/8b945ccc-8ea2-43ef-a5ee-309a21bf0f76.png align="center")
    

# Learn the commands

* Go to `Developer Tools > ACTIONS`. Some blogs or videos might tell you to look in the `Service` tab, but that's incorrect because it has been replaced by the new `Actions` section.
    
* The saved command will be located in the mounted volume at the `/config/.storage` folder (in the container; it depends on your actual path if you are using a NAS file browser), and the filename will be something like `broadlink_remote_{mac_address_without_colon}_codes`.
    
* This `JSON` file is very important; it's like a simulated switch and includes the command data like this:
    
    * ```bash
        {
          "version": 1,
          "minor_version": 1,
          "key": "broadlink_remote_e816565421ef_codes",
          "data": {
            "Bedroom Air Conditioner": {
              "On": "JgBMAm43DSoNKg0PDQ8NDwwqDg8MDw4qDCoPDgwrDQ8MDw0qDioNDg4qDSoNDwwPDioNDg4ODSsNDg4PDA8ODg0PDQ8NDg4PDA8ODgwQDQ8NDg0QDA8NDwwPDg4MEA0ODSsNDg4PDBANDg0PDSoNKg0PDA8ODwwPDSsMDw8pDQ8NDg0PDQ8MDw4qDCsNDw0qDCsODg0PDSoNDw0PDA8ODg0PDCsNDw0PDQ4ODwwPDQ8NDwwPDQ8NEAwPDBANDg4PDA8NDg4PDA8ODgwQDBANDg0PDBANDg4PDA8MEAwPDRAMDw0ODRAMDw4ODQ8MEAwPDg8MDw4ODQ8MDw0PDQ8NDwwPDg4NDw0PDQ4NEAsQDQ8NDwwPDQ8NDwwrDCsNKg0QCxANKwwqDgACI3E4DSoNKw0ODg8LEA0rDA8ODgwrDCsNDw0qDRAMDw4qCysODwsrDioMEA0ODSsNDg0QDCoODwwPDQ8NDw0PCxANDw4ODQ8NDw0PDA8ODgwQDBANDg0PDQ8NDg4PDCoODg0PDQ8NDg4PDCoNKw0ODg8MDwwQDCsMEA0rCxANDg4PDBANDg0rDCsNDw0qDSoNDw0PDSoNDw0PDQ4ODwsQDioLEA0PDBAMEAwPDg4NDwwPDQ8NEAwPDQ4ODwwPDg4NDwwQCxAMEAwQDA8NDw0QCxANDg0QDA8NDg4PDA8NDw0QCxALEA0QDA8MEA0ODQ8NEAsPDhALEA0ODBEMDw0PDQ8MEAsPDg8MEAsQDQ8MEAwQDA8MEQsrDSsNKwsQCxANKwwrDQANBQ==",
              "Off": "JgAaAW04DCsNKg4ODQ8NDw0qDQ8NDg4qDSoNDw0qDBAMDw4qDCsNDw0qDCsODg0PDCsMEAwQDSwLEAsRDBALEQoRDBEKEQsRCxIKEQoSCxEKEgoRCxELEQoSChEMEQoRCxEKEgkTCRMJEwkTCC8JLQoTCRIKEwkTCS4JEwktCxEKEgoSCxALEgosCywMEAwrDCwLEQsQDSsLEAwQDBAMEAwPDCsNDwwQDBELEAwRChEMDwwRCxAMEAwQCxEMDwwRDBAKEgsRChIKEgsRChIKEQsSChEJEwoTCBIKEwkTCRMIEwkSChMIEwoSCRMIFQcUCRMIFAcUCRQHFAgVBxYGFQcUCBYFFgYVBxYGFQYXBhUGFgYVBxUGFgYzBAANBQ=="
            }
          }
        }
        ```
        

# Add a Custom Switch for Wrapping the Action

* Click the button on this page: [Home Assistant Switch Template](https://www.home-assistant.io/integrations/switch.template/) to add the custom switch.
    
* Then, try to copy and paste the commands (starting with `b64:`) to the correct location.
    

# Add HomeKit and Select Them

# Notes
