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.
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.