probonopd / irdb

One of the largest crowd-sourced, manufacturer-independent databases of infrared remote control codes on the web, and aspiring to become the most comprehensive and most accurate one
Other
889 stars 156 forks source link

Find compatible codes - Automatically cycle trough codes to find one(s) that are compatible? #37

Closed nodecentral closed 3 years ago

nodecentral commented 4 years ago

Is anyone aware of a way in which I could set off a process to cycle trough a loads of different IF codes to find any compatible on for my devices? ( I have lost the original remotes and non of the manufactures are listed ‘CYP Europe’ and ‘SY Electronics’ in your dB)

probonopd commented 4 years ago

What kinds of devices are those?

I am not aware of something like you suggest, but for example it would be possible to script something that sends the "Power" signal of each known codeset to the device.

This is similar to how some of the commercial universal remotes work - they send one key (e.g., "Power" - because most devices support it) from every codeset until one that works is found.

nodecentral commented 4 years ago

Hi @probonopd

Thanks for responding - those two are AV companies (http://www.cypeurope.com/ & https://www.sy.co.uk/) - Perhaps more UK\Europe based. I have a hdmi matrix and an av presentation switch

That’s exactly the sort of thing I was thinking - just having power on/off would be a blessing - but not being someone who can code - I’m wondering if this ‘feature’ might be something someone has already created or would be willing to work on (with me).

It would be awesome, once it’s found something that works, that it could then cycle trough another command, all the time filtering out manufacturers and models - ideally leaving you with a compatible IR code base/set (I would expect it’s not unlikely that many are just a rebadged product of something else)

bengtmartensson commented 4 years ago

Check out the TV B Gone project, even available as a commercial product. As soon as you have bound one signal that works, you can analyze that signal, and look for the rest, for example in this DB. Also most "standard" universal remotes from e.g. One4All have a similar function.

probonopd commented 4 years ago

Yes I was thinking of it @bengtmartensson but it's only for TVs, right?

nodecentral commented 4 years ago

Thanks, it does indeed look to focus on TVs, plus I was hoping for something a little less ‘off the shelf’ as I have a various pieces of kit at home already (Raspberry Pi, IR emitters, Android/iPhones etc.) that I was hoping to make use of..

Any other ideas/suggestions/ thoughts..

probonopd commented 4 years ago

Yes, I know how to do this but I don't have the time to do it. Write a script that fetches the power button code of all codesets from this database, and feed it into something that can send codes, e.g., an Arduino that gets fed by the computer with the codes to be sent. Make the script print which codeset it is sending, so that when your device switches on/off, you know which code caused it.

If @bengtmartensson finds this feature useful, then maybe it could even be added to IrScrutinizer? (Which is my absolute number one go-to tool for all things IR codes. A true "category killer".)

bengtmartensson commented 4 years ago

@probonopd: Thanx for those nice words! However, I do not have any short-time plans to implement a code-scanner in IrScrutinizer. (After all, the OP "just" wants codes for his equipment, and is not primarily interested in developing a new tool.)

In the long time run, I might implement an extension language (Jython, JavaScript,...) which would make it possible to to implement such things with a quite small amount of code in the extension language.

nodecentral commented 4 years ago

Thanks all for the comment and for potential future consideration,

in the interim is there a way to retrieve just the on and off commands from every device you have listed, into some sort of list/table ?

If so, I could try and rig something up and use one of my home automation IR senders to cycle through them and I can report back ?

nodecentral commented 4 years ago

I’ve tried a number of Ir senders over the years, currently I’m using a Broadlink device with my Vera home automation controller and a great plug-in for it from @a-lurker https://github.com/a-lurker/Vera-Plugin-BroadLink-Mk2.

Using the Vera software (Lua) and the above plug-in - I would need to retrieve the pronto codes etc. And somehow populate them into the format below and send them one by one, each time pausing briefly looking for a response, before automatically moving in to the next one...

-- Yamaha YSP off

luup.call_action('urn:a-lurker-com:serviceId:IrTransmitter1', 'SendProntoCode', {ProntoCode = '0000 006C 0022 0002 015B 00AD 0016 0016 0016 0016 0016 0016 0016 0041 0016 0041 0016 0041 0016 0041 0016 0016 0016 0041 0016 0041 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 05F7 015B 0057 0016 0E6C'},49) `
bengtmartensson commented 4 years ago

Assuming you have the irdb tree locally on $IRDB_BASE, this pseudo code should do it

for file in $IRDB_BASE/codes/*/*/*.csv:
    for line in $file:
       (cmd_name,protocol,D,S,F) = split $line ','
       if match('power', $cmd_name):
               echo "Trying signal $protocol $D $S $F" 
               pronto = $(irptransmogrifier render -p  -n D=$D,S=$D,F=$F $protocol)
               sendIr $pronto
               sleep $a_while
       endif
   endfor
endfor
nodecentral commented 4 years ago

Great, many thanks .

I can look to download the irdb tree and try this, although is that Java ?

Unfortunately my programming skills are very limited, I only really have a small ability when it comes to Lua.

By any chance are you aware of any online tools that could do a Java -> Lua the conversion ?

bengtmartensson commented 4 years ago

Just install IrpTransmogrifier as shell command and call it (as shell program) using (I think) os.execute or io.popen in Lua. No need to call java from lua.

nodecentral commented 4 years ago

Many thanks

Ok, using the Samsung TV .csv and finding the ‘POWER’ code as an example (extract below)

functionname    protocol    device  subdevice   function
INPUT SOURCE    NECx2   7   7   1
POWER   NECx2   7   7   2

Is the eventual goal of the code to generate a command line like this?

irptransmogrifier render -p -n D=7,S=7,F=2 NECx2

Side question.

Are there any other options available to avoid the command line approach, maybe a http request/api route that could use something similar within the url to pull the actual Pronto ‘Power’ IR code ?

0000 006d 0022 0003 00a9 00a8 0015 003f 0015 003f 0015 003f 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 003f 0015 003f 0015 003f 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 003f 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0040 0015 0015 0015 003f 0015 003f 0015 003f 0015 003f 0015 003f 0015 003f 0015 0702 00a9 00a8 0015 0015 0015 0e6e

bengtmartensson commented 4 years ago

Is the eventual goal of the code to generate a command line like this?

irptransmogrifier render -p -n D=7,S=7,F=2 NECx2

Yes. Make sure there are no spaces around the commas.

Are there any other options available to avoid the command line approach, maybe a http request/api route that could use something similar within the url to pull the actual Pronto ‘Power’ IR code ?

I am not sure if I understand your request, but you may like to access the IRDB API from your Lua program.

nodecentral commented 4 years ago

Hi,

Thanks again for all your help, I looked at the IRDB API, but I couldn’t find the url format to retrieve the full pronto ir code for a particular key e.g “POWER’ on any device.

Does the APi also require IrpTransmogrifier to be installed too to do the conversion ?

BTW - I posted a question on your IrpTransmogrifier repository about how to install/run IrpTransmogrifier- installing things on linux never seem straightforward/ logical to me..

I’m close to finalise my Lua code to extract content from the code folder and generate the following to call IrpTransmogrifier

irptransmogrifier render -p -n D=7,S=7,F=2 NECx2

probonopd commented 4 years ago

Does the APi also require IrpTransmogrifier to be installed too to do the conversion ?

Yes.

Since the website is calculating these on-the-fly which costs CPU, we are not offering them through the API but expect client-applications to render the codes themselves.

image

One could think about pre-rendering all codes on the server in a batch process, though, if there is demand for it. But then, tools like IrScrutinizer that use the codes have the rendering already built-in.

probonopd commented 3 years ago

Please use something like IrScrutinizer for this task.