I'm having a very weird issue when creating a driver for my 3d printer
I need to send a basic post command, at the moment just triggered from a button on the driver, e.g. "http://192.168.25.206/printer/gcode/script?script=FIRMWARE_RESTART"
Following that I want to call another command to get an updated status, am I hitting a restriction in Hubitat or am I tired and missing something obvious here?
The issue is that this works:
def FIRMWARE_RESTART(){
sendCommand("/printer/gcode/script?script=FIRMWARE_RESTART")
}
But this doesn't, if I put anything after the sendCommand then nothing happens, not even the POST:
def FIRMWARE_RESTART(){
sendCommand("/printer/gcode/script?script=FIRMWARE_RESTART")
x = 1 //Just a basic example, as anything here stops the above from successfully working?
}
The command being called
def sendCommand(command){
def headers = [:]
headers.put("HOST", "${ip}:${port}")
try {
def hubAction = new hubitat.device.HubAction(
method: POST,
path: command,
headers: headers
)
}
catch (Exception e) {
log.debug "runCmd hit exception ${e} on ${hubAction}"
}
}