Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Smarthings Hub not linking to Alexa correctly #37

Open
tyme2craft opened this issue Jan 3, 2018 · 1 comment
Open

Smarthings Hub not linking to Alexa correctly #37

tyme2craft opened this issue Jan 3, 2018 · 1 comment

Comments

@tyme2craft
Copy link

Hello!
This was an amazing guide, and taught me a bunch of new skills that I have never tried before! Naturally, I ran into a few problems along the way and at this point I am stumped. I have browsed so many forms for this topic and have tried all of the solutions mentioned but still cannot seem to get it to work. For whatever reason, I cannot get the Smarthings hub to connect to my Alexa with the new skill. After updating my firmware on my new Broadlink rm pro, I was able to access the bridge and create some codes that worked when I tested them. I followed the guide and created the device handler and changed the information for the ip address (local because I am using the physical hub instead of the cloud) and the security. I went over to devices, entered the name of the device exactly as it appeared on the code (excluding the on/off words), entered in a custom device network id, found the RM Bridge Switch LAN option for the type, and linked the location and hub to my physical hub. It added successfully and was discovered by Alexa, but when I said the command ("Projector on"), she responded with "ok," but nothing actually happened. I must be missing something in the code or device information on the smarthings page, but I cannot figure out where I went wrong. Here's some (probably unnecessary) information:
I have the Broadlink rm Pro with s/n starting with RM09.
It currently has firmware v20028 (I updated it manually to work with the Bridge app)
I am using the RM Bridge version 1.3.1
The codes work perfectly on the RM Bridge website
I copied and pasted the code that was in the guide into the device handlers (changing the necessary values, of course)
My Smarthings hub works correctly with my other smart devices in my home (ie Ring Doorbell)
I enabled the Alexa skill in the app and the device showed up.
I wasn't quite sure what to put for the device network id and somewhere it said that the name should be unique but it doesn't matter what you enter for it.
(I also tried getting Alexa to control my Broadlink through the RM Plugin, but Alexa did not discover the devices that were saved in my app...)
There wasn't really any error logs that I could have included in this forum.
Sorry if this topic has been addressed recently. I tried my best to find solutions on my own, and i am using this as a last resort.
Thank you so much!

@tyme2craft
Copy link
Author

Just for kicks, I included the code that I pasted in the device handlers section. (Note that the x's are replaced with the ip address)

/**

  • Broadlink Switch
  • Copyright 2016 BeckyR
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at:
  •  http://www.apache.org/licenses/LICENSE-2.0
    
  • Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
  • on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
  • for the specific language governing permissions and limitations under the License.
  • 1/7/17 - updated with better switch displays and use of device ID from user itsamti
    */

// 09/01/2016 - itsamti - Added new switch definition below
metadata {

definition (name: "RM Bridge Switch LAN", namespace: "beckyricha", author: "BeckyR") {
	capability "Switch"
	command "onPhysical"
	command "offPhysical"
}

tiles {
	standardTile("switch", "device.switch", width: 2, height: 2, canChangeIcon: true) {
		state "off", label: '${currentValue}', action: "switch.on", icon: "st.switches.switch.off", backgroundColor: "#ffffff"
		state "on", label: '${currentValue}', action: "switch.off", icon: "st.switches.switch.on", backgroundColor: "#79b821"
	}
	standardTile("on", "device.switch", decoration: "flat") {
		state "default", label: 'On', action: "onPhysical", backgroundColor: "#ffffff"
	}
	standardTile("off", "device.switch", decoration: "flat") {
		state "default", label: 'Off', action: "offPhysical", backgroundColor: "#ffffff"
	}
    main "switch"
	details(["switch","on","off"])
}

}

def parse(String description) {
def pair = description.split(":")
createEvent(name: pair[0].trim(), value: pair[1].trim())
}

def on() {
sendEvent(name: "switch", value: "on")
put('on')
}

def off() {
sendEvent(name: "switch", value: "off")
put('off')
}

def onPhysical() {
sendEvent(name: "switch", value: "on", type: "physical")
put('on')
}

def offPhysical() {
sendEvent(name: "switch", value: "off", type: "physical")
put('off')
}

private put(toggle) {
def url1="192.168.x.x:7474"
def userpassascii= "admin:bridge"
def userpass = "Basic " + userpassascii.encodeAsBase64().toString()
def toReplace = device.deviceNetworkId
def replaced = toReplace.replaceAll(' ', '%20')
def hubaction = new physicalgraph.device.HubAction(
method: "GET",
path: "/code/$replaced%20$toggle",
headers: [HOST: "${url1}", AUTHORIZATION: "${userpass}"],
)
return hubaction
}

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

No branches or pull requests

1 participant