Learning new commands saves them to a text file — in a hidden directory, named by MAC address — on the filesystem, so if you can’t remember exactly what the command name and device name you used when you learned them (and the MAC address), it becomes complicated and maddening to try to call the send_command
action.
While I know it is possible to create button template helpers now, it would be much more user-friendly if the integration added the buttons automatically when they are learned, e.g. with a name like devicename-command
, which would have the following benefits:
- user-friendly way to use learned commands if you just want to send a basic command without extra parameters (the
send_command
action would still be available if you need the hold or repeat features) - feedback to the user that the “learn command” action completed successfully if the button appears
- easy reference/reminder of device name and command that are saved in the file without having to find and view the file
- avoids the ugly ambiguous list of
{ } Template
links on the left of the screenshot below when multiple template buttons are manually defined (which one goes with which?).
For example, given a config file with the following four commands:
peter@felix:/opt/homeassistant/config$ cat .storage/broadlink_remote_e8165606bbcc_codes
{
"key": "broadlink_remote_e8165606bbcc_codes",
"data": {
"yamahareceiver": {
"poweron": "JgBYAAABGpURExI2EhISNxI2EjcSNhISEzYSEhI2ExIRExISExETNhI2EhMRNxI3ETcSEhITERMRExI3ERMRExISEjcRNxI3EQAE+gABGkcRAAwEAAEZRxMADQU=",
"poweroff": "JgBQAAABGZYRExE3EhMQOBE4ETcRNxISEjYTEhI2EhITERMSEhISNhMSEjYSNxI2EzYSEhISExETNhISEhITEhISEjYSNxE3EgAE+gABGkcSAA0F",
"volumeup": "JgBQAAABGpUSEhI3ERMSNxE3EjcRNxISEjYSExI2EhISEhMRExISNhISEzYSEhI3EjYSEhMRExISNhMREzYSEhMREzYSNhI3EQAE+wABGkcRAA0F",
"volumedown": "JgBQAAABGpURExE3EhMRNxE4ETcRNxITETcSEhI2EhITERMSEhISNhM2EjYTEhI2EzYSEhISEhITERMSEjYTEhISEjYTNhI2EgAE+gABGkcRAA0F"
}
}
}
I have manually defined four template buttons which could have been created automatically: