LoginSignup
1
1

RM mini3用にリモコン信号を変換

Last updated at Posted at 2022-08-02

これでリモコンを無くした機器があっても、リモコン・データベースで機器のコードがあればRM mini3経由で操作することが可能になる。

下記のWebサイトにて、テレビやエアコンのリモコンデータが公開されているのでこのデータを元に、RM mini3用の信号データに変換を行う。
http://www.256byte.com/remocon/iremo_db.php

■MSB firstをLSB firstに変換

公開されているデータはMSB firstなので、LSB firstにスクリプトで変換する。

convLM.py
#!/usr/bin/env python3

import sys
import re

hex_s = sys.argv[1]
bin_n = bin(int(hex_s,16))

bin_l = len(bin_n[2:])
stn_l = 7 - ((bin_l-1) % 8) + bin_l

bin_zf_n = bin_n[2:].zfill(stn_l)
bin_r = re.split('(........)', bin_zf_n)[1::2]

l = list()
for b in bin_r:
    rev_bin_n = ''.join(list(reversed(b)))
    l.append(format(int(rev_bin_n,2),'02x'))

print(*l)

例:NEC照明の信号(0x41B618E7)を変換

./convLM.py 0x41B618E7
82 6d 18 e7

■NEC フォーマットの汎用信号定義データにエンコード

変換したデータを、スクリプトで汎用信号定義データにエンコードする。

NEC製向けのスクリプトは下記サイトのirnecを参照
http://shrkn65.nobody.jp/remocon/nec.html

#! /usr/bin/perl
#
#  Usage: irnec hex hex hex ...
~

例:NEC照明の信号を変換

./irnec 82 6d 18 e7
38 1 9000 4500 562.5 562.5 562.5 1687.5 562.5 562.5 562.5 562.5 562.5 562.5 562.5 562.5 562.5 562.5 562.5 1687.5 562.5 1687.5 562.5 562.5 562.5 1687.5 562.5 1687.5 562.5 562.5 562.5 1687.5 562.5 1687.5 562.5 562.5 562.5 562.5 562.5 562.5 562.5 562.5 562.5 1687.5 562.5 1687.5 562.5 562.5 562.5 562.5 562.5 562.5 562.5 1687.5 562.5 1687.5 562.5 1687.5 562.5 562.5 562.5 562.5 562.5 1687.5 562.5 1687.5 562.5 1687.5 562.5 41062.5

※Panasonic製などはこちらのスクリプトを参照
http://shrkn65.nobody.jp/remocon/aeha.html

#! /usr/bin/perl
#
#  Usage: iraeha hex hex hex ...
~

■汎用信号定義データをRM mini3用定義へ変換

変換したデータを、スクリプトでRM mini3用定義へ変換する。

スクリプトは下記サイトのirconvertを参照
http://shrkn65.nobody.jp/remocon/convert.html

#! /usr/bin/perl
#
#  Usage: irconvert [options ...] [input_file ...]
~

例:NEC照明の信号を変換

./irnec 82 6D 18 E7 | ./irconvert --in generic --out mame
26004800000127931312133712131213121312121312133712381213123713371213123812371312131213121213123812371312131212131238123713371213121312381237133712000d05

■BlackBeanControlに登録してテスト

BlackBeanControl.iniのCommandsに追記

$ cat BlackBeanControl.ini
[General]
~略~

[Commands]
aircon = 26004800000127931312133712131213121312121312133712381213123713371213123812371312131213121213123812371312131212131238123713371213121312381237133712000d05

リモコン信号送信

python3 BlackBeanControl.py -c aircon

無事家電が反応すればOK

■RM mini3、Google Homeとの連携

下記のサイト等で紹介されている、「リモコンを学習」させるところでリモコン信号送信コマンドを流せば、自分自身で信号の取り込みができる。
https://garapappa.hatenablog.com/entry/20210201/1612148727

これで日常的にGoogle Home→RM mini3と声だけでリモコン操作が可能になる。
ちなみに私はこの方法で複数の照明を操作しており、部屋が暗いときなど動き回らなくても電気がつけられるので重宝している。

参考サイト

http://www.256byte.com/remocon/iremo_db.php
http://shrkn65.nobody.jp/remocon/

1
1
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
1
1