限界プログラマーの備忘録

安心してぐっすり眠りたい

Nature RemoのAPIで家電情報を取得してみた

はじめに

  • 秋頃にスマートホーム化するためにNature Remo
  • Google Homeからプロジェクターの電源を付けることができないので別の方法を模索中
  • APIをたたいて実行できないか検証したい
  • APIについて知りたい & IPアドレスの検索方法

端末のIPアドレスの検索

  • Swaggerに検索方法は記述されている

local-swagger.nature.global

  • ただしBonjourを入れないといけない
  • Appleアカウントが必要かもしれない
  • 下記サイトを参考にBonjourをインストール

hiragram.github.io

  • 順にコマンドを実行
dns-sd -B _remo._tcp

↓結果

Browsing for _remo._tcp
Timestamp     A/R Flags if Domain                    Service Type              Instance Name
11:14:59.129  Add     2 17 local.                    _remo._tcp.               Remo-mini528F00
dns-sd -G v4 Remo-mini528F00.local

↓結果

Timestamp     A/R Flags if Hostname                  Address                                      TTL
11:15:26.813  Add     2 17 Remo-mini528F00.local.    192.168.3.66                                 120

APIをPythonからたたく

  • APIKeyはあらかじめ発行しておくこと

home.nature.global

  • pythonコードで実装&実行
from remo import NatureRemoAPI

api_key = "hogehoge" # APIアクセストークン
api = NatureRemoAPI(api_key)
appliances = api.get_appliances()

print(json.dumps(json.loads(appliances[0].as_json_string()), indent=2) + "\n")
print(json.dumps(json.loads(appliances[1].as_json_string()), indent=2) + "\n")
print(json.dumps(json.loads(appliances[2].as_json_string()), indent=2) + "\n")
print(json.dumps(json.loads(appliances[3].as_json_string()), indent=2) + "\n")

↓結果

{
  "aircon": null,
  "device": {
    "created_at": "2024-11-12T09:55:29+00:00",
    "firmware_version": "Remo-mini/1.8.1",
    "humidity_offset": 0,
    "id": "66c1b66c-cd59-4929-99af-67667eb29c16",
    "mac_address": "10:97:bd:52:8f:00",
    "name": "Remo mini",
    "serial_number": "2W223020001117",
    "temperature_offset": 0,
    "updated_at": "2024-11-12T09:55:35+00:00"
  },
  "id": "5c5e6b70-50cf-4b67-9339-c3192b59c562",
  "image": "ico_light_projector",
  "light": null,
  "model": {
    "id": "07de36ee-5ce2-494a-a577-7a509659014d",
    "image": "ico_projector",
    "manufacturer": "Anker Japan",
    "name": "Nebula Nova",
    "remote_name": "Nebula Nova"
  },
  "nickname": "\u306f\u3053",
  "settings": null,
  "signals": [],
  "tv": null,
  "type": "LIGHT_PROJECTOR"
}

{
  "aircon": null,
  "device": {
    "created_at": "2024-11-12T09:55:29+00:00",
    "firmware_version": "Remo-mini/1.8.1",
    "humidity_offset": 0,
    "id": "66c1b66c-cd59-4929-99af-67667eb29c16",
    "mac_address": "10:97:bd:52:8f:00",
    "name": "Remo mini",
    "serial_number": "2W223020001117",
    "temperature_offset": 0,
    "updated_at": "2024-11-12T09:55:35+00:00"
  },
  "id": "a6cbc27b-3b90-4c9a-86f2-b6689530c66a",
  "image": "ico_light",
  "light": {
    "buttons": [
      {
        "image": "ico_on",
        "label": "ON",
        "name": "on"
      },
      {
        "image": "ico_off",
        "label": "OFF",
        "name": "off"
      },
      {
        "image": "ico_light_all",
        "label": "All",
        "name": "on-100"
      },
      {
        "image": "ico_light_favorite",
        "label": "Favorite",
        "name": "on-favorite"
      },
      {
        "image": "ico_light_night",
        "label": "Night",
        "name": "night"
      },
      {
        "image": "ico_arrow_top",
        "label": "Bright",
        "name": "bright-up"
      },
      {
        "image": "ico_arrow_bottom",
        "label": "Dark",
        "name": "bright-down"
      },
      {
        "image": "ico_arrow_right",
        "label": "Warm",
        "name": "colortemp-down"
      },
      {
        "image": "ico_arrow_left",
        "label": "Cold",
        "name": "colortemp-up"
      }
    ],
    "state": {
      "brightness": "100",
      "last_button": "on",
      "power": "on"
    }
  },
  "model": {
    "id": "640f1f2e-4b44-4399-bdce-59fae0d5e486",
    "image": "ico_light",
    "manufacturer": "Mitsubishi",
    "name": "Mitsubishi LIGHT 001",
    "remote_name": "etx-30-ch1"
  },
  "nickname": "\u7167\u660e",
  "settings": null,
  "signals": [],
  "tv": null,
  "type": "LIGHT"
}

{
  "aircon": {
    "range": {
      "fixedButtons": [
        "power-off"
      ],
      "modes": {
        "auto": {
          "dir": [
            "still",
            "swing"
          ],
          "temp": [
            "-2",
            "-1",
            "0",
            "1",
            "2"
          ],
          "vol": [
            "1",
            "2",
            "3",
            "4",
            "auto"
          ]
        },
        "blow": {
          "dir": [
            "still",
            "swing"
          ],
          "temp": [
            ""
          ],
          "vol": [
            "1",
            "2",
            "3",
            "4",
            "auto"
          ]
        },
        "cool": {
          "dir": [
            "still",
            "swing"
          ],
          "temp": [
            "18",
            "19",
            "20",
            "21",
            "22",
            "23",
            "24",
            "25",
            "26",
            "27",
            "28",
            "29",
            "30"
          ],
          "vol": [
            "1",
            "2",
            "3",
            "4",
            "auto"
          ]
        },
        "dry": {
          "dir": [
            "still",
            "swing"
          ],
          "temp": [
            "18",
            "19",
            "20",
            "21",
            "22",
            "23",
            "24",
            "25",
            "26",
            "27",
            "28",
            "29",
            "30"
          ],
          "vol": [
            ""
          ]
        },
        "warm": {
          "dir": [
            "still",
            "swing"
          ],
          "temp": [
            "16",
            "17",
            "18",
            "19",
            "20",
            "21",
            "22",
            "23",
            "24",
            "25",
            "26",
            "27",
            "28",
            "29",
            "30"
          ],
          "vol": [
            "1",
            "2",
            "3",
            "4",
            "auto"
          ]
        }
      }
    },
    "tempUnit": "c"
  },
  "device": {
    "created_at": "2024-11-12T09:55:29+00:00",
    "firmware_version": "Remo-mini/1.8.1",
    "humidity_offset": 0,
    "id": "66c1b66c-cd59-4929-99af-67667eb29c16",
    "mac_address": "10:97:bd:52:8f:00",
    "name": "Remo mini",
    "serial_number": "2W223020001117",
    "temperature_offset": 0,
    "updated_at": "2024-11-12T09:55:35+00:00"
  },
  "id": "42a61932-846a-473d-aa5d-bb7743ae5882",
  "image": "ico_ac_1",
  "light": null,
  "model": {
    "id": "da76088e-6380-4074-b4cb-195c13b547d3",
    "image": "ico_ac_1",
    "manufacturer": "Fujitsu",
    "name": "Fujitsu AC 026",
    "remote_name": "ar-rfc6j"
  },
  "nickname": "\u30a8\u30a2\u30b3\u30f3",
  "settings": {
    "button": "",
    "dir": "still",
    "mode": "warm",
    "temp": "23",
    "vol": "auto"
  },
  "signals": [],
  "tv": null,
  "type": "AC"
}

{
  "aircon": null,
  "device": {
    "created_at": "2024-11-12T09:55:29+00:00",
    "firmware_version": "Remo-mini/1.8.1",
    "humidity_offset": 0,
    "id": "66c1b66c-cd59-4929-99af-67667eb29c16",
    "mac_address": "10:97:bd:52:8f:00",
    "name": "Remo mini",
    "serial_number": "2W223020001117",
    "temperature_offset": 0,
    "updated_at": "2024-11-12T09:55:35+00:00"
  },
  "id": "d7f68f29-a7f2-4025-bbef-cdadd778dc51",
  "image": "ico_tv",
  "light": null,
  "model": {
    "id": "46839d12-2a81-4e9d-9ab8-64e71fbf66c2",
    "image": "ico_tv",
    "manufacturer": "Hisense",
    "name": "Hisense TV 001",
    "remote_name": "en3b40h"
  },
  "nickname": "\u30c6\u30ec\u30d3",
  "settings": null,
  "signals": [],
  "tv": {
    "buttons": [
      {
        "image": "ico_io",
        "label": "Power",
        "name": "power"
      },
      {
        "image": "ico_input",
        "label": "Source",
        "name": "select-input-src"
      },
      {
        "image": "ico_tv_guide",
        "label": "Schedule",
        "name": "tv-schedule"
      },
      {
        "image": "ico_mute",
        "label": "Mute",
        "name": "mute"
      },
      {
        "image": "ico_tv",
        "label": "Terrestrial",
        "name": "input-terrestrial"
      },
      {
        "image": "ico_bs",
        "label": "BS",
        "name": "input-bs"
      },
      {
        "image": "ico_cs",
        "label": "CS",
        "name": "input-cs"
      },
      {
        "image": "ico_select_audio",
        "label": "Select Audio",
        "name": "select-audio"
      },
      {
        "image": "ico_number_1",
        "label": "1",
        "name": "ch-1"
      },
      {
        "image": "ico_number_2",
        "label": "2",
        "name": "ch-2"
      },
      {
        "image": "ico_number_3",
        "label": "3",
        "name": "ch-3"
      },
      {
        "image": "ico_number_4",
        "label": "4",
        "name": "ch-4"
      },
      {
        "image": "ico_number_5",
        "label": "5",
        "name": "ch-5"
      },
      {
        "image": "ico_number_6",
        "label": "6",
        "name": "ch-6"
      },
      {
        "image": "ico_number_7",
        "label": "7",
        "name": "ch-7"
      },
      {
        "image": "ico_number_8",
        "label": "8",
        "name": "ch-8"
      },
      {
        "image": "ico_number_9",
        "label": "9",
        "name": "ch-9"
      },
      {
        "image": "ico_number_10",
        "label": "10",
        "name": "ch-10"
      },
      {
        "image": "ico_number_11",
        "label": "11",
        "name": "ch-11"
      },
      {
        "image": "ico_number_12",
        "label": "12",
        "name": "ch-12"
      },
      {
        "image": "ico_return",
        "label": "Back",
        "name": "back"
      },
      {
        "image": "ico_home",
        "label": "Home",
        "name": "home"
      },
      {
        "image": "ico_display",
        "label": "Display Change",
        "name": "display"
      },
      {
        "image": "ico_d",
        "label": "Data",
        "name": "d"
      },
      {
        "image": "ico_arrow_top",
        "label": "Next Channel",
        "name": "ch-up"
      },
      {
        "image": "ico_arrow_bottom",
        "label": "Previous Channel",
        "name": "ch-down"
      },
      {
        "image": "ico_arrow_left",
        "label": "Left",
        "name": "left"
      },
      {
        "image": "ico_arrow_top",
        "label": "Top",
        "name": "up"
      },
      {
        "image": "ico_arrow_right",
        "label": "Right",
        "name": "right"
      },
      {
        "image": "ico_arrow_bottom",
        "label": "Bottom",
        "name": "down"
      },
      {
        "image": "ico_record",
        "label": "Ok",
        "name": "ok"
      },
      {
        "image": "ico_plus",
        "label": "Volume Up",
        "name": "vol-up"
      },
      {
        "image": "ico_minus",
        "label": "Volume Down",
        "name": "vol-down"
      },
      {
        "image": "ico_color_blue",
        "label": "Blue",
        "name": "blue"
      },
      {
        "image": "ico_color_red",
        "label": "Red",
        "name": "red"
      },
      {
        "image": "ico_color_green",
        "label": "Green",
        "name": "green"
      },
      {
        "image": "ico_color_yellow",
        "label": "Yellow",
        "name": "yellow"
      },
      {
        "image": "ico_backward",
        "label": "Fast Rewind",
        "name": "fast-rewind"
      },
      {
        "image": "ico_play",
        "label": "Play",
        "name": "play"
      },
      {
        "image": "ico_record",
        "label": "Record",
        "name": "record"
      },
      {
        "image": "ico_forward",
        "label": "Fast Forward",
        "name": "fast-forward"
      },
      {
        "image": "ico_previous",
        "label": "Previous",
        "name": "prev"
      },
      {
        "image": "ico_pause",
        "label": "Pause",
        "name": "pause"
      },
      {
        "image": "ico_stop",
        "label": "Stop",
        "name": "stop"
      },
      {
        "image": "ico_next",
        "label": "Next",
        "name": "next"
      },
      {
        "image": "",
        "label": "Clear Sound",
        "name": "clear-sound"
      },
      {
        "image": "",
        "label": "Rec List",
        "name": "rec-list"
      },
      {
        "image": "ico_setting",
        "label": "Settings",
        "name": "settings"
      },
      {
        "image": "",
        "label": "Submenu",
        "name": "submenu"
      },
      {
        "image": "ico_cross",
        "label": "Exit",
        "name": "exit"
      },
      {
        "image": "ico_4k",
        "label": "4K",
        "name": "input-4k"
      },
      {
        "image": "ico_n",
        "label": "Netflix",
        "name": "netflix"
      },
      {
        "image": "ico_a",
        "label": "Prime Video",
        "name": "prime-video"
      },
      {
        "image": "ico_h",
        "label": "Hulu",
        "name": "hulu"
      }
    ],
    "state": {
      "input": "t"
    }
  },
  "type": "TV"
}
  • 確かに取得できた。

所感

  • 意外と情報がある
  • 本家のアプリは多少使いにくいので独自にandroidアプリを作っても面白いかもしれない・・・

あけましておめでとうございます。

今週のお題「2024こんな年だった・2025こんな年にしたい」

あけましておめでとうございます。 今年もよろしくお願いいたします。

今年やりたいこと

ブログの更新

  • 昨年はアウトプットが弱かった
  • 技術・生活・ライフハックなどジャンル問わず
  • 薄く長くやりたい

体調不良の回数を減らす

  • 昨日は3・4回程度体調不良の時期があった
  • 今年は2回までで。
  • 手洗い・うがいしっかり

AWS資格の取得(なにか1つ)

  • クラウドへの理解が進んだ昨年
  • さらに運用面を理解したい
  • アプリ作ってのせられるといいね

できればやりたいこと

  • 英会話の練習
  • 減量
  • AIを活用したアプリ作成