URI: 
   DIR Return Create A Forum - Home
       ---------------------------------------------------------
       mc-Things
  HTML https://mcthings.createaforum.com
       ---------------------------------------------------------
       *****************************************************
   DIR Return to: mc-Plug
       *****************************************************
       #Post#: 1965--------------------------------------------------
       McPlug
       By: davecason Date: May 14, 2017, 3:54 pm
       ---------------------------------------------------------
       Hi,
       Can you guys point me in the right direction for using a mcplug
       to turn on a light using the time of day?
       Is there already code written to use the gateway to monitor the
       computers time or a NIST server out there for the correct time
       of the day.
       Then tell the mcplug to turn on and off at set times ?
       That's gotta be a common use for a mcplug I would think
       ..........
       Cheers'
       Dave
       #Post#: 1969--------------------------------------------------
       Re: McPlug
       By: mc-T2 Date: May 16, 2017, 12:37 am
       ---------------------------------------------------------
       Hey Dave,
       We have created an example project that we posted on the forum
       and on our Hackster hub.
       Check out this post here:
  HTML http://mcthings.createaforum.com/mc-innovations/mcplug-hackster-project!-396/msg1918/#msg1918<br
       />
       Check out the Hackster project here:
  HTML https://www.hackster.io/mc-Things/using-the-mcplug-for-iot-applications-8c2183<br
       />
       In regards to your question, there is no specific function to
       set an even to happen at a specific time however what you can do
       is have the device check the time at certain intervals and if
       the device finds that the time is within your specifications,
       then you can have the plug turn on or off something.
       Hope that helps!
       #Post#: 1975--------------------------------------------------
       Re: McPlug
       By: davecason Date: May 18, 2017, 9:43 pm
       ---------------------------------------------------------
       Ya no,  I saw that .....it's no good.
       I just want a simple script that pings a time server, or gets
       the time and keeps track of it, or tracks a standard clock.
       And at time "A " it turns on the mcplug and at time " B " it
       turns it off.
       Pretty much the most obvious thing for a 120v switch ..... do
       you guys have anything?
       A buddy sent me this:
       VER 1
       ----------------------------------------------------------------
       -------
       Class test
       Shared Event ACPlug() RaiseEvent Every 1 Minutes
       Dim Hr As Byte
       
       Hr = Hour (DateTime.Hour ())
       Relay = (Hr >= 8 And Hr < 20)
       End Event
       End Class
       ----------------------------------------------------------------
       ----
       VER 2
       1. Start McStudio
       2. File -> New Project. Lets say you call it "Plug1" this time.
       3. Give it a name WITHOUT spaces in it. That's a known bug.
       4. Set the dropdown device type to mcPlug120
       5. Try this out:
       Class Plug1
       Shared Event ACPlug RaiseEvent Every 1 Minutes
       Dim Hr as Byte
       Hr = Hour()
       Relay = (Hr >= 8 and Hr <20)
       End Event
       End Class
       Cheers'
       Dave
       #Post#: 1986--------------------------------------------------
       Re: McPlug
       By: mc-T2 Date: May 21, 2017, 9:03 am
       ---------------------------------------------------------
       [quote]it's no good.[/quote] The example does work quite well,
       so I am not sure what the issue is other than that it doesn't do
       exactly as you wish. I pointed it out as an example of mcPlug
       code that you can take and modify for your own use
       As mentioned, this is not a function that is built-in to the
       platform at this time. However, as mentioned, there are
       work-arounds so that you can design your own program. Have you
       tried to write your own script? Here is the help I provided in
       my previous reply:
       [quote]there is no specific function to set an even to happen at
       a specific time however what you can do is have the device check
       the time at certain intervals and if the device finds that the
       time is within your specifications, then you can have the plug
       turn on or off something.[/quote]
       Have you looked at incorporating the examples your buddy sent
       over? You may also want to check around the forum as there are
       some recent questions and discussions about timestamps and their
       usage.
       As mentioned, there are ways to do this. Part of the great thing
       about the mcThings platform is that there are almost endless
       ways you can program and modify devices which is why it is
       nearly impossible to have an example of everything you can do.
       That said, if you read the documentation and take the time to
       putting something together, you can then provide an example
       script to others if you wish.
       #Post#: 1993--------------------------------------------------
       Re: McPlug
       By: davecason Date: May 24, 2017, 5:19 pm
       ---------------------------------------------------------
       Ya know  ......  This getting annoying !
       Here I have a fuggen Dell Workstation - a T7400 with two Xeon
       E5440's processors and 64 GB of RAM and for shits and giggles
       9.3TB of space.
       It'd be freaken great if the damm McStudio app didn't crash
       every single time I write something in the app for the McPlug.
       I'm pretty sure it's NOT the computer and everything else
       connected to it, or in it, seems to run pretty damm happy, and
       has so done for a year !
       (sigh)
       Cheers'
       Dave
       #Post#: 1998--------------------------------------------------
       Re: McPlug
       By: mc-T2 Date: May 30, 2017, 2:30 pm
       ---------------------------------------------------------
       Dave,
       There is a new release today of mcStudio (and new versions of
       mcOS for all devices/modules). There are a lot of bugs/crashes
       that were fixed i this version so please be sure to download it.
       Should help to resolve the issues you noted about the
       application crashing sometimes
       You can check out a portion of the release notes for mcStudio in
       this post:
  HTML http://mcthings.createaforum.com/system-updates/new-release!-v0-9-for-mcstudio-mcos-for-all-devices!/<br
       />
       *****************************************************