Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // tags:TAGS
- var tags = new Array();
- var tag = {};
- if (me.CurrentHumidity < me.VMHumidityLowLimit) {
- tag.vocabulary = "VendingMachineEventTags";
- tag.vocabulartTerm = "Humidity Low";
- tags.push(tag);
- me.VMHumidityLow = true;
- } else {
- me.VMHumiditytLow = false;
- }
- if (me.CurrentHumidity > me.VMHumidityHighLimit) {
- tag.vocabulary = "VendingMachineEventTags";
- tag.vocabulartTerm = "Humidity High";
- tags.push(tag);
- me.VMHumidityHigh = true;
- } else {
- me.VMHumidityHigh = false;
- }
- if (me.CurrentTemperature < me.VMTemperatureLowLimit) {
- tag.vocabulary = "VendingMachineEventTags";
- tag.vocabulartTerm = "Temperature Low";
- tags.push(tag);
- me.VMTemperatureLow = true;
- } else {
- me.VMTemperatureLow = false;
- }
- if (me.CurrentTemperature > me.VMTemperatureHighLimit) {
- tag.vocabulary = "VendingMachineEventTags";
- tag.vocabulartTerm = "Temperature High";
- tags.push(tag);
- me.VMTemperatureHigh = true;
- } else {
- me.VMTemperatureHigh = false;
- }
- // timestamp:DATETIME
- var timestamp = new Date();
- // values:INFOTABLE(Datashape: VendingMachineProcessData)
- var values = Things["VendingMachineProcessValuesStream"].CreateValues();
- values.VMTemperature = me.CurrentTemperature; //NUMBER
- values.VMHumidity = me.CurrentHumidity; //NUMBER
- // location:LOCATION
- var location = new Object();
- location.latitude = 0;
- location.longitude = 0;
- location.elevation = 0;
- location.units ="WGS84";
- var params = {
- tags : tags,
- timestamp : timestamp,
- source : me.name,
- values : values,
- location : me.Location
- };
- // AddStreamEntry(tags:TAGS, timestamp:DATETIME, source:STRING("me.name"), values:INFOTABLE(VendingMachineProcessData), location:LOCATION):NOTHING
- Things["VendingMachineProcessValuesStream"].AddStreamEntry(params);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement