You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/node-red/docs/en-US/nodes/device.md
+53-33Lines changed: 53 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,72 +7,92 @@ get its status, send commands, and subscribe to notifications.
7
7
The device can be specified in several ways:
8
8
9
9
1.**Node Config**: Device parameters are set manually in the node's
10
-
configuration panel.
11
-
-**Discovered Device**: You can select a device from the list
10
+
configuration panel.
11
+
-**Discovered Device**: You can select a device from the list
12
12
automatically found by the `Devices` node. This is the easiest method.
13
-
-**Manual**: You can enter the device parameters (ID, IP, MAC, token, model)
13
+
-**Manual**: You can enter the device parameters (ID, IP, MAC, token, model)
14
14
manually. This is useful for devices that are not discovered automatically.
15
15
2.**`msg.device`**: The node will use the device object passed in
16
-
the incoming `msg.device`.
17
-
This allows for dynamic control of different devices with a single node.
16
+
the incoming `msg.device`. This allows for dynamic control of different
17
+
devices with a single node.
18
18
19
-
**Important: The `Model` Field**
19
+
**Important: The Model Field**
20
20
21
-
For correct operation, especially with Bluetooth devices, it is **critically important** to specify the correct **Model** (e.g., `deerma.humidifier.jsq2w`).
21
+
For correct operation, especially with Bluetooth devices, it is
22
+
**critically important** to specify the correct **Model**
23
+
(e.g., `deerma.humidifier.jsq2w`).
22
24
23
-
A correctly specified `Model` allows the node to use a dedicated class for your device. These classes provide convenient, human-readable names for properties (e.g., `fan_level` instead of `siid: 2, piid: 6`) and may also offer additional methods (e.g., `getRooms()` for vacuums).
25
+
A correctly specified `Model` allows the node to use a dedicated class for
26
+
your device. These classes provide convenient, human-readable names for
27
+
properties (e.g., `fan_level` instead of `siid: 2, piid: 6`) and may also
28
+
offer additional methods (e.g., `getRooms()` for vacuums).
24
29
25
-
A full list of implemented device classes, their properties, actions, and methods is available in the `xmihome-devices` package documentation:
30
+
A full list of implemented device classes, their properties, actions, and
31
+
methods is available in the `xmihome-devices` package documentation:
26
32
27
33
-**[List of Supported Device Classes](https://github.com/alex2844/node-xmihome/blob/main/packages/devices/README.md)**
28
34
29
35
**What if my model is not on the list?**
30
36
31
-
Don't worry! If a specific class for your model is not found, the library will automatically try to download its official MiOT specification from the cloud. This works for most modern devices. In this case, you will be able to control the device using the standard `siid` and `piid` for properties and `siid` and `aiid` for actions.
37
+
Don't worry! If a specific class for your model is not found, the library
38
+
will automatically try to download its official MiOT specification from the
39
+
cloud. This works for most modern devices. In this case, you will be able to
40
+
control the device using the standard `siid` and `piid` for properties and
41
+
`siid` and `aiid` for actions.
32
42
33
43
### Actions
34
44
35
45
The node can perform various actions on the device:
-**Get Properties**: Requests *all* readable properties from the device and
48
+
returns them as an object.
39
49
-**Get Property**: Requests the value of a single, specific property.
40
-
The property name is set in the "Property" field or via `msg.property`.
50
+
The property name is set in the "Property" field or via `msg.property`.
41
51
-**Set Property**: Sets the value of a single property.
42
52
-**Property**: The name of the property to change.
43
53
-**Value**: The new value. Can be a string, number, boolean, or JSON object.
44
-
-**Call Action**: Calls a specific action on the device (e.g., `start_sweep` for a vacuum).
54
+
-**Call Action**: Calls a specific action on the device
55
+
(e.g., `start_sweep` for a vacuum).
45
56
-**Property**: The name of the action to call.
46
57
-**Value**: The parameters for the action, typically an array (e.g., `[]`).
47
-
-**Call Method**: Calls a method directly on the device's class instance. This is for advanced use cases not covered by standard properties or actions (e.g., `getRooms` or `getMapImage` on a vacuum).
58
+
-**Call Method**: Calls a method directly on the device's class instance.
59
+
This is for advanced use cases not covered by standard properties or
60
+
actions (e.g., `getRooms` or `getMapImage` on a vacuum).
48
61
-**Property**: The name of the method to call.
49
62
-**Value**: The parameters for the method, as an array.
50
63
-**Subscribe to Property**: Subscribes to notifications for property changes.
51
-
The node will send a message to the **first output** every time the device
52
-
reports a new value. The connection to the device will be kept active.
64
+
The node will send a message to the **first output** every time the device
65
+
reports a new value. The connection to the device will be kept active.
53
66
-**Unsubscribe from Property**: Cancels a previously created subscription.
67
+
-**Subscribe to Advertisements**: Subscribes to Bluetooth LE advertisements
68
+
(passive monitoring). Useful for battery-powered sensors that report data
69
+
periodically without a persistent connection.
70
+
-**Unsubscribe from Advertisements**: Stops monitoring Bluetooth
71
+
advertisements.
54
72
55
73
### Inputs
56
74
57
-
-`msg.device` (object, optional): If set,
58
-
overrides the device configuration in the node.
59
-
-`msg.property` (string, optional): If set,
60
-
overrides the property or action specified in the node.
61
-
-`msg.payload` (any): Used as the "Value" for the "Set Property" or "Call Action"
62
-
action if the "Value" field in the node is configured to use `msg.payload`.
63
-
-`msg.topic` (string, optional): If set, overrides the topic for the outgoing message.
75
+
-`msg.device` (object, optional): If set, overrides the device
76
+
configuration in the node.
77
+
-`msg.property` (string, optional): If set, overrides the property or
78
+
action specified in the node.
79
+
-`msg.payload` (any): Used as the "Value" for the "Set Property" or
80
+
"Call Action" action if the "Value" field in the node is configured
81
+
to use `msg.payload`.
82
+
-`msg.topic` (string, optional): If set, overrides the topic for the
83
+
outgoing message.
64
84
65
85
### Outputs
66
86
67
87
1.**Result / Notifications**
68
-
- For `Get/Set/Call` actions: Sends a single message with the result of the operation.
69
-
`msg.payload` contains the retrieved value, action result,
70
-
or is an object `{property, value}` on a successful set.
71
-
- For `Subscribe`: Sends a message each time a notification is received.
88
+
- For `Get/Set/Call` actions: Sends a single message with the result of
89
+
the operation. `msg.payload` contains the retrieved value, action
90
+
result, or is an object `{property, value}` on a successful set.
91
+
- For `Subscribe`: Sends a message each time a notification is received.
72
92
`msg.payload` contains the new property value.
73
93
2.**Connection Events**
74
-
- Sends messages about the device's connection status.
0 commit comments