Yes it is possible to learn commands using a different program and then create the file for the binding to use, the formats and process to create the correct file are explained in the binding documentation.
Migrating Legacy Map File
Up to openHAB version 3.3, there was a previous version of this binding that was not part of the openHAB distribution. It stored the IR/RF commands in a different place and a different format. If you want to mirgrate from those versions to this version of the binding, please read this section.
The map file contains a list of IR command codes to send via the device; there is a separate map file for RF codes.
# openHAB < 4.3.0
Before openHAB version 4.3.0, the file used the Java Properties File format
(opens new window) and was stored in the <OPENHAB_CONF>/transform folder. By default, the file name was broadlink.map for the IR codes, but could be changed using the mapFile setting. In similar fashion, the RM pro models stored the RF codes in the broadlinkrf.map file.
Here is a map file example of the previous file format:
TV_POWER=26008c0092961039103a1039101510151014101510151039103a10391015101411141015101510141139101510141114101510151014103a10141139103911391037123a10391000060092961039103911391014111410151015101411391039103a101411141015101510141015103911141015101510141015101510391015103911391039103a1039103911000d05000000000000000000000000
heatpump_off=2600760069380D0C0D0C0D290D0C0D290D0C0D0C0D0C0D290D290D0C0D0C0D0C0D290D290D0C0D0C0D0C0D0C0D0C0D0C0D0C0D0C0D0C0D0C0D0C0D0C0D0C0D290D0C0D0C0D0C0D0C0D0C0D0C0D0C0D290D0C0D0C0D0C0D0C0D290D0C0D0C0D0C0D0C0D0C0D0C0D290D0C0D290D290D290D290D290D290E0002900000
The above codes are power on/off for Samsung TVs and Power Off for a Fujitsu heat pump. To send either code, the command string TV_POWER or heatpump_off must be sent to the command channel for the device. For RF, the rf-command channel is used.
# openHAB >= 4.3.0
Since openHAB version 4.3.0, codes are stored stored in the $OPENHAB_USERDATA/jsondb directory. IR codes are stored in $OPENHAB_USERDATA/jsondb/broadlink_ir.json. For the RM Pro series of devices the RF codes are stored in $OPENHAB_USERDATA/jsondb/broadlink_rf.json
The advantage of this change is that the files are now backed up by openHAB, which is more practical for migrations, data robustness, etc. Having the storage of the codes handled by openHAB also provides uniformity with other openHAB configuration through Main UI.
With the change of the storage mechanism, the files are also changing format, and codes are now stored in json, like this:
{
"TV_POWER": {
"class": "java.lang.String",
"value": "26008c0092961039103a1039101510151014101510151039103a10391015101411141015101510141139101510141114101510151014103a10141139103911391037123a10391000060092961039103911391014111410151015101411391039103a101411141015101510141015103911141015101510141015101510391015103911391039103a1039103911000d05000000000000000000000000"
},
"heatpump_off": {
"class": "java.lang.String",
"value": "2600760069380D0C0D0C0D290D0C0D290D0C0D0C0D0C0D290D290D0C0D0C0D0C0D290D290D0C0D0C0D0C0D0C0D0C0D0C0D0C0D0C0D0C0D0C0D0C0D0C0D0C0D290D0C0D0C0D0C0D0C0D0C0D0C0D0C0D290D0C0D0C0D0C0D0C0D290D0C0D0C0D0C0D0C0D0C0D0C0D290D0C0D290D290D290D290D290D290E0002900000"
}
}
# Migrating from openHAB < 4.3.0 to > 4.3.0
Below is a Python script that can be used to convert from the old format to the new one:
import csv
import json
import sys
import argparse
parser=argparse.ArgumentParser(description= "Broadlink converter argument parser")
parser.add_argument('-i','--input_filename', help='Input File Name', required=True)
parser.add_argument('-o','--output_filename', help='Output File Name')
args=parser.parse_args()
result={}
with open(args.input_filename,'r') as f:
red=csv.reader(f, delimiter='=')
for d in red:
result[d[0]] = { "class": "java.lang.String" , "value":d[1]}
if args.output_filename:
with open(args.output_filename, 'w', encoding='utf-8') as f:
json.dump(result, f, ensure_ascii=False, indent=2)
else:
print(json.dumps(result,indent=2))