I’m having a bit of a problem getting the code I developed in the IDE to run correctly when installed on my SmartThings hub.
Using sendNotification(), I have discovered that the values of preferences are not the same in the IDE as they are when installed on the Hub.
Here is the actual code that sends a notification when executed.
sendMessage(“In contactHandler() Line 184: evt.name = ${evt.name}, evt.value = ${evt.value}, settings = ${settings}, localContactValue = ‘${localContactValue}’.”)
Here is the results:
On the Hub:
In contactHandler() Line 184: evt.name = contact, evt.value = open, settings = [sunsetOffset:20, sendPushMessage:true, contactValue:[open]], localContactValue = ‘[“open”]’.
In the IDE:
In contactHandler() Line 184: evt.name = contact, evt.value = open, settings = [sunsetOffset:20, sendPushMessage:true, contactValue:open], localContactValue = ‘open’.
Specifically, notice the value of localContactValue which is a string variable that I defined and set with localContactValue = settings.contactValue. The value of settings.contactValue is set in preferences with:
input “contactValue”, “enum”, title: “Which value”, multiple: true, required: false, options: [“open”, “closed”]
Also notice the value of contactValue. When running on the Hub, the value contains brackets [open]; and in the case of localContactValue, it contains brackets and quotes [“open”].
Am I doing something wrong or do I need to modify the code to work differently in the real world vs the IDE?
I have also noticed that in the IDE, if I select “closed” for contactValue, the value is actually set to “1” whereas if I select “open” the value is actually set to open. When installed on the hub, the value is passed correctly as either open or closed. Is this also normal abnormal behavior?
Added on 6/09
What do I need to do to get a little help on this problem. Do I need to clarify the issue?