PeiraDevices¶
- class hive.actions.PeiraDevices(communication)¶
Bases:
objectList every existing call_action and the message to send to the server implemented by Peira.
Device type : Door, Food delivery system
- communication¶
The communication class is taking care of connecting, sending and receiving information.
- Type
Communication
Methods Summary
claim(element_id)Claim the device.
close_door(element_id)Close the door.
delivery_setting(element_id, delivery_mode, ...)Update time parameter in the delivering food setting.
dispense(element_id)Deliver food when in manual mode.
door_setup(element_id)Claim, check the battery level, and home the door device.
empty(element_id)Empty tube.
fill(element_id)Fill tube with chocolate sirup.
food_delivery_setup(element_id)Claim, check information in the food delivery device.
home(element_id)Reset the position of the door.
identify(element_id)Identify the element with a blue led blinking.
info(element_id)Obtain info from the hardware.
mode_auto(element_id)Set the delivery food in automatic mode in a release timer.
mode_manual(element_id)Set the delivery food in manual mode triggered by the pump call_action.
mode_one_shot(element_id)Set the delivery food in one-shot mode.
move_door(element_id)Look the state of the door and open or close the door following its state.
open_door(element_id)Open the door.
read(element_id, parameter)Read saved parameter on device.
release(element_id)Release the claimed device
rinse(element_id)Rinse the tubes.
sensor_setting(element_id, sensor_setting, ...)Update the sensor settings on the food pumps.
set_user(username)sleep(time_ms)Freeze the app during x ms.
Methods Documentation
- claim(element_id)¶
Claim the device.
- close_door(element_id)¶
Close the door.
- delivery_setting(element_id, delivery_mode, delivery_time)¶
Update time parameter in the delivering food setting.
- Parameters
element_id (
int) – where to send the commanddelivery_mode (
str) –auto: save dispensing time for automatic mode (ms) in the setting
button : save dispensing time for button 1 (ms) in the setting
manual : save dispensing time for command mode (ms) in the setting
all : save dispensing time for all modes (ms) in the setting
delivery_time (
int) – time to save in the setting
- Returns
message – log message
- Return type
- dispense(element_id)¶
Deliver food when in manual mode.
- door_setup(element_id)¶
Claim, check the battery level, and home the door device.
- empty(element_id)¶
Empty tube.
- fill(element_id)¶
Fill tube with chocolate sirup.
- food_delivery_setup(element_id)¶
Claim, check information in the food delivery device.
Information :
the battery level
the activated delivery mode
the food delivery time in this mode
the interval between delivery food
the sensor peira_event level.
- home(element_id)¶
Reset the position of the door.
- identify(element_id)¶
Identify the element with a blue led blinking.
- info(element_id)¶
Obtain info from the hardware.
- mode_auto(element_id)¶
Set the delivery food in automatic mode in a release timer.
- mode_manual(element_id)¶
Set the delivery food in manual mode triggered by the pump call_action.
- mode_one_shot(element_id)¶
Set the delivery food in one-shot mode.
When a peira_event occur, the food is automatically deliver (like in auto mode) and then go in manual mode. The food deliver is then deliver automatically only one time.
- move_door(element_id)¶
Look the state of the door and open or close the door following its state.
- open_door(element_id)¶
Open the door.
- read(element_id, parameter)¶
Read saved parameter on device.
- Parameters
element_id (
int) – where to send the commandparameter (
str) –auto : read dispensing time for automatic mode (ms) in the setting
button : read dispensing time for button 1 (ms) in the setting
manual : read dispensing time for command mode (ms) in the setting
interval : read dispensing interval (ms) in the setting.
detect_level : read proximity sensor detect level.
diode_current : read the diode current of the LED
- Returns
message – log message
- Return type
- release(element_id)¶
Release the claimed device
- rinse(element_id)¶
Rinse the tubes.
- sensor_setting(element_id, sensor_setting, quantity)¶
Update the sensor settings on the food pumps.
- Parameters
element_id (
int) – where to send the commandsensor_setting (
str) –interval : save dispensing interval (ms) in the setting. To prevent constant repeating of dispensing when the animal moves around a minimum interval can be defined. The time starts counting when the animal is AWAY from the sensor.
detect_level : save proximity sensor detect level. this parameter sets the maximum distance at which an animal can be detected.
diode_current : set the diode current of the LED
quantity (
int) – the value to change in the parameter
- Returns
message – log message
- Return type
- set_user(username)¶