Posting Data to Sen.se

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.

Member for

16 years 10 months

brett

14 years 3 months ago

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() :)

Member for

16 years 5 months

BoxingOrange

14 years 3 months ago

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

Member for

15 years 2 months

andy_godber

14 years 3 months ago

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

senseApplet.lua (1.96 KB)