Author Topic: McPlug  (Read 301 times)


  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: McPlug
« on: May 18, 2017, 09:43:38 pm »

Ya no,  I saw that'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:

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



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