Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
I am attempting to programmatically add a property to a remote thing. I need to set the push type to "Always pushed", but passing a value of "Always pushed" as a parameter yields the following error:
Error executing service <Service>. Message :: Invalid Push Type : [Always pushed] - See Script Error Log for more details.
I've experimented with every variation of "Always pushed" I can think of with no luck. What is the proper string input needed to specify the push type?
The code for the service is below:
try{
Things["myThing"].property = 0;
}catch(err){
var error=err.message;
if(error.match(/not found on myThing/)!=null){
var params = {
defaultValue: undefined /* STRING */,
remoteBindingAspects: undefined /* JSON */,
description: undefined /* STRING */,
readOnly: false /* BOOLEAN */,
type: "STRING" /* BASETYPENAME */,
remote: true /* BOOLEAN */,
remotePropertyName: 'remotepropertyname' /* STRING */,
timeout: undefined /* INTEGER */,
pushType: 'Always pushed' /* STRING */,
dataChangeThreshold: undefined /* NUMBER */,
logged: undefined /* BOOLEAN */,
name: "property" /* STRING */,
pushThreshold: undefined /* NUMBER */,
dataChangeType: undefined /* STRING */,
category: undefined /* STRING */,
persistent: true /* BOOLEAN */,
dataShape: undefined /* DATASHAPENAME */
};
// no return
Things["myThing"].AddPropertyDefinition(params);
// no return
Things["myThing"].RestartThing();
}
}
Solved! Go to Solution.
Instead of pushType, Try
"dataChangeType": "ALWAYS"