System Control
Pre-requisite
- The user has to be signed in to perform the following operations.
- The user should have an active pro-monitoring plan activated on the space.
Arming the System
To arm the system, The following method can be used:
spaceId(required): The space id of the User.
InstaVision.securityServices.armSystem(
spaceId = "spaceId",
onSuccess = {
// The system arming request has been sent and will be armed after the exit delay
},
onError = { error ->
// The error object contains the error code and message
}
)
Disarming the System
To disarm the system, The following method can be used:
spaceId(required): The space id of the User.
InstaVision.securityServices.disarmSystem(
spaceId = "spaceId",
onSuccess = {
// The system will be disarmed.
},
onError = { error ->
// The error object contains the error code and message
}
)
Enabling Test Mode
To enable test mode on the system, The following method can be used:
spaceId(required): The space id of the User.request(required): The request object to toggle the test mode
val request = TestModeRequest(
enable = true
)
InstaVision.securityServices.enableTestMode(
spaceId = "spaceId",
request = request,
onSuccess = {
// The system is now in test mode.
},
onError = { error ->
// The error object contains the error code and message
}
)
Getting Schedules
To get the arm/disarm schedules of the system, The following method can be used:
spaceId(required): The space id of the User.profileId(required): The security profile id of the User.
InstaVision.securityServices.getSchedules(
spaceId = "spaceId",
profileId = "profileId",
onSuccess = { schedules ->
// The list of schedules configured for the security profile
},
onError = { error ->
// The error object contains the error code and message
}
)
Scheduling Arm/Disarm
To schedule arm/disarm of the system, The following method can be used:
spaceId(required): The space id of the User.profileId(required): The security profile id of the User.request(required): The request object containing the scheduling details.
val request = UpdateSecurityScheduleRequest(
type = "Arm", // Type can be "Arm" or "Disarm"
timezone = "America/Los_Angeles", // Timezone in which the schedule is to be set
selectedDays = listOf(WeekDay.MONDAY, WeekDay.WEDNESDAY, WeekDay.FRIDAY), // Days of the week to apply the schedule
timeSlot = Time(
hour = 22, // Hour in 24-hour format
minute = 0
)
)
InstaVision.securityServices.addSchedule(
spaceId = "spaceId",
profileId = "profileId",
request = request,
onSuccess = { schedule ->
// The arming schedule that was created
},
onError = { error ->
// The error object contains the error code and message
}
)
Update Scheduling Arm/Disarm
To update a schedule for arm/disarm of the system, The following method can be used:
spaceId(required): The space id of the User.profileId(required): The security profile id of the User.scheduleId(required): The schedule id of the schedule to be updated.request(required): The request object containing the updated scheduling details.
val request = UpdateSecurityScheduleRequest(
type = "Arm", // Type can be "Arm" or "Disarm"
timezone = "America/Los_Angeles", // Timezone in which the schedule is to be set
selectedDays = listOf(WeekDay.MONDAY, WeekDay.WEDNESDAY, WeekDay.FRIDAY), // Days of the week to apply the schedule
timeSlot = Time(
hour = 22, // Hour in 24-hour format
minute = 0
)
)
InstaVision.securityServices.updateSchedule(
spaceId = "spaceId",
profileId = "profileId",
scheduleId = "scheduleId",
request = request,
onSuccess = { schedule ->
// The updated arming schedule
},
onError = { error ->
// The error object contains the error code and message
}
)
Deleting Schedules
To delete existing schedules for arm/disarm of the system, The following method can be used:
spaceId(required): The space id of the User.profileId(required): The security profile id of the User.request(required): The request object containing the schedule ids to delete.
val request = DeleteSecurityScheduleRequest(
scheduleIds = listOf() // List of schedule IDs to be deleted
)
InstaVision.securityServices.deleteSchedules(
spaceId = "spaceId",
profileId = "profileId",
request = request,
onSuccess = {
// The schedules have been deleted successfully.
},
onError = { error ->
// The error object contains the error code and message
}
)
NVR System Control
The following methods manage the security profile and alarm system for NVR-connected devices.
Creating an NVR Security Profile
To create a security profile for an NVR device, The following method can be used:
spaceId(required): The space id of the User.request(required): The request object containing the NVR device id and profile details.
val address = SecurityAddress(
lineOne = "123 Main St", // The street address
city = "San Francisco", // The city
state = "CA", // The state
zipCode = "94105", // The postal code
country = "US" // The country
)
val request = NvrSecurityProfileRequest(
deviceId = "deviceId",
address = address,
timezone = "TimeZone"
)
InstaVision.securityServices.createNvrProfile(
spaceId = "spaceId",
request = request,
onSuccess = {
// The NVR security profile has been created
},
onError = { error ->
// The error object contains the error code and message
}
)
Arming the NVR System
To arm the NVR-connected security system, The following method can be used:
spaceId(required): The space id of the User.
InstaVision.securityServices.armNvrSystem(
spaceId = "spaceId",
onSuccess = {
// The NVR system arming request has been sent
},
onError = { error ->
// The error object contains the error code and message
}
)
Disarming the NVR System
To disarm the NVR-connected security system, The following method can be used:
spaceId(required): The space id of the User.
InstaVision.securityServices.disarmNvrSystem(
spaceId = "spaceId",
onSuccess = {
// The NVR system will be disarmed
},
onError = { error ->
// The error object contains the error code and message
}
)
Updating NVR Devices
To update the devices linked to the NVR security profile, The following method can be used:
spaceId(required): The space id of the User.request(required): The request object containing the list of devices.
val request = SecurityDeviceRequest(
deviceIds = listOf("deviceId1", "deviceId2")
)
InstaVision.securityServices.updateNvrDevices(
spaceId = "spaceId",
request = request,
onSuccess = { devices ->
// Returns the list of NVR security enabled devices
},
onError = { error ->
// The error object contains the error code and message
}
)
Updating the NVR Exit Delay
To update the exit delay for the NVR-connected system, The following method can be used:
spaceId(required): The space id of the User.request(required): The request object containing the exit delay in seconds.
val request = UpdateExitDelayRequest(
exitDelay = 60
)
InstaVision.securityServices.updateNvrExitDelay(
spaceId = "spaceId",
request = request,
onSuccess = {
// The exit delay has been updated
},
onError = { error ->
// The error object contains the error code and message
}
)
Adding an NVR Responding Party
To add a responding party (a phone number to be contacted) for NVR alarms, The following method can be used:
spaceId(required): The space id of the User.request(required): The request object containing the responding party details.
val request = NvrRespondingPartiesRequest(
name = "Jane Doe",
code = "+1",
value = "1231231234",
otp = "123123" // Optional, required if the phone number needs OTP verification
)
InstaVision.securityServices.addNvrResponseParty(
spaceId = "spaceId",
request = request,
onSuccess = { response ->
// Whether the responding party was added successfully
},
onError = { error ->
// The error object contains the error code and message
}
)
Deleting an NVR Responding Party
To remove a responding party from the NVR alarm system, The following method can be used:
spaceId(required): The space id of the User.request(required): The request object identifying the responding party to remove.
val request = DeleteRespondingPartiesRequest(
code = "+1",
value = "1231231234"
)
InstaVision.securityServices.deleteNvrResponseParty(
spaceId = "spaceId",
request = request,
onSuccess = {
// The responding party has been removed
},
onError = { error ->
// The error object contains the error code and message
}
)