Function Definition

Last Updated on : 2024-06-21 03:55:48download

This topic describes how to define functions for a pet feeder and how certain functions are reflected on its control panel. After the functions are defined, each function is abstracted into a data point (DP). Data transfers and device control are implemented based on DPs. For more information, see Product Functions.

Standard functions

Take a standard pet feeder product as an example. The following table lists the mappings between the functions and DPs of the product.

DP ID DP name Identifier Data transfer type Data type Property Remarks
1 Meal Plan meal_plan Send and report Raw - Sync DP data to the pet feeder. The device can normally dispense meals in the offline state. Up to 10 feeding schedules are supported.
2 Quick Feed quick_feed Send and report Boolean - Implement quick feeding. Users can tap to send a feeding command. The number of servings depends on the default settings of the microcontroller unit (MCU).
3 Manual Feed manual_feed Send and report Value Value range: 1 to 12,
Pitch: 1,
Scale: 0,
Unit: serving
Users set the number of servings.
4 Feed State feed_state Report only Enum Enum Value:
standby,
feeding,
done
The feeding state in which the device runs, for example, standby, feeding, and done. Custom feeding states are supported.
5 Unit Switch unit Send and report Enum Enum Value:
cup,
oz,
grid
Convert between the units of food measurement.
6 Slow Feed slow_feed Send and report Boolean - Enable or disable slow feeding.
7 Export Calibrate export_calibrate Send and report Boolean - The dispensing calibration switch. Users can tap to send a command for the pet feeder to automatically calibrate dispensing. After the action is finished, the switch is turned off.
8 Weight Calibrate weight_calibrate Send and report Boolean - The remaining food calibration switch. Users can tap to send a command for the pet feeder to automatically calibrate dispensing. After the action is finished, the switch is turned off.
9 Factory Reset factory_reset Send and report Boolean - Reset the device to factory defaults.
10 Export State export_state Report only Enum Enum Value:
true,
false
Report the status of food dispensing calibration.
11 Battery Percentage battery_percentage Report only Value Value range:0 to 100
Pitch: 1
Scale: 0
Unit: %
Switch to the battery power supply mode and display the battery level when the device is disconnected from mains power.
12 Charge State charge_state Report only Boolean - Display the state of charge, such as charging or full.
13 Cover State cover_state Report only Enum Enum Value:
on,
off
Report the state of the feeder cover. The on or off state can be reflected on the panel.
14 Fault fault Report only Fault Fault Value:
e1
e2
e3
Display fault alerts of the device.
15 Feed Report feed_report Report only Value Value range: 0 to 12,
Pitch: 1,
Scale: 0,
Unit: serving
Report the feeding result that is collected for statistics.
16 Surplus Grain surplus_grain Report only Value Value range:0 to 100
Pitch: 1
Scale: 0
Unit: %
The percentage of remaining food.
17 Weight weight Report only Value Value range: 0 to 10000,
Pitch: 1,
Scale: 0,
Unit: g
Report the weight of remaining food. Unit conversion is supported.
18 Voice Times voice_times Send and report Value Value range: 0 to 10,
Pitch: 1,
Scale: 0,
Unit:
Set the number of voice playbacks. Then, the device automatically plays back the voice to call pets to eat before each feeding.
19 Light light Send and report Boolean - Turn on or off the night light.
20 Switch switch Send and report Boolean - The main switch of the device.

Description of DPs

Meal Plan

Implement feeding schedules on the device in the raw format: week+time+amount+switch. The following conventions are followed:

  • The first 7 bits represent the days in a week, from Monday to Sunday. The setting value is converted from binary to hexadecimal and takes 1 byte. For each bit, 0 represents a valid day and 1 represents an invalid day. For example, 0000001 means that a scheduled feeding task takes effect on Sunday. The value is 01 after conversion to hexadecimal.

  • The time setting follows the format of hours:minutes. The setting value is converted from decimal to hexadecimal and takes 2 bytes. For example, 18:50 is 1232 after conversion to hexadecimal.

  • The amount setting indicates the number of servings for each feeding. The setting value is converted from decimal to hexadecimal and takes 1 byte. For example, 12 is 0c after conversion to hexadecimal.

  • The switch setting takes 1 byte. For example, 00 represents Off and 01 represents On.

    As a whole, in this example, the meal plan is set to 0112320c01 and represents Sunday+18:50+12 servings+On.

Feed Report

The device relies on the Feed Report DP to report the number of servings provided in each feeding. The reported data is stored in the cloud and displayed on the app.

Function Definition

Manual Feed and Quick Feed

Without setting the number of servings on the app, users can tap Feed, and the Quick Feed DP command is sent. If users set the number of servings and tap Feed on the app, the Manual Feed DP command is sent.

Function Definition

Local schedule of mean plan

After you add a Meal Plan DP, scheduled tasks take effect on the pet feeder, no matter whether CloudTiming is turned on.

Function Definition Function Definition

Cloud timing

If the Meal Plan DP is not added and the advanced function CloudTiming is turned on, cloud timing is enabled. Currently, cloud timing supports manual feeding.

Function Definition Function Definition Function Definition