How to control Home Assistant via smartthings hub?


I set up a Home Assistant with my Rpi.
I want to control the deivces of HA with my ST hub.
I read the RESTful API of HA( and I can control them with Tasker and IFTTT with http post.
I made a DTH like the below. But it doesn’t work.
(I think it has a problem with authentication)

Cold you advise me about my DTH?

metadata {
definition (name: “broadlinkhomeassistant”, namespace: “smartthings”, author: “af950833”) {
capability "Switch"
attribute “EntityID”,"string"
command “changedata”

// tile definitions
tiles {
	standardTile("switch", "device.switch", width: 2, height: 2, canChangeIcon: true) {
		state "on", label: '${name}', action: "", icon: "st.Home.home30", backgroundColor: "#79b821"
		state "off", label: '${name}', action: "switch.on", icon: "st.Home.home30", backgroundColor: "#ffffff"

	main "switch"
	details "switch"


def on() {

def off() {

def changedata(att,newstate){
sendEvent(name:"${att}",value: “${newstate}”)

private put(toggle) {
def params = [
uri: “${toggle}?api_password=my_password”,
body: [“entity_id” : “switch.${EntityID}”]

try {
httpPostJson(params) { resp ->
resp.headers.each {
log.debug “${} : ${it.value}”
log.debug “response contentType: ${resp. contentType}”
} catch (e) {
log.debug “something went wrong: $e”