Second ever Driver http Response broken

Below is my code for the poll

def poll() {
    if (logEnable) log.debug "polling..."
    String url = ""
    try {
        httpGet(url) { response ->
            def body =
            if (logEnable) log.debug "${body}"
            sendEvent(name: "color1", value: body, isStateChange: true);
    } catch(Exception e) {
    	log.debug "error occured calling httpget ${e}"

The log looks like this

But the Driver looks like this

I have tried just about everything I have seen in the forums and online. HELP!

What you see in the last picture is the memory address for the data. You need to access the value it refers to. You do that when writing to the log, but not in the actual command, which should be why this don't work. Changing the line as below should do it

sendEvent(name: "color1", value: "${body}", isStateChange: true);

Changing the code to the value of of body, yields the following error in the log

Try changing the following line


def body =


def body = new String(

We need store a copy of the contents in a variable, rather than just a reference to it.

That yields a new error

I also tried and got a similar error.

I am not a programmer but it seems that is Schrödinger data... as is both a string and not a string at the same time


def body = new String("${}"}

1 Like

That worked...thanks a ton. I am so not a programmer. But i am happy to get this hacked together!


Glad it helped. I had literally just figured out the exact same thing last night in an app I was working on. There may be a better solution, but this at least works for now. If others have a better solution, I am all ears. :wink:

Now I just have to get the rest of the code needed to set some bulbs to match the color!

@cheerlights on Twitter!

Download the Hubitat app