Add Peripherals

Door (REX, Contact, Strike)

To add a door to a reader we must look at what compromises a door in the system. In this case it is comprised of two inputs and one output. All three are added in very similar ways. Actually, they all use the same method. The first input that we will add to our reader is the REX. Then the door contact. The input devices add essentially the same way but configure differently. The door strike is our Output device and since that is a different peripheral device it has a completely different configuration.

For more information on Peripherals in general, Mercury Inputs/Outputs, and the methods used please look at PeripheralInfo, MercuryInputInfo,and MercuryOutputInfo.

Example in C#

//add door rex
var rex = await client.AddPeripheralToReaderAsync((MercuryReaderInfo)reader, ReaderPeripheralTypes.Rex, //adding an input associated to the reader for the purpose of being the REX
new MercuryInputInfo
{
	CommonName = $"Rex for {reader.CommonName}",
	Behaviour = 1, // normally open
	Debounce = 2, // debounce time if needed
	SioIndex = 1 // index location on the SIO
});

//add door contact
var contact = await client.AddPeripheralToReaderAsync((MercuryReaderInfo)reader, ReaderPeripheralTypes.Contact,//adding an input associated to the reader for the purpose of being the Contact
new MercuryInputInfo
{
	CommonName = $"Contact for {reader.CommonName}",
	Behaviour = 0, //Normally closed
	Debounce = 4, //debounce time if needed
	SioIndex = 0 //index location on the SIO
});

//add door strike
var strike = await client.AddPeripheralToReaderAsync((MercuryReaderInfo)reader, ReaderPeripheralTypes.Strike, //adding an output associated to the reader for the purpose of being the Strike
new MercuryOutputInfo //defines what traits need to be defined by us 
{
	CommonName = $"Strike for {reader.CommonName}", //adding a name
	SioIndex = 0, //indexing the output
	ActivationTime = 6, //how long the strike is to be activated
	Mode = 0, //normal mode
	SioNumber = 0 //SIO number
});

Example in CURL

#add door rex
curl -X POST \
  https://keepapi.feenicshosting.com/api/f/INSTANCE.KEY/peripherals/PERIPHERAL.KEY/Rex \
  -H 'Authorization:  Bearer TOKEN_GOES_HERE' \
  -H 'Content-Type: application/json' \
  -d '{"$type":"Feenics.Keep.WebApi.Model.MercuryInputInfo, Feenics.Keep.WebApi.Model","LatchMode":0,"EntryDelay":null,"ExitDelay":null,"Debounce":2,"Behaviour":1,"HoldTime":null,"IsDisabled":false,"ControllerIndex":0,"SioNumber":0,"SioIndex":1,"ControllerKey":null,"ControllerCommonName":null,"ControllerHref":null,"Status":null,"BacnetReadOnly":null,"Key":null,"CommonName":"Rex for cURL_Reader","InFolderHref":null,"InFolderKey":null,"Links":[],"ObjectLinks":null,"Metadata":null,"Notes":null,"Tags":null,"Monikers":null,"Href":null}'
#add door contact
curl -X POST \
  https://keepapi.feenicshosting.com/api/f/INSTANCE.KEY/peripherals/PERIPHERAL.KEY/Contact \
  -H 'Authorization:  Bearer TOKEN_GOES_HERE' \
  -H 'Content-Type: application/json' \
  -d '{"$type":"Feenics.Keep.WebApi.Model.MercuryInputInfo, Feenics.Keep.WebApi.Model","LatchMode":0,"EntryDelay":null,"ExitDelay":null,"Debounce":4,"Behaviour":0,"HoldTime":null,"IsDisabled":false,"ControllerIndex":0,"SioNumber":0,"SioIndex":0,"ControllerKey":null,"ControllerCommonName":null,"ControllerHref":null,"Status":null,"BacnetReadOnly":null,"Key":null,"CommonName":"Contact for cURL_Reader","InFolderHref":null,"InFolderKey":null,"Links":[],"ObjectLinks":null,"Metadata":null,"Notes":null,"Tags":null,"Monikers":null,"Href":null}'
#add door strike
curl -X POST \
  https://keepapi.feenicshosting.com/api/f/INSTANCE.KEY/peripherals/PERIPHERAL.KEY/Strike \
  -H 'Authorization:  Bearer TOKEN_GOES_HERE' \
  -H 'Content-Type: application/json' \
  -d '{"$type":"Feenics.Keep.WebApi.Model.MercuryOutputInfo, Feenics.Keep.WebApi.Model","Mode":0,"ActivationTime":6,"ControllerIndex":0,"SioNumber":0,"SioIndex":0,"ControllerKey":null,"ControllerCommonName":null,"ControllerHref":null,"Status":null,"BacnetReadOnly":null,"Key":null,"CommonName":"Strike for cURL_Reader","InFolderHref":null,"InFolderKey":null,"Links":[],"ObjectLinks":null,"Metadata":null,"Notes":null,"Tags":null,"Monikers":null,"Href":null}'