At the moment, if no slot is specified, the start_timer service will automatically select slot 2 if a user only has one vial installed (in particular in slot 1). A Pura device that only has a vial in slot 1 will return a bay2wearingTime of 0. As a result, if the wearingTime for bay1 is greater than 0, slot 2 will be the automatically selected slot instead of slot 1 even though no fragrance vial is installed in bay2.
Example data returned by Pura API when only bay1 slot has a fragrance vial:
In order to get around this, if a user hasn't selected a slot:
1) We first check to see what slots are occupied and create a installed_slots list.
2) If determined that both bay1 and bay2 are occupied, then we compare wearingTime
3) If only bay1 or bay2 has a vial installed, then whichever one has a vial is determined to be the automatically selected slot.
4) In addition, a check is performed, and exception raised in the event that the user is attempting to call the start_timer on the device that has no vials installed.
If a user selects a specific slot:
An exception is raised indicating that the selected slot doesn't have a vial installed if the slot is not found in the installed_slots list.
At the moment, if no slot is specified, the
start_timer
service will automatically selectslot 2
if a user only has one vial installed (in particular inslot 1
). A Pura device that only has a vial inslot 1
will return abay2
wearingTime
of0
. As a result, if thewearingTime
forbay1
is greater than0
,slot 2
will be the automatically selected slot instead ofslot 1
even though no fragrance vial is installed inbay2
.Example data returned by Pura API when only
bay1
slot has a fragrance vial:In order to get around this, if a user hasn't selected a slot: 1) We first check to see what slots are occupied and create a
installed_slots
list. 2) If determined that bothbay1
andbay2
are occupied, then we comparewearingTime
3) If onlybay1
orbay2
has a vial installed, then whichever one has a vial is determined to be the automatically selected slot. 4) In addition, a check is performed, and exception raised in the event that the user is attempting to call thestart_timer
on the device that has no vials installed.If a user selects a specific slot: An exception is raised indicating that the selected slot doesn't have a vial installed if the slot is not found in the
installed_slots
list.