auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
var dewpoint = require('dewpoint');
// Dacula is 309m above sea level
var xdp = new dewpoint(309);
// t = temperature in °C, rh = rel. humidity in %
//var y = xdp.Calc(event.body.decoded.payload.temp, event.body.decoded.payload.rh);
var y = xdp.Calc(steps.trigger.event.body.decoded.payload.temp_ambient, steps.trigger.event.body.decoded.payload.rh);
var x = y.x; // absolute humidity in g water per kg dry air
var dp = y.dp; // dew point temperature (in °C)
console.dir(x)
return x
//return x;
//return dp;
auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
var dewpoint = require('dewpoint');
// Dacula is 309m above sea level
var xdp = new dewpoint(309);
// t = temperature in °C, rh = rel. humidity in %
//var y = xdp.Calc(event.body.decoded.payload.temp, event.body.decoded.payload.rh);
var y = xdp.Calc(steps.trigger.event.body.decoded.payload.temp_ambient, steps.trigger.event.body.decoded.payload.rh);
var x = y.x; // absolute humidity in g water per kg dry air
var dp = y.dp; // dew point temperature (in °C)
console.dir(dp)
return dp
auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
const { toFahrenheitFmt } = require('celsius');
//var Ftemp = toFahrenheitFmt(event.body.decoded.payload.temp); // 97
var Ftemp = toFahrenheitFmt(steps.trigger.event.body.decoded.payload.temp_ambient); // 97
console.dir(Ftemp)
return Ftemp
//var dpF = toFahrenheitFmt(steps.dewpoint_calc.dp)
//return [Ftemp, dpF] // returning temp in F and the dewpoint converted to F
//toFahrenheit(36.68, 3); // 98.024
//toFahrenheit('-40.691 degrees C', 5); // -41.24380
auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
const { toFahrenheitFmt } = require('celsius');
//var Ftemp = toFahrenheitFmt(event.body.decoded.payload.temp); // 97
var Ftemp = toFahrenheitFmt(event.body.decoded.payload.temp_board); // 97
console.dir(Ftemp)
return Ftemp
//var dpF = toFahrenheitFmt(steps.dewpoint_calc.dp)
//return [Ftemp, dpF] // returning temp in F and the dewpoint converted to F
//toFahrenheit(36.68, 3); // 98.024
//toFahrenheit('-40.691 degrees C', 5); // -41.24380
auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
const { toFahrenheitFmt } = require('celsius');
//var Ftemp = toFahrenheitFmt(event.body.decoded.payload.temp); // 97
//console.dir(Ftemp)
//return Ftemp
var dpF = toFahrenheitFmt(steps.dewpoint_calc_dp.$return_value)
console.dir(dpF)
return dpF // return dewpoint converted to F
//toFahrenheit(36.68, 3); // 98.024
//toFahrenheit('-40.691 degrees C', 5); // -41.24380
auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
const UT = require("unixtimejs");
// get current unixtime:
//var ut = UT.now(); // eg: 1517433903
// unixtime -> UTCString
//var utcString = UT.toUTCString(event.body.reported_at); // "Wed, 31 Jan 2018 21:25:03 GMT"
var utcString = UT.toUTCString(event.body.reported_at/1000); // "Wed, 31 Jan 2018 21:25:03 GMT"
console.dir(utcString);
return utcString
Enter the data to insert into each column. Click + to add columns in structured mode, or turn structured mode off
to enter array of column values as an expression — e.g., {{[1,2,3]}}
The spreadsheet ID can be extracted from its URL. E.g., the spreadsheet ID in the URL docs.google.com/spreadsheets/d/abc1234567/edit#gid=0 is abc1234567
.
Enter the name of the tab in the spreadsheet where you want to add data. The default name for a new sheet is Sheet1
.
async
(params, auths) => {
}
const { columns } = params
// validate input
if (!columns || !columns.length) {
throw new Error("Please enter an array of elements in the `Columns` parameter above")
} else if (!Array.isArray(columns)) {
throw new Error("Column data is not an array. Please enter an array of elements in the `Columns` parameter above.")
} else if (Array.isArray(columns[0])) {
throw new Error("Column data is a multi-dimensional array. A one-dimensional is expected. If you're trying to send multiple rows to Google Sheets, search for the action to add multiple rows to Sheets, or try modifying the code for this step.")
}
const config = {
method: "post",
url: `https://sheets.googleapis.com/v4/spreadsheets/${params.spreadsheetId}/values/${params.sheetName}:append`,
params: {
includeValuesInResponse: true,
valueInputOption: "USER_ENTERED"
},
headers: {
Authorization: `Bearer ${auths.google_sheets.oauth_access_token}`,
},
data: {
values: [columns],
}
}
return (await require("@pipedreamhq/platform").axios(this, config)).updates
Enter the data to insert into each column. Click + to add columns in structured mode, or turn structured mode off
to enter array of column values as an expression — e.g., {{[1,2,3]}}
The spreadsheet ID can be extracted from its URL. E.g., the spreadsheet ID in the URL docs.google.com/spreadsheets/d/abc1234567/edit#gid=0 is abc1234567
.
Enter the name of the tab in the spreadsheet where you want to add data. The default name for a new sheet is Sheet1
.
async
(params, auths) => {
}
const { columns } = params
// validate input
if (!columns || !columns.length) {
throw new Error("Please enter an array of elements in the `Columns` parameter above")
} else if (!Array.isArray(columns)) {
throw new Error("Column data is not an array. Please enter an array of elements in the `Columns` parameter above.")
} else if (Array.isArray(columns[0])) {
throw new Error("Column data is a multi-dimensional array. A one-dimensional is expected. If you're trying to send multiple rows to Google Sheets, search for the action to add multiple rows to Sheets, or try modifying the code for this step.")
}
const config = {
method: "post",
url: `https://sheets.googleapis.com/v4/spreadsheets/${params.spreadsheetId}/values/${params.sheetName}:append`,
params: {
includeValuesInResponse: true,
valueInputOption: "USER_ENTERED"
},
headers: {
Authorization: `Bearer ${auths.google_sheets.oauth_access_token}`,
},
data: {
values: [columns],
}
}
return (await require("@pipedreamhq/platform").axios(this, config)).updates