beckyricha / Broadlink-RM-SmartThings-Alexa

Control RF and Ir devices using SmartThings and Alexa.
151 stars 115 forks source link

Bridge not talking to SmartThings (with Alexa & RMPro) #26

Open spezzer opened 7 years ago

spezzer commented 7 years ago

Hi - I've gone down the RMPro / RM Bridge / SmartThings / Alexa route but can't seem to get everything working together. The gap seems to be between SmartThings and RM Bridge and sure I've probably missed a step. I've successfully added TV to devices on SmartThings and Alexa recognises my simple addition 'TV'. I've successfully added the TV on & off codes to RM Bridge. What I'm not fully able to figure is how SmartThings communicates with RMPro - this is the bit I think is not working and struggling to figure why. If i say 'TV ON' Alexa responds 'Okay' so that side is 'working'. One thing I noticed is that TV doesn't appear in eControl - shouldnt it pick this up having added to RM Bridge? I think once I overcome this hurdle then the logic will fall together and hopefully have a 'ah-ha' moment. Thanks! (Previously asked on ST with no response)

beckyricha commented 7 years ago

No the tv should not appear in eControl. The bridge app stores the devices and remote control codes, communicating directly with the RM Pro.  The eControl app is a different means of doing the same thing, and it doesn't see the rm bridge stored info. That said, a few questions may help: 1) based on your other comment, are using the cloud version of the device handler? If you have no hub, you must use this version, and also use an externally accessible ip address. 2) have you tried the simulator feature in the smart things ide (the web site where you set up the device handler)? That is done on the page where you see the device handler code. You can choose a device to test from that page, and there is a log of what happens. If you have not already, please try that and check for any errors. I will also try it to make sure smart things had not changed anything since i last used it. 3) you said you successfully set it up with the rm bridge.  Just to be sure, did that include testing the on/off functions from the web, using your external ip address (unless using a hub), and ensuring that it worked? If that doesn't work, is your router port forwarded to the Android device? Please let me know if any of this helps, and if not i can keep thinking. Becky

On Mar 22, 2017 2:39 PM, spezzer notifications@github.com wrote:Hi - I've gone down the RMPro / RM Bridge / SmartThings / Alexa route but can't seem to get everything working together. The gap seems to be between SmartThings and RM Bridge and sure I've probably missed a step. I've successfully added TV to devices on SmartThings and Alexa recognises my simple addition 'TV'. I've successfully added the TV on & off codes to RM Bridge. What I'm not fully able to figure is how SmartThings communicates with RMPro - this is the bit I think is not working and struggling to figure why. If i say 'TV ON' Alexa responds 'Okay' so that side is 'working'. One thing I noticed is that TV doesn't appear in eControl - shouldnt it pick this up having added to RM Bridge? I think once I overcome this hurdle then the logic will fall together and hopefully have a 'ah-ha' moment. Thanks! (Previously asked on ST with no response)

—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or mute the thread.

spezzer commented 7 years ago

Hi - thanks for quick response. 1) Yes, using cloud version at graph.api.smartthings.com * 2) No, but just tried the simulator, and not getting a response. I selected 'TV' in preferences and clicked the On|Off options. Unfortunately the log is not providing any feedback with nothing printed. Is there an option to enable this or is it there are simply no errors to report. 3) Yes, it tests successfully from http://rm-bridge.fun2code.de

Also - should the simulator actually switch devices on|off or is it literally just a dry run?

Thanks again

beckyricha commented 7 years ago

Weird. I want to try my version at home but not sure how soon i can do that. On Mar 22, 2017 6:58 PM, spezzer notifications@github.com wrote:Hi - thanks for quick response. Yes, using cloud version at graph.api.smartthings.com.No, but just tried the simulator, and not getting a response. I selected 'TV' in preferences and clicked the On|Off options. Unfortunately the log is not providing any feedback with nothing printed. Is there an option to enable this or is it there are simply no errors to report.Yes, it tests successfully from http://rm-bridge.fun2code.de Thanks again

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread.

beckyricha commented 7 years ago

Yes. You need to use the externally accessible ip address you would find on where my IP, and you also need to forward port 7474 on your router to that 192... address.  Then I recommend retracing your previous troubleshooting steps, including the one for rm bridge control from a browser, using that external address. Make sure that's also what you put into the device handler code. Once you get it working using the address you find with what's my IP, i would also recommend getting a dynamic dns address (you can internet search for free providers and setup instructions) and then setting this back up with that new permanent address. Otherwise you will almost certainly need to change the code every once in a while when that IP address changes (or so it is with most major Internet service providers). Please let me know if that solves it. On Mar 22, 2017 7:09 PM, spezzer notifications@github.com wrote:Just a though - I'm using 192.168.0.18:7474 at graph.api.smartthings.com - should I be using an internet IP instead IE from WhatsMyIP? However, I tried it and didnt make an difference. Richard

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread.

spezzer commented 7 years ago

Hi - Port Forwarding is working. I've tested this by logging into RM Bridge online on my phone and disconnected phone wifi. It successfully switched TV on|off using external IP and port 7474.

I had a look round SmartThings API Hub and found the live logger. It generates a log when talking to Alexa so that connection is working. Not exactly sure what to make of the log - hope you can shed some light on the content (below)

The bit I'm struggling to understand is how SmartThings API talks to the RM Bridge on my Android. Is there something I can test on the Android? FYI It's an Samsung Tab3 running Android 4.4.2

Regards Richard

control, params: [appId:60001429-8f74-4c28-b80f-925ea2f9c2ab, param1:control, param2:3a46217f-37d5-41ec-8b0a-e5cde13cba76, param3:TurnOffRequest, action:[GET:executeSmartAppGet, POST:executeSmartAppPost, PUT:executeSmartAppPut, DELETE:executeSmartAppDelete, OPTIONS:executeSmartAppOptions], controller:smartAppApi, id:3a46217f-37d5-41ec-8b0a-e5cde13cba76, command:TurnOffRequest], request: [:], devices: null params.id: 3a46217f-37d5-41ec-8b0a-e5cde13cba76 params.command: TurnOffRequest params.value: null

beckyricha commented 7 years ago

Thanks for posting the log.  I don't get anything obvious from it, but this feels like something in the device naming conventions.  You said, I think, that your device is called TV.  In that case, make sure your rm bridge codes are named TV on and TV off. (One user had used underscores instead of spaces and it took a while to debug without me being able to see it).  If that is set, then make sure your device id is TV (case is sensitive to match your bridge device I think). Actually, as i have not used this code version in a while and can't access it easily from here, you may wish to double check the code for what i just said, to see if it is using device network ID or device name. An earlier version used device name but I think all versions are now updated. If it's not obvious where to look for that I will check it later.   Also make sure the TV device shows the right device type. I once accidentally selected the wrong device type in the drop down menu and had some issues before I caught it. If all that is good, the log that is most helpful is the one on the device handler code page.  To the right of the code is a simulator where you can install the code to a specific device, send on and off commands, and watch the log to see what, if anything, happens. Ideally, ST should control your device or throw some error. Lastly, does Alexa just say ok or feed back that something is wrong? On Mar 23, 2017 6:20 PM, spezzer notifications@github.com wrote:Hi - Port Forwarding is working. I've tested this by logging into RM Bridge online on my phone and disconnected phone wifi. It successfully switched TV on|off using external IP and port 7474. I had a look round SmartThings API Hub and found the live logger. It generates a log when talking to Alexa so that connection is working. Not exactly sure what to make of the log - hope you can shed some light on the content (below) Regards Richard control, params: [appId:60001429-8f74-4c28-b80f-925ea2f9c2ab, param1:control, param2:3a46217f-37d5-41ec-8b0a-e5cde13cba76, param3:TurnOffRequest, action:[GET:executeSmartAppGet, POST:executeSmartAppPost, PUT:executeSmartAppPut, DELETE:executeSmartAppDelete, OPTIONS:executeSmartAppOptions], controller:smartAppApi, id:3a46217f-37d5-41ec-8b0a-e5cde13cba76, command:TurnOffRequest], request: [:], devices: null params.id: 3a46217f-37d5-41ec-8b0a-e5cde13cba76 params.command: TurnOffRequest params.value: null

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread.

spezzer commented 7 years ago

Hi - checked the names. ST Device Name/Label/NetworkID all = 'TV' - I think code uses device.deviceNetworkId (I tried device.NetworkId but that generated error log which is reassuring - and changed it back - although it still controlled simulator okay which means I still don't fully understand code!) RM Bridge Codes are 'TV on' & 'TV off' The SmartThings app on the Android Tablet reflects what the simulator is doing so definitely talking to my LAN - which is also good. The bit (more!) I don't understand is how RM Bridge picks up the incoming command or even what format it takes - it must be as simple as 'TV on' or 'TV off' as this is what follows the URL? Presumably the RM Bridge running on the Android sends this to the MAC address of the RMPro. I think it's this link that is failing. Even the local SmartThings app on the Android has no affect. Can RM Bridge run on Android 4.4.1? Sorry lots of questions again - thanks in advance. Regards Richard

beckyricha commented 7 years ago

I think you said the rm bridge app was working when used outside of smart things, correct? So if you go to a browser and type in http://{your IP address}:7474/code/TV%20on that works? And you did switch the ip address in the device handler to the external address? Final thing i forgot to ask was are you using security on the bridge app? Earlier i had to make a code change for someone else on this but need to take another look and see if it is here. If you are using security, it should work but if not you may need to either: 1) add a password to the rm bridge (easiest) or 2) delete the username and password references from the code (still not too hard and you get to play more with the code :). I can also take a look at the code and help with that in a little while. On Mar 23, 2017 8:19 PM, spezzer notifications@github.com wrote:Hi - checked the names. ST Device Name/Label/NetworkID all = 'TV' - I think code uses device.deviceNetworkId (I tried device.NetworkId but that generated error log which is reassuring - and changed it back - although it still controlled simulator okay which means I still don't fully understand code!) RM Bridge Codes are 'TV on' & 'TV off' The SmartThings app on the Android Tablet reflects what the simulator is doing so definitely talking to my LAN - which is also good. The bit (more!) I don't understand is how RM Bridge picks up the incoming command or even what format it takes - it must be as simple as 'TV on' or 'TV off' as this is what follows the URL? Presumably the RM Bridge running on the Android sends this to the MAC address of the RMPro. I think it's this link that is failing. Even the local SmartThings app on the Android has no affect. Can RM Bridge run on Android 4.4.1? Sorry lots of questions again - thanks in advance. Regards Richard

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread.

spezzer commented 7 years ago

Hi - yes RM Bridge works externally using external IP. I have password set at the moment. Tried the URL and got the admin login - entered credentials and RMPro worked TV. I've set the user/password in code. I can try without login as well. But not now, its 1am now! Regards

On 24 Mar 2017 12:39 a.m., "Becky Onuschak" notifications@github.com wrote:

I think you said the rm bridge app was working when used outside of smart things, correct? So if you go to a browser and type in http://{your IP address}:7474/code/TV%20on that works? And you did switch the ip address in the device handler to the external address? Final thing i forgot to ask was are you using security on the bridge app? Earlier i had to make a code change for someone else on this but need to take another look and see if it is here. If you are using security, it should work but if not you may need to either: 1) add a password to the rm bridge (easiest) or 2) delete the username and password references from the code (still not too hard and you get to play more with the code :). I can also take a look at the code and help with that in a little while. On Mar 23, 2017 8:19 PM, spezzer notifications@github.com wrote:Hi - checked the names. ST Device Name/Label/NetworkID all = 'TV' - I think code uses device.deviceNetworkId (I tried device.NetworkId but that generated error log which is reassuring

  • and changed it back - although it still controlled simulator okay which means I still don't fully understand code!) RM Bridge Codes are 'TV on' & 'TV off' The SmartThings app on the Android Tablet reflects what the simulator is doing so definitely talking to my LAN - which is also good. The bit (more!) I don't understand is how RM Bridge picks up the incoming command or even what format it takes - it must be as simple as 'TV on' or 'TV off' as this is what follows the URL? Presumably the RM Bridge running on the Android sends this to the MAC address of the RMPro. I think it's this link that is failing. Even the local SmartThings app on the Android has no affect. Can RM Bridge run on Android 4.4.1? Sorry lots of questions again - thanks in advance. Regards Richard

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/beckyricha/Broadlink-RM-SmartThings-Alexa/issues/26#issuecomment-288901519, or mute the thread https://github.com/notifications/unsubscribe-auth/AZX_vcJEA4aCGTRt3gxwVm4-mlZJ3jFqks5roxDdgaJpZM4MlpxY .

spezzer commented 7 years ago

Focussing on the login I commented it out :- /def userpass = "Basic " + userpassascii.encodeAsBase64().toString()/ I would have expected this simulator to generate a login error but it doesn't generate any log entries at all.

One question - what directs the command to RM Bridge - is the 7474 port number?

I know it is reaching my LAN because the SmartThings App on the Android syncs with the simulator. I dont quite understand what directs the command to RM Bridge and this is where it seems to be failing.

regards

beckyricha commented 7 years ago

Yes. The ip address and port, plus the command string, should add up to exactly the same thing you would type into a browser. As long as you are using your externally accessible ip and the 7474 port, that goes to the bridge. That's why the port forwarding on your router was important. On Mar 25, 2017 10:00 AM, spezzer notifications@github.com wrote:Focussing on the login I commented it out :- /def userpass = "Basic " + userpassascii.encodeAsBase64().toString()/ I would have expected this simulator to generate a login error but it doesn't generate any log entries at all. One question - what directs the command to RM Bridge - is the 7474 port number? I know it is reaching my LAN because the SmartThings App on the Android syncs with the simulator. I dont quite understand what directs the command to RM Bridge and this is where it seems to be failing. regards

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread.

spezzer commented 7 years ago

Hi - really scratching my head with this one - I got a reply from itsamti on SmartThings forum - maybe they can offer something :-/

On 26 March 2017 at 02:23, Becky Onuschak notifications@github.com wrote:

Yes. The ip address and port, plus the command string, should add up to exactly the same thing you would type into a browser. As long as you are using your externally accessible ip and the 7474 port, that goes to the bridge. That's why the port forwarding on your router was important. On Mar 25, 2017 10:00 AM, spezzer notifications@github.com wrote:Focussing on the login I commented it out :- /def userpass = "Basic " + userpassascii.encodeAsBase64().toString()/ I would have expected this simulator to generate a login error but it doesn't generate any log entries at all. One question - what directs the command to RM Bridge - is the 7474 port number? I know it is reaching my LAN because the SmartThings App on the Android syncs with the simulator. I dont quite understand what directs the command to RM Bridge and this is where it seems to be failing. regards

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/beckyricha/Broadlink-RM-SmartThings-Alexa/issues/26#issuecomment-289251274, or mute the thread https://github.com/notifications/unsubscribe-auth/AZX_vbR2ulXlWBr2rneGkmuLRYSBKxVoks5rpb36gaJpZM4MlpxY .

spezzer commented 7 years ago

AHHHHHH! - using wrong device handler - should have been using Broadlink-RM-SmartThings-Alexa/RM Bridge Switch Cloud

DOH!

I'm now in business - thanks for you help

beckyricha commented 7 years ago

Sorry you are having so much trouble with this. If you solve it, please do report back and let us all know what it was. On Mar 28, 2017 2:30 PM, spezzer notifications@github.com wrote:Hi - really scratching my head with this one - I got a reply from itsamti on SmartThings forum - maybe they can offer something :-/

On 26 March 2017 at 02:23, Becky Onuschak notifications@github.com wrote:

Yes. The ip address and port, plus the command string, should add up to exactly the same thing you would type into a browser. As long as you are using your externally accessible ip and the 7474 port, that goes to the bridge. That's why the port forwarding on your router was important. On Mar 25, 2017 10:00 AM, spezzer notifications@github.com wrote:Focussing on the login I commented it out :- /def userpass = "Basic " + userpassascii.encodeAsBase64().toString()/ I would have expected this simulator to generate a login error but it doesn't generate any log entries at all. One question - what directs the command to RM Bridge - is the 7474 port number? I know it is reaching my LAN because the SmartThings App on the Android syncs with the simulator. I dont quite understand what directs the command to RM Bridge and this is where it seems to be failing. regards

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/beckyricha/Broadlink-RM-SmartThings-Alexa/issues/26#issuecomment-289251274, or mute the thread https://github.com/notifications/unsubscribe-auth/AZX_vbR2ulXlWBr2rneGkmuLRYSBKxVoks5rpb36gaJpZM4MlpxY .

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread.

spezzer commented 7 years ago

Hi - very embarrassing - I was using the wrong device handler! I was using LAN instead of Cloud version. Everything is working now and having great fun adding TV functionality.

One question - 'TV on|off' and 'TV Guide on|off' work well. Any suggestions for up|down or PgUp|PgDn? The voice command 'Turn up on' doesn't really track very well. Should I be using a different controller?

Regards Richard