0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

iRemocon Wi-Fi (IRM-03WLA)

Posted at

センサから温度など読み込むスクリプト作成

iRemocon Wi-Fi (IRM-03WLA) を使った。理由は手元にあったから。
コマンド仕様書が公開されており、スマホアプリだけでなく自作システムからも制御可能。
IRM-03WLAコマンド仕様書

TCP/IPでiRecomon Wi-Fiから温湿度を取得する

コマンド仕様書には51013のポートにTCP/IP接続してコマンドを送ると結果が返ってくると書いてある。
ということでtelnetとexpectで取得するようにした。

telnet, expectのインストール

$ sudo apt-get install telnet expect

次にtelnetでiRecomonのIP addressとportを指定して接続、コマンド *au\r\n を打って、OKが返ってくることを確認する。

$ telnet $IREMOCON_HOST $IREMOCON_PORT
> *au\r\n
ok 

あとはこんな感じでtenletとexpectを使って値を取得し、表示する。

sensors_iremocon.sh
#!/bin/sh

IREMOCON_HOST=192.168.0.10
IREMOCON_PORT=51013
expect -c "
set timeout 20
spawn telnet $IREMOCON_HOST $IREMOCON_PORT
expect \"Escape character is\";send \"*au\r\n\"
expect \"ok\";send \"*se\r\n\"
expect \"se;ok\";send \"^]\"
" | grep -e "^se;ok;" | cut -d ';' -f3,4,5
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?