Cosm questions?

ok playing around with cosm and I am wondering if I am doing this right Here is the code that I have

`server.log(“what is going on”);
local temps;
local a;
local b = 0.00005;
local c = 0.0;
local d;

local volts =0.0;

local tempout;
function readtemp()
{
volts = hardware.voltage()/65535
imp.wakeup(2.0, readtemp);
temps = hardware.pin1.read();

a = temps * volts;
c = 100 * a - 50;
d = c * 1.8 + 32;

server.show(d);
tempout = d;
tempout = OutputPort(“temps”, “number”);
}

readtemp();

hardware.pin1.configure(ANALOG_IN);
imp.configure(“Simple Tempature Monitor”, [], [tempout]);`

You need to call the output Port set method tempout.set(d);
Also I would declare the output Port outside your function as it only needs to be done once.

thank you very much. Getting better with this nutty language (pun intended). I am working on a web server for my home that is letting me get information from the imp to it.

a HomeServer is the way to go for now, once server side Agents arrive you will be able to move stuff to e.imp cloud. The only thing you Won’t get is storing of historical sensor and event data. I’ve used Cosm for a few years but I don’t like it graphs.

Well COSM is working great for my temp sensor, now another question, can I make more than one cosm connection? Like 3 different temp sensors on the imp to 3 different cosm vimps?

Yes you need declare 3 output ports

`local cosmWS = [ OutputPort(“cosm0”, “number”), OutputPort(“cosm1”, “number”), OutputPort(“cosm2”, “number”)];

cosmWS[0].set( )
cosmWS[1].set( )
cosmWS[2].set( )

imp.configure(“cosmTimes3”, [], cosmWS);`

From memory you can multiple datapoints in a data stream as that’s how I used to send data. I will have a look as you might be able to do it via one data stream.