Looking for some help to control spark via web

Hi @woody2shoes

SparkTime gives you a real-time clock, which is now built-in to core firmware. My library is still useful if you want more control or more precise time. The code was written before the built-in stuff was finished.

First off–are you editing both the deviceID and accessToken in the Javascript section of the web page HTML? These lines both need to be changed to match you core ID and access token. Make sure your access token has not expired too!

      var deviceID    = "<<device id here>>";
      var accessToken = "<<access token here>>";

The core firmware is set up for the US East coast time zone, so you can set that for your location. If the time if off, you might not see the outputs switch when you expect them.

When you set the start time and duration, you use 24-hour time format so for 11:30 pm you would use 23 30 on the web page.

The duration is measured in seconds! In the original application, the pumps that were being controlled were only on for a few seconds at a day.

To turn on D0 as you said for 10 minutes, you need to use a duration of 600 seconds.

You can use any web interface you want to control the core, including curl. The parameter format for the post request is 23:59:00*600 to turn on for 10 minutes at 11:59pm.

Hi Brian,
thanks mucho for the reply…some very good tips and advice on several of your points (such as firm ware is eastern time) as these help alot.

Yep, got the deviceID and accessToken in my web page (as I have a couple of very simple ‘hello world’ examples working: I can switch a light on/off from my phone off my web pages).

I’ll circle back and give this sparktime app another try. Again: Thankyou!

Forrest

1 Like