Hello Peoples!
I need your help.
I have a thing connected via WebSocket (EdgeMicrosrever) to TWX Server.
This Thing sends every 6 Seconds current Property values via LuaScript.
Now I need two of these Properties to work with.
Weight - Value and Time - Value (Edge Thing Time, not the TWX Server Time)
But since i get every 6 seconds the current value - I dont need all the Values.
Im my case two Values per Property per Day would be enough.
Like --Weight and Timestamp Value-- at 8:00:00 and 18:00:00 Oclock Servertime dayli.
In my mind it looks like...
04.09.2018 08:00:00 40000(gr) 07:59:56
04.09.2018 18:00:00 35892 17:59:56
05.09.2018 08:00:00 34000 07:59:55
05.09.2018 18:00:00 28804 17:59:57
What do I need this data for?
First of All I want to visualize the change graphically, but also get a good overview just by seeing the Values.
Further I want to use this values to make a forecast on how long it will take to weight = 0.
Should i invoke the QueryPropertyHistory Service?
Should I use Valuestream? Datatable?
Should I create a Service?
Do I need to use Analytics?
How do I avoid Spam by collecting every single Value been send every 6 seconds?
Please help me to understand TWX.
Thank You!!
if you only need to record two values a day and you can't change the agent.
I would use a DataChange Subscription, evaluate if the point coming in is one you want to keep based on whatever you deem best. and then write them to a Stream
Dear Pai,
I have my "Weight_Stream" Stream based on "Weight_Data" Data Shape with TWXPersistenceProvider.
In my origin Thing I created a DataChange Subscription @ Weight Property. I used the Snippet to Add a Stream Entry.
This is how the subscription looks like now:
// tags:TAGS
var tags = new Array();
// timestamp:DATETIME
var timestamp = new Date();
// values:INFOTABLE(Datashape: Weight_Data)
var values = Things["Weight_Stream"].CreateValues();
values.Weight = undefined; //NUMBER
// location:LOCATION
var location = new Object();
location.latitude = 0;
location.longitude = 0;
location.elevation = 0;
location.units ="WGS84";
var params = {
timestamp : timestamp,
source : me.Weight,
values : values,
location : location
};
// AddStreamEntry(tags:TAGS, timestamp:DATETIME, source:STRING("me.name"), values:INFOTABLE(Weight_Data), location:LOCATION):NOTHING
Things["Weight_Stream"].AddStreamEntry(params);
_____________________________
Unfortunately my Stream stays empty. What have I done wrong? The one property i need is NUMBER. Do I need to prepare somehow the Data Shape/ Stream?
Thanks a lot in advance
igor