Members
-
<readonly> value :number
-
Description
A numerical value representing the relay stateDetails
-
<readonly> isClosed :boolean
-
Description
True if the relay is closedDetails
-
<readonly> type :string
-
Description
"NC" if the relay is normally closed, "NO" if the relay is normally openDetails
Methods
-
configure( options ) → {Relay}
-
Description
Configure a RelayParameters
Name Type Description options
object Device configuration options Name Type Attributes Default Description type
number <optional> "NO" "NC" if a relay is normally closed, "NO" if it is normally open Returns
Examples
import Relay from "j5e/relay"; const relay = await new Relay(14); relay.configure({ type: "NC" }); // With type: "NC", relay.open() sets pin 14 high relay.open();
Details
-
close() → {Relay}
-
Description
Close the relay circuitReturns
Examples
import Relay from "j5e/relay" const relay = await new Relay(12); // Turn it on relay.close(); // Wait 5 seeconds and turn it off system.setTimeout(function() { relay.open(); }, 5000);
Details
-
open() → {Relay}
-
Description
Open the relay circuitReturns
Examples
import Relay from "j5e/relay" const relay = await new Relay(12); // Turn it on relay.close(); // Wait 5 seeconds and turn it off system.setTimeout(function() { relay.open(); }, 5000);
Details
-
toggle() → {Relay}
-
Description
Toggle the relay circuitReturns
Examples
import Relay from "j5e/relay" const relay = await new Relay(12); // Turn it on relay.toggle(); // Wait 5 seeconds and turn it off system.setTimeout(function() { relay.toggle(); }, 5000);
Details