radinsky / broadlink-http-rest

Broadlink RM/RM2/RM Pro/RM3/BlackBean/A1 Web server with REST API (like..)
MIT License
156 stars 47 forks source link

Send TV Channel Number #28

Closed thunder2k closed 5 years ago

thunder2k commented 5 years ago

Hi, I have a telly configured with my RM Pro. How can I send commands through this API to send channel numbers without actually learning all possible numbers (I have 500+ channels)? I have another script that translates the Channel Name I say to my Google Home into its number

What I thought was to learn 10 separate commands, calling them 1, 2, ....0 with the corresponding number pressed on the remote.

Then, when the script executes and translates my channel name to channel number, let's say 56, it could call the sendCommand/5 and then the sendCommand/6.

Is this the only way to do it or am I missing something obvious?

Thanks!!

radinsky commented 5 years ago

Hi,

I think setting 10 commands (0,1 .. 9) and having a script that will split channel number to separate digits is much easier than learning/programing another 500 channel, so I would go with this approach.

You can use a macro command as described here: https://github.com/radinsky/broadlink-http-rest/issues/20

thunder2k commented 5 years ago

Hi, Thanks for your reply. Yeah, the 500 channel setting was a joke :) I went for splitting numbers in single commands and it's working great. Just make sure to add a wait() after each call to make sure there's no overlapping/wrong number order. Example:

cmd = "curl http://localhost:8082/sendCommand/"+str(number) proc = subprocess.Popen(cmd, shell=True) proc.wait()

What would be the advantage of the macro over calling the single command?

radinsky commented 5 years ago

Single command is single command as it :) For example, you can turn on your tv with a single command. Macro can be used as a scene, for example, to send a command to turn on tv, then wait and then switch it to some channel.

thunder2k commented 5 years ago

Ok, so I think it's not useful for me in my scenario since the Macro should be a predefined set of actions, while the channel number is dynamically defined at runtime