Feed, start cooking, play text and execute text directive
Li Shuzhen edited this page 2025-11-20 16:00:34 +08:00

Problem Description

There are no UI entries to

  • feed in a fish tank or a pet feeder
  • start cooking in a cooker or a health pot
  • play text or execute text directive in an intelligent WiFi speaker.

Reason

The device functions of feeding, starting cooking, playing text and executing text directive are defined as actions with parameters in MIoT-Spec-V2 protocol. The "in" field of the action instance is an array of the action's input parameters. The elements of the "in" field array indicate the piids of the properties in the same service. For example, if the "in" field of siid=7 aiid=4 action is [2,3], it means that the action has two input parameters, and the first parameter is the value of piid=2 property in siid=7 service while the second parameter is the value of piid=3 property in siid=7 service. The input parameter order is the same as the element order of the "in" field array.

The MIoT-Spec-V2 action with input parameters is converted to the Notify entity in Home Assistant. You can use the Notify entity in the automation action to send the command message to the device.

Add a new automation
Figure 1: Add a new automation action of notification

The message is a JSON array in which every element must follow the format and the order of the parameters of the MIoT-Spec-V2 action instance.

Add a new automation
Figure 2: Choose entity and set the message

The input parameters' format and order can be found in the Notify entity attributes pane.

Action attribute
Figure 3: Action input parameters' format and order

Checking the option xiaomi_home > CONFIGURE > Debug mode for action, a Text entity will be generated alongside the Notify entity. You can use the Text entity to send the command message to the device and verify whether it is correct. Press Enter in the Text entity to activate sending message to the device.

Text entity
Figure 4: Text entity in debug mode for action

Solution

Feed

For example, xiaomi.feeder.pi2001 siid=2 aiid=1 is "Pet Food Out" action. Its "in" field is [8], meaning that piid=8 "Feeding Measure" property in siid=2 service is the only input parameter of this action. The value of this property is the amount of food to be fed. It is an integer value in the range of 0 to 150. So the input can be [50].

Text entity for feeding
Figure 5: Feed the pet with a certain food measure

Start cooking

For example, xiaomi.health_pot.p1v2 siid=2 aiid=1 is "Start Cook" action. Its "in" field is [3], meaning that piid=3 "Mode" property in siid=2 service is the only input parameter of this action. The value of this property is the cooking mode. It is an integer value restricted to a value list. The input can be [4], specifying the cooking mode as "Green Tea".

Text entity for cooking
Figure 6: Start cooking with the selected cooking mode

Play text

For example, xiaomi.wifispeaker.l05b siid=5 aiid=3 is "Play Text" action. Its "in" field is [1], meaning that piid=1 "Text Content" property in siid=5 service is the only input parameter of this action. The value of this property is the text content to be played. It is a string value. The input can be ["Hello world!"].

Text entity for playing
Figure 7: Play text content

Execute text directive

For example, xiaomi.wifispeaker.l05b siid=5 aiid=4 is "Execute Text Directive" action. Its "in" field is [1,2], meaning that piid=1 "Text Content" property in siid=5 service is the first input parameter of the action and piid=2 "Silent Execution" property in siid=5 service is the second input parameter of the action. siid=5 piid=1 property is a string value. siid=5 piid=2 property is a bool value. So the input can be ["Turn on the light",true].

Text entity for executing
Figure 8: Execute text directive in silence