Render method not rendering

Hello guys - i am trying my first app and its a very simple one - i want to select a device and one of its properties, and expose only that property via HTTP endpoint. All works correctly, i see that my endpoint gets hit via the debug messages, but the render method at the end seems to not be working correctly and i cant find any documentation on that. Here is what my final function looks like:

void getDeviceValue() {
    def device = settings.theDevice
    def variable = settings.theVariable
    def deviceState = device.currentValue(variable)

    log.debug "Device: $device"
    log.debug "Variable: $variable"
    log.debug "State: $deviceState"

    def result = [state: deviceState]

    render contentType: "application/json", data: result
}

All debug messages produce the correct values, but the page returns a blank response in the browser. Does anyone have any idea why that is?

Try changing your

void getDeviceValue() {

to

def getDeviceValue() {
1 Like

Damn, i totally overlooked that. Thanks!

1 Like

It's bitten me a number of times. :sunglasses:

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.