Set String variable from HTTP GET response BUG?

Hi, I'm simply trying to use an HTTP response in a rule. I found that we can set a variable from an HTTP GET. When I tried it, I get this error.

Any help is appreciated, thanks.

C7 on Firmware 2.3.5.152


Switched the category to Rule Machine.

Does anyone currently have this working? @bravenel is this a known issue?

Seeing as you’re getting a NullPointer exception can you test the URL in a browser and see if you are getting a response?

Yes I've already checked that's and it's fine.

I did notice the response looks like JSON though, maybe it doesn't play nice with a JSON response...

There is a known bug with this, fixed in the next release. See the Known Issues report: Known Issues in Release 2.3.5.152

2 Likes

The "Erroneously sets a null value into a string variable for Set Variable to HTTP response" bug that 2.3.5.152 was supposed to fix is still there.

Screenshot 2023-09-08 at 12-18-50 free memory test

This works for me just fine. Show your rule...

That's the rule, right there.

Are you sure the get is actually returning a string. I made an identical set of actions to yours, and it works as expected.

If I just put the string

http://192.168.1.13:8080/hub/advanced/freeOSMemory

in a browser window, I get the hub's free memory, like

553044

Maybe it's just the "/hub/advanced/" endpoints that are the problem.

No, that's not the problem.

You aren't on the beta release that fixes this. Did you see the release notes referenced above? This is a known bug in 2.3.5.152, and is fixed in 2.3.6 (in beta).

2 Likes

Doh! {smacks forehead}

Sorry for wasting your time - I missed that, somehow.

1 Like

Thanks for this.
Easy to get the FreeOSMemory into a tile without adding the Hub Info app.

Installed the latest release 2.3.6.135 on my C7 and discovered the String hub variable type is limited to 254 chars.

So @bravenel how can I check the response of a web request for specific text where the response > 254 chars?

My original plan was to load the response into a hub variable and check the variable for the text inside a rule.

No matter where we set these limits, someone always busts them and wants us to increase them. As it stands now, the database schema imposes these limits. While in theory it might be possible to change this, it is not a high priority for us in the grand scheme of things. I will poke at the engineers again about it.

When you hit one of these limits that suggests that you will need to find another way to do whatever it is you are wanting to do. It also suggests that you probably have the sophistication to do so.