val uid_Motion_timer_chj = "zwave%3Adevice%3Ac3f49cf3%3Anode8"
val uid_Motion_timer_entree = "zwave%3Adevice%3Ac3f49cf3%3Anode5"
val uid_Motion_timer_Couloir = "zwave%3Adevice%3Ac3f49cf3%3Anode16"
val uid_Motion_timer_cuisine = "zwave%3Adevice%3Ac3f49cf3%3Anode10"
val uid_Motion_timer_salon = "zwave%3Adevice%3Ac3f49cf3%3Anode17"
val uid_Motion_timer_sam = "zwave%3Adevice%3Ac3f49cf3%3Anode13"
val uid_Motion_timer_sdj = "zwave%3Adevice%3Ac3f49cf3%3Anode6"
val uid_Motion_timer_chp = "zwave%3Adevice%3Ac3f49cf3%3Anode7"
val uid_Motion_timer_sdb = "zwave%3Adevice%3Ac3f49cf3%3Anode9"
rule "config timer Motion"
when
Member of G_Motion_Timer received command
then
var int configTimer = (triggeringItem.state as Number).intValue
var Number jsonTimer = '{"config_6_2": ' + configTimer + '}'
var httpPutTimer = 'uid_' + triggeringItem.name
logInfo("motion.test", "http://localhost:8080/rest/things/" + httpPutTimer + "/config" + jsonTimer)
sendHttpPutRequest("http://localhost:8080/rest/things/" + httpPutTimer + "/config", "application/json", jsonTimer)
end
the httpPutTimer variable is egal at uid_Motion_timer_entree when it’s the Motion_timer_entree item who lunch the request. but after impossible to transforme uid_Motion_timer_entree at zwave%3Adevice%3Ac3f49cf3%3Anode5 in the sendHttpPutRequest
This does not deal with the case of the triggering Item not having a numeric state e.g.NULL or UNDEF
I’m not sure what the triggering Item state is that you expecting, but don’t forget that commands are asynchronous - if you are expecting the command to have influenced the state by autoupdate etc., it may or may not have happened yet.
This looks a bit weird on two points;
You declare a Number type but assign a string value. I think DSL can deal with that, and ignore your declaration. configTimer was delcared as an int primitive type, I do not think that has a .toString method that DSL will look for in string building. Type Integer would be a better choice.
The problem isn’t with configTimer , this variable is a number … the problem is here with httpPutTimer who is egal for example at uid_Motion_timer_entree but in sendHttpPutRequest (or the loginfo) isn’t change to zwave%3Adevice%3Ac3f49cf3%3Anode5