OK back on this problem. I really need to get this working and would appreciate any help I can get. @tcgerhard was kind enough to post a script that is working but when I try it I get the error:
TypeError: actions.thingActions is not a function in <eval> at line number 1
I DO have a couple of questions which may or may not be related. In this section:
var ecobeeActions = actions.thingActions("Ecobee Thermostat", "ecobee:thermostat:Ecobee_Account:511...");
setClimateHold("Skyes Ecobee", ecobeeActions, "Away");
Is “ecobee:thermostat:Ecobee_Account:511…” (the full name of my thermostat Thing as shown in OH) correct, or should it be missing the “Ecobee_Account:” part?
Next, this name:
actions.thingActions("Ecobee Thermostat"
Is that supposed to be as it is shown, or the name of my Ecobee Account name as shown in OH?
Finally:
setClimateHold("Skyes Ecobee"
That is supposed to be the name of the thermostat as shown in Ecobee right?
Here is my full script:
var ecobeeActions = actions.thingActions("Ecobee Thermostat", "ecobee:thermostat:Ecobee_Account:511...");
setClimateHold("Skyes Ecobee", ecobeeActions, "Away");
function setClimateHold(statName, statActions, desiredClimate) {
var climates = statActions.getClimates()
// console.log("climate = " + climates);
if (climates !== null) {
climates = JSON.parse(climates);
var numElements = climates.length;
console.log("Climates: There are ", numElements, " climates in array");
console.log(JSON.stringify(climates[numElements-1]));
var nameMap = {};
for (var i=0; i < numElements; i++) {
climateSettings = climates[i];
nameMap[climateSettings.name] = climateSettings.climateRef;
// console.log("Climate ", i, " Name: " + climateSettings.name, " Ref: ", climateSettings.climateRef, " Heat: ", (climateSettings.heatTemp/10.0));
}
if (desiredClimate in nameMap ) {
console.log("Setting ", nameMap[desiredClimate], " for ", statName);
ecobeeActions.setHold(nameMap[desiredClimate]);
} else {
console.log("Did not find ", desiredClimate, " for ", statName);
console.log(JSON.stringify(nameMap));
}
} else {
console.log("No climates found for " + statName)
}
}