How to control Home Assistant via smartthings hub?

HI,

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(https://home-assistant.io/developers/rest_api/) 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: "switch.off", 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() {
put(“on”)
}

def off() {
put(“off”)
}

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

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

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