Closed joemarshalljm closed 7 years ago
This is defined as a switch. As such it musts have "on" and "off" commands so this adjustment can't work without other changes, and not with Alexa even then. I may have ideas but it depends if you are trying to use Alexa or some other smartthings integration. Unfortunately, using this with Alexa, you are limited to switches, so your best bet is a little awkward - you would use the code as published and say something like "turn on play" or "turn on pause" (or whatever suits you, but must start with turn on or turn off). This is how mine works.
Here are some thoughts, and I fear I'm about to reveal a lot of my private hobbled together projects so people can start asking for the ones they want me to write up and publish to github. I may have to video demo my setup someday as Alexa can do a lot around my place. My friends all think they want to buy one until I tell them how much it doesn't do out of the box :)
If you don't want to use Alexa, you may be able to play with other device types, but you would have to do some research to sort that or maybe someone else here can chime in if they've done it. In that case you would need to find or create a device type that responds to a capability called "play." (switches have pre-defined capabilities for on and off, and I also have a device I made for myself that uses a dimmer switch with a level capability to control volume and power on WMC). If some sort of smartthings device you find can respond to "play" you could adjust its code to include the Broadlink and this might work, but again not with Alexa at this time. To make it work with Alexa you'd have to write a custom skill, but then would have to say something like "ask my android to play" which is not much better than "turn on play."
Google Home may open up whole other worlds but I have not played with one yet. Someone else who has one may also be able to chime in with anything it can do differently. (if it's good enough, maybe I'll get one).
Another thing I've done on my windows media center and on an android box, if you're a little mroe advanced and ready to roll up your sleeves a bit, might work here. I set up Tasker with a plugin that lets you trigger events using http. Then I wrote an Alexa skill that would trigger it. I can say "start Netflix" for now but have ehad inconsistent results with playing and pausing it. If you are writing a skill not for publication, you don't need to follow all of Amazon's rules about Oauth Authorization, etc and can just write code (node.js or python have the best examples available) to directly trigger something on your network, so long as it is externally accessible. I may post instructions for this one soon as I'm not sure people realize this is possible or how to do it. You can also start Alexa skills by saying "start" + its name, which can be used creatively. In addition to "start Netflix" on the Android box, I already had a setup to control my HTPC via http commands, so I wrote a skill and made its name "listening." So, the conversation goes like "Alexa, start listening" "OK, I'm listening." "guide, page down, up, select." (I can quit or it times out pretty soon after). You could do something similar with "start playing" but pause is still awkward unless you ponder it some more.
Hope this helps.
thanks for the reply That a shame, I wanted to be able to say 'turn Shield volume up' but you're saying I'll need to say 'turn shield volume up on' ?
Actually, volume up is tricky. It used to work fine, but then Amazon "improved" Alexa's speech recognition, so whenever you talk about volume, it makes Alexa's volume louder. I would recommend fewer words in your command, and there are also workarounds like turn on louder/softer. I still use this with my Android because because I don't often use it and default to controlling the TV or computer volume instead (just due to choices in my setup).
If you can find any program or script that is accessible via http (maybe a tasker thing as I described earlier?) and can get it working to set the device's volume to a specific numeric level, let me know. If you have that I can show you how to define the device as a dimmer in smartthings. Then instead of just on and off, you can use Alexa directly to turn the device on, off, up (I usually say increase the television, because it can mistake up for off), down, or set it to [numeric level in %]. I do this already on my windows media center but it should work jsut as well on any device once you get something on it for smartthings to send the commands to.
You can use IFTTT to access the RM Bridge Shortcut URL with a channel called Maker. Maybe you can trigger that a number of times. At the moment I have it so I can say 'Trigger volume up' or 'trigger volume down'
Yeah i have done that too, but have found IFTTT to sometimes lag too much for immediate needs like media control. It's a great service but can vary in speed like that. If you can get it working well, that is indeed the easiest way. Thanks for adding that option to the conversation.
On Jan 7, 2017 3:23 PM, joemarshalljm notifications@github.com wrote:You can use IFTTT to access the RM Bridge Shortcut URL with a channel called Maker. Maybe you can trigger that a number of times. At the moment I have it so I can say 'Trigger volume up' or 'trigger volume down'
—You are receiving this because you modified the open/close state.Reply to this email directly, view it on GitHub, or mute the thread.
I want to play/pause my Android TV rather than turn 'on' or 'off'
I changed 'on' to play in the code and its not working. What do I need to change?
What I have now:
metadata { definition (name: "RM Bridge Pause Cloud", namespace: "smartthings", author: "BeckyR") { capability "Switch" }
}
def play() { put('play')
}
def pause() { put('pause') }
private put(toggle) { def toReplace = device.name def replaced = toReplace.replaceAll(' ', '%20') def params = [ uri: "http://xxxxxxx.xxxxxxxxxxxxxxxx:7474/code/$replaced%20$toggle" ] httpGet(params) }