How to use the Nature Remo local API for enhanced latency and reliability on Home Assistant

In this post, I'll delve into how to use the local RESTful API for reduced latency and enhanced reliability when controlling lights in Home Assistant with Nature Remo.

Background

IR-controlled lights are ubiquitous in Japan, even with the emergence of newer "smart" models that often rely on proprietary protocols and apps. Home Assistant offers various ways to control IR lights, with  Broadlink transmitters and the SmartIR integration being a popular choice. While this setup worked well for lights, controlling AC was less reliable due to the IR code complexity.

Commercial AC controllers, such as those from Sensibo and Nature Remo, offered superior AC control reliability. However, Sensibo's focus on climate control and the limitations of the Nature Remo integration at the time meant that controlling both lights and AC required two IR blasters per room—a redundancy I wanted to eliminate.

Nature Remo integration (cloud polling)

My initial attempt involved enhancing the Nature Remo integration. While another user had added light support, it only functioned with remote controls featuring a single "power" (toggle) button, which didn't suit my lights with discrete on/off buttons. Furthermore, the integration was outdated and incompatible with Home Assistant 2025.x.

My patch fixed the isues above, but the latency was noticeable, and I wasn't comfortable relying on the cloud for lighting control.

Setting up local control

Fortunately, Nature Remo offers a local RESTufl API on most of its devices, excluding the Nano model. This guide assumes your Nature Remo devices are already network-connected and have static IP addresses.

Here's simple schematic of this solution. This design allows IR code reuse across different Nature Remo devices and interfacing with the controllers as light entities in Home Assistant.

1. Learning remote codes

  • Aim the remote at the receiver and press a button; the IR receiver will store the last code it detected.
  • Use curl to retrieve the code and save it to a text file:
curl -H "X-Requested-With: XMLHttpRequest" http://<device IP>/messages
  • If using Windows, substitute curl with Invoke-WebRequest:
Invoke-WebRequest -Uri "http://<device IP>/messages" -Headers @{"X-Requested-With" = "XMLHttpRequest"} | Select-Object -Expand Content
  • Be sure to include the | Select-Object -Expand Context or Powershell will truncate the output

  • The output will be in JSON format, containing the frequency and data.
  • Repeat for each button you want to store (e.g., on, off, max).

2. Template Sensor Entities for IP Referencing

  • Create a template sensor in configuration.yaml for each Nature Remo device:
template:
  - sensor:
      - name: "nature_remo_local_bedroom"
        state: "Online"  # The state can be anything 
        attributes:
          ip_address: "<device 1 IP>"
  - sensor:
      - name: "nature_remo_local_office"
        state: "Online" 
        attributes:
          ip_address: "<device 2 IP>"
  • Setting the IP here allows you to pass the entity when calling REST commands, avoiding hardcoding commands per device.

3.  IR Codes as REST Commands

  • Create rest_commands for each saved button:
rest_command:
  nature_remo_on:
    url: "http://{{ state_attr(entity_id, 'ip_address') }}/messages" 
    method: post
    content_type: "application/json"
    headers:
      X-Requested-With: "XMLHttpRequest"
    payload: >
      {
        "format": "us",
        "freq": 37,
        "data":[3430,1782,389,481,387,479,...]
      }
  nature_remo_off:
    url: "http://{{ state_attr(entity_id, 'ip_address') }}/messages"
    method: post
    content_type: "application/json"
    headers:
      X-Requested-With: "XMLHttpRequest"
    payload: >
      {
        "format": "us",
        "freq": 37,
        "data": [3408,1808,397,469,363...]
      }

  • Note that the data in the payload is truncated in this example.
  • I'm only using on/off here, as using relative brightness and temperature gets even more complicated

4. Light Entities from Templates

  • Use light templates to create light entities that call the REST commands:
light:
  - platform: template
    lights:
      bedroom_light:
        friendly_name: "Bedroom Light"
        turn_on:
          - action: rest_command.nature_remo_on
            data:
              entity_id: nature_remo_local_bedroom
        turn_off:
          - action: rest_command.nature_remo_off
            data:
              entity_id: nature_remo_local_bedroom
      office_light:
        friendly_name: "Office Light"
        turn_on:
          - action: rest_command.nature_remo_on
            data:
              entity_id: nature_remo_local_office
        turn_off:
          - action: rest_command.nature_remo_off
            data:
              entity_id: nature_remo_local_office

Possible improvements

The local API has significantly reduced latency, and the system is now more resilient against internet outages. However, the setup and maintenance process remains somewhat complex.

Future considerations include developing a patch for the SmartIR integration or creating a new patch for the Nature Remo integration to streamline the onboarding process.




Comments

Popular posts from this blog

Raspberry Pi-based Home Assistant Control Panel

KingNovyPC M6 N100 Alder Lake-N Slim Mini PC Review

Railway Museum (鉄道博物館, Tetsudō Hakubutsukan)