Preference values in IDE not equal to values when installed on Hub

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.value = ${evt.value}, settings = ${settings}, localContactValue = ‘${localContactValue}’.”)

Here is the results:
On the Hub:
In contactHandler() Line 184: = contact, evt.value = open, settings = [sunsetOffset:20, sendPushMessage:true, contactValue:[open]], localContactValue = ‘[“open”]’.

In the IDE:
In contactHandler() Line 184: = 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?

Are you comparing the behavior in the IDE Simulator vs when running for real? If so, ignore the simulator and just use live logging for real world testing and tweaking.

Also, NO custom code ever actually runs on the hub. It all runs in the ST cloud. Just want to make sure you understood that.

Thanks for the response.
Yes, I was comparing the simulator logging to the results when installed in the real world.

Can you point me to documentation that explains live logging. I’ve read several post on the subject but still do not understand how to code it or find the logs.

Live Logging is available in the Classic web IDE. Just open it in another tab, and leave it open. In your code, just add log.debug statements that print out the values of your variables or events to help debug your code.