Table of Contents

Class KmTronicV2Relay

Namespace
adas_core.module.Relays.Devices
Assembly
adas-core.module.Relays.dll

Class representing a KMTronic V2 relay device. This class inherits from the RelayDevice class and provides specific implementations for checking the device status, getting the status of individual relays, and controlling the power state of the relays for a KMTronic V2 relay device.

public class KmTronicV2Relay : RelayDevice
Inheritance
KmTronicV2Relay
Inherited Members
Extension Methods

Constructors

KmTronicV2Relay(Relay, RelaySettings)

Constructor for the KmTronicV2Relay class. It initializes the base RelayDevice class with the provided Relay and RelaySettings objects, and then checks the device status to ensure it is functioning correctly.

public KmTronicV2Relay(Relay relay, RelaySettings relaySettings)

Parameters

relay Relay

The Relay object representing the relay device.

relaySettings RelaySettings

The RelaySettings object containing the configuration settings for the relay device.

Methods

CheckDevice()

Checks the status of the KMTronic V2 relay device by sending a request to retrieve the status of the relays. It updates the internal status of each relay based on the response received. The method returns true if the device is responsive and provides a valid status, and false otherwise.

public override sealed bool CheckDevice()

Returns

bool

True if the device is responsive and provides a valid status, false otherwise.

CheckStatus()

Checks the status of the KMTronic V2 relay device by sending a request to retrieve the status of the relays.

public override void CheckStatus()

Remarks

The method sends an HTTP GET request to the "status.xml" endpoint of the KMTronic V2 relay device and parses the XML response to update the internal status of each relay.

GetStatusRelay()

Gets the status of a specific relay outlet by sending a request to the KMTronic V2 relay device. The method returns the status of the specified relay outlet, which can be On, Off, or Unknown.

public override bool GetStatusRelay()

Returns

bool

True if the specified relay outlet is On, false otherwise.

GetStatusRelayAsync()

Gets the status of a specific relay outlet by sending a request to the KMTronic V2 relay device. The method returns the status of the specified relay outlet, which can be On, Off, or Unknown.

public override Task<bool> GetStatusRelayAsync()

Returns

Task<bool>

True if the specified relay outlet is On, false otherwise.

PowerOffAll()

Controls the power state of all relay outlets by sending requests to the KMTronic V2 relay device.

public override void PowerOffAll()

PowerOffRelay(int)

Gets the status of a specific relay outlet by retrieving the status from the internal status dictionary. The method returns the status of the specified relay outlet, which can be On, Off, or Unknown.

public override void PowerOffRelay(int outletId)

Parameters

outletId int

The ID of the relay outlet.

PowerOnAll()

Controls the power state of all relay outlets by sending requests to the KMTronic V2 relay device. The method iterates through all relay outlets and sends requests to change their state to the desired state (On or Off). After sending the requests, it checks the status of the device to ensure that the state changes were successful.

public override void PowerOnAll()

PowerOnRelay(int)

Gets the status of a specific relay outlet by retrieving the status from the internal status dictionary. The method returns the status of the specified relay outlet, which can be On, Off, or Unknown.

public override void PowerOnRelay(int outletId)

Parameters

outletId int

The ID of the relay outlet.

Reboot()

Reboots the KMTronic V2 relay device by first powering off all relay outlets, then waiting for a specified delay (if configured), and finally powering on all relay outlets again.

public override void Reboot()

RebootOutlet(int)

Reboots a specific relay outlet by first powering it off, then waiting for a specified delay (30 seconds in this case), and finally powering it on again.

public override void RebootOutlet(int outletId)

Parameters

outletId int

The ID of the relay outlet to reboot.