Posting Data to Sen.se

3 replies [Last post]
BoxingOrange
Offline
United Kingdom
Joined: 11 Jun 2010

Here is a simple script that demonstrates writing data to Sen.se.  There should be enough comments in the script to get you going, you'll need to insert you API key and feed id.  You will also need a Sen.se account, you can request one on their web site, or I can give you an invite, although I only have 5 at the moment.

 

EDIT: Thanks for the pointer Brett, I've updated the script to remove the use of the depreciated global frame and removed some unnecessary conversion.  The updated script is attached.

AttachmentSize
senseApplet.lua1.96 KB
brett
Offline
Providence, United States
Joined: 9 Jan 2010
I would only make a minor

I would only make a minor change on the callback function so that the frame object is used instead of using the global frame, which at some point I should deprecate.

function elec_usage(frame)
-- print("Elec_usage")
local feedid = "1YOUR_FEED_ID"
local elec = tonumber(frame:getValue("input.state","text"))
-- print(string.format("Feed = %s, and elec is %s", "16110", tostring(elec)))
send_to_sense(feedid, elec)
end

update: Its frame:getValue() not frame.getValue() :)
BoxingOrange
Offline
United Kingdom
Joined: 11 Jun 2010
Thanks, I already caught that

Thanks, I already caught that one ;)  The script I've uploaded works.

andy_godber
Offline
Joined: 13 Sep 2011
open.sen.se

Ive got a couple of invites left if anyone wants in.

Hardware Info