sendHttpPostRequest Problems

Hello,

I am with a problem using the SendHTTPPostRequest on OH2.2.
The problem is exactly the same as this:

In this link, I saw a fix for this, but I don`t know how to apply this fix, because my installation was from a RPM on a CentOS 7 running on raspberry.

The fix i found is here:

Can someone help me?

Thanks.

Just an update:

My installation was made from: https://dl.bintray.com/openhab/rpm-repo2/stable/2.1.0/

1 Like

Looks to me like the fix you’ve identified was merged a long time ago, and is probably already included in your build.

Then I have another problem.

I`am trying to make a rule work with this string:

sendHttpPostRequest(ifttt_url, “application/json”, notification_json)

This way, the rule is not working.
If I use the rule like this:

sendHttpPostRequest(ifttt_url)

Then it works fine.

Here is my entire rule:

rule “Send IFTTT Notification for Sensors in Specific Group”

when
    // Assign all sensor that will require notification together in one gorup
    Item LUZ_FUNDOS received update

then
    // IFTTT parameters
    var String ifttt_key = "nAJNlnKWoO_POgTf7MuUGLIeT-yVIm3tO78eV1wXBCd"
    var String ifttt_event = "Sensor_Alarm"
    var String ifttt_url = "http://xx.xx.xx.xx/trigger/" + ifttt_event + "/with/key/" + ifttt_key
    var String notification_json
    var lastItem = LUZ_FUNDOS.members.sortBy[lastUpdate].last


        notification_json = '{"value1":"' + lastItem.name + '","value2":"' + lastItem.state + '"}'
        sendHttpPostRequest(ifttt_url, "application/json", notification_json)

end

Ps.: I am using an internal http server to simulate this.

What am I doing wrong?

Thanks.

Here is the error that I see:

2017-11-08 14:52:33.933 [ERROR] [.script.engine.ScriptExecutionThread] - Rule ‘Send IFTTT Notification for Sensors in Specific Group’: An error occurred during the script execution: The name ‘.members’ cannot be resolved to an item or type.

Is LUZ_FUNDOS a Group?

If you list it in the console, does it have members?

items list | grep FUNDOS