Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the ability to 'hold' buttons in Macros #47

Merged
merged 7 commits into from
May 22, 2016

Conversation

apocolipse
Copy link
Contributor

Added in the ability to use repeater's in macro's. Certain remote functions, like powering off an Xbox One, require a button to be 'held' for a period of time, along with other commands.

Macro function modified to check to see if COMMAND is an array type, if so it treats its elements as COMMAND, and DELAY, and issues a send_start and send_stop accordingly.

In the future, this logic should probably be cleaned up to use objects for better semantics and type safety.

@alexbain alexbain merged commit 06646ed into alexbain:master May 22, 2016
@alexbain
Copy link
Owner

Thank you!

@apocolipse
Copy link
Contributor Author

@alexbain Oh no thank /you/ for the project! :) It's proven invaluable to me.
As a side note if you're interested I've made 2 alternate versions of the IR hat, 1 using the Perma-proto HAT for Pi from adafruit, which is a little bit more low profile than the one you have on your blog, and another thats even more minimalist , soldering components on a GPIO header (requires different pins though).
Additionally I've tied this project together with Homebridge which I'm running on the same Pi to give Siri control over things using the homebridge HTTP plugin (Create "devices" from Macros to do things like "Turn on/off my Xbox", "Turn on HBO", etc).
If you're interested I can do a writeup for you to cross-post on your blog :)

@alexbain
Copy link
Owner

Awesome - I'm glad this project has proven useful for you.

I'd definitely be interested in seeing what you put together for the hardware. I still need to blog about a PCB + schematic that was mailed to me.

Lastly - I would be very interested in the Homebridge integration. I'd certainly be down to cross post that. Some Siri integration would be a great touch.

@alexbain
Copy link
Owner

@apocolipse I setup Homebridge over the weekend. Any chance you could share that integration work you did with lirc_web / lirc_node? Would love to check it out.

@apocolipse
Copy link
Contributor Author

apocolipse commented May 23, 2016

Ahh yes, I'll do a more thorough writeup but the gist of it is to use homebridge-http to configure accessories and use the lirc_web api. You're limited in control in homebridge to turning things on, turning things off, checking status, and changing brightness. For the context of lirc_web, that pretty much means turning things on and off for now.
Sample snippet from my config.json

  "accessories": [
    {
      "name": "XBox",
      "on_url": "http://radius.local/remotes/XBOX-ONE/XboxFancyButton",
      "off_url": "http://radius.local/macros/Xbox-Off",
      "http_method": "POST",
      "service": "Switch", "accessory": "Http",
      "brightness_url": "", "username": "", "password": "", "sendimmediately": "", "brightnessHandling": "no"
    },
    {
      "name": "TV",
      "on_url":  "http://radius.local/remotes/Livingroom_TV/power",
      "off_url": "http://radius.local/remotes/Livingroom_TV/power",
      "http_method": "POST",
      "service": "Switch", "accessory": "Http",
      "on_body": "", "off_body": "", "brightness_url": "", "username": "", "password": "", "sendimmediately": "", "brightnessHandling": "no"
    },
    {
      "name": "HBO",
      "on_url":  "http://radius.local/macros/HBO",
      "off_url": "http://radius.local/macros/HBO",
      "http_method": "POST",
      "service": "Switch", "accessory": "Http",
      "on_body": "", "off_body": "", "brightness_url": "", "username": "", "password": "", "sendimmediately": "", "brightnessHandling": "no"
  }
]

Note: I had to use the fully resolved hostname, localhost had some weird issues for whatever reason.
One hack to note here is that I basically created macro's in lirc_web for my cable box to change to specific channels (HBO), such that HBO shows up as a HomeKit device and I can issue a "Hey Siri, Turn on HBO" (Note there is no real "off"), Siri humorously responds "Ok, I've turned on the HBO".

You can then take it a step further and use HomeKit management apps (there are many, some paid) to set up Scenes (Currently limited to "Good Morning", "Good Night", "I'm Home", and "I'm Leaving") to turn things on/off appropriately, for example I like watching the news in the evening so I have my "I'm Home" scene set to turn on my lights (Hue lights, not through lirc_web), Turn on my XBox, turn on TV, Set HDMI inputs accordingly (in case I was gaming previously), and change the channel to the news.

@SLiX69
Copy link

SLiX69 commented May 23, 2016

Hi, just ran into the same problem, when I tried to power off my Xbox One.
I guess, you irrecorded your xbox one remote or just found the data in the web (as I did)

I thought, there have to be more commands than that. And there are:
As I own a Logitech harmony, I added the Xbox One as a new device and checked the commands

To my surprise, there is a command to directly turn off XBO.
All in all there are following commands concerning power: 'PowerOn', 'PowerOff', 'PowerToggle' and 'Standby'. Standby and Toggle seem to be the same

So I don't know, if you still need the command(s). If you want to, I could share the raw codes here with you
Thank you anyway for the PR. Really missed that feature! And btw thanks to alexbain for creating this awesome project!

@apocolipse
Copy link
Contributor Author

apocolipse commented May 24, 2016

@SLiX69 ah good catch, I have a harmony remote as well but still have it setup with Xbox360 which doesn't have a power-off function. I'll have to load XboxOne and check out the codes. I also wrote this for other edge-case scenarios as well, I had a bad 4x2 HDMI Matrix that wouldn't deliver audio to Out-B unless inputs were cycled back and forth with a specific timing, 2 reasons combined compelled me to add this feature ;)

@alexbain
Copy link
Owner

alexbain commented Jun 5, 2016

@apocolipse - just got homebridge working with lirc_web this morning. Thanks for the tips and config samples! This is an awesome enhancement. Are you still interested in writing a blog post introducing this? If not - no worries - I'll likely write one myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants