Pythonでnature remoのAPIにアクセスして温度、湿度、照度を取得

nature remoから部屋の温度を取得してみたのでメモ。

nature remoのサイトにログインして、アクセストークンを取得 home.nature.global

今回はPythonを利用。

Pythonの下記ライブラリを利用させてもらった。 pypi.org

requestsに依存しているので、requestsもインストール

pip install requests
pip install nature-remo
from remo import NatureRemoAPI

ACCESS_TOKEN = r"(アクセストークン)"
api = NatureRemoAPI(ACCESS_TOKEN)

if __name__ == '__main__':
    devices = api.get_devices()
    print(devices[0])
    te = devices[0].newest_events["te"].val
    il = devices[0].newest_events["il"].val
    hu = devices[0].newest_events["hu"].val
    print(f"温度:{te} 湿度:{il} 照度:{hu}")

データの蓄積についてはまた考えよう。