Hello, first time poster here. As part of a project I am attempting to use the Twitter API to send a tweet when a certain appliance at my home is turned on. As part of the initial testing, I wanted to make sure I could send a message with the current hour to the agent, then tweet a message involving the current hour. The following code produces no errors, yet for some reason does not work (no tweet appears and no message appears in the server log).
Any help people could provide would be appreciated.
My Agent Code is:
//The actual keys have been omitted for the sake of this post
const API_KEY = “XYZ”;
const API_SECRET = “XYZ”;
const AUTH_TOKEN = “XYZ”;
const TOKEN_SECRET = “XYZ”;
twitter <- Twitter(API_KEY, API_SECRET, AUTH_TOKEN, TOKEN_SECRET);
twitter.tweet("Hello World. It is hour: " + now.hour.toString());
My device code is:
`device_switch <- hardware.pin1;
state <- 0;
local now = date();
state = 1 - state;
send_tweet(); imp.wakeup(60.0, turn_on);