|
| 1 | +################ |
| 2 | +ZigbeeFanControl |
| 3 | +################ |
| 4 | + |
| 5 | +About |
| 6 | +----- |
| 7 | + |
| 8 | +The ``ZigbeeFanControl`` class provides a Zigbee endpoint for controlling fan devices in a Home Automation (HA) network. This endpoint implements the Fan Control cluster and allows for controlling fan modes and sequences. |
| 9 | + |
| 10 | +**Features:** |
| 11 | +* Fan mode control (OFF, LOW, MEDIUM, HIGH, ON, AUTO, SMART) |
| 12 | +* Fan mode sequence configuration |
| 13 | +* State change callbacks |
| 14 | +* Zigbee HA standard compliance |
| 15 | + |
| 16 | +**Use Cases:** |
| 17 | +* Smart ceiling fans |
| 18 | +* HVAC system fans |
| 19 | +* Exhaust fans |
| 20 | +* Any device requiring fan speed control |
| 21 | + |
| 22 | +API Reference |
| 23 | +------------- |
| 24 | + |
| 25 | +Constructor |
| 26 | +*********** |
| 27 | + |
| 28 | +ZigbeeFanControl |
| 29 | +^^^^^^^^^^^^^^^^ |
| 30 | + |
| 31 | +Creates a new Zigbee fan control endpoint. |
| 32 | + |
| 33 | +.. code-block:: arduino |
| 34 | +
|
| 35 | + ZigbeeFanControl(uint8_t endpoint); |
| 36 | +
|
| 37 | +* ``endpoint`` - Endpoint number (1-254) |
| 38 | + |
| 39 | +Fan Mode Enums |
| 40 | +************** |
| 41 | + |
| 42 | +ZigbeeFanMode |
| 43 | +^^^^^^^^^^^^^ |
| 44 | + |
| 45 | +Available fan modes for controlling the fan speed and operation. |
| 46 | + |
| 47 | +.. code-block:: arduino |
| 48 | +
|
| 49 | + enum ZigbeeFanMode { |
| 50 | + FAN_MODE_OFF, // Fan is off |
| 51 | + FAN_MODE_LOW, // Low speed |
| 52 | + FAN_MODE_MEDIUM, // Medium speed |
| 53 | + FAN_MODE_HIGH, // High speed |
| 54 | + FAN_MODE_ON, // Fan is on (full speed) |
| 55 | + FAN_MODE_AUTO, // Automatic mode |
| 56 | + FAN_MODE_SMART, // Smart mode |
| 57 | + }; |
| 58 | +
|
| 59 | +ZigbeeFanModeSequence |
| 60 | +^^^^^^^^^^^^^^^^^^^^^ |
| 61 | + |
| 62 | +Available fan mode sequences that define which modes are available for the fan. |
| 63 | + |
| 64 | +.. code-block:: arduino |
| 65 | +
|
| 66 | + enum ZigbeeFanModeSequence { |
| 67 | + FAN_MODE_SEQUENCE_LOW_MED_HIGH, // Low -> Medium -> High |
| 68 | + FAN_MODE_SEQUENCE_LOW_HIGH, // Low -> High |
| 69 | + FAN_MODE_SEQUENCE_LOW_MED_HIGH_AUTO, // Low -> Medium -> High -> Auto |
| 70 | + FAN_MODE_SEQUENCE_LOW_HIGH_AUTO, // Low -> High -> Auto |
| 71 | + FAN_MODE_SEQUENCE_ON_AUTO, // On -> Auto |
| 72 | + }; |
| 73 | +
|
| 74 | +API Methods |
| 75 | +*********** |
| 76 | + |
| 77 | +setFanModeSequence |
| 78 | +^^^^^^^^^^^^^^^^^^ |
| 79 | + |
| 80 | +Sets the fan mode sequence and initializes the fan control. |
| 81 | + |
| 82 | +.. code-block:: arduino |
| 83 | +
|
| 84 | + bool setFanModeSequence(ZigbeeFanModeSequence sequence); |
| 85 | +
|
| 86 | +* ``sequence`` - The fan mode sequence to set |
| 87 | + |
| 88 | +This function will return ``true`` if successful, ``false`` otherwise. |
| 89 | + |
| 90 | +getFanMode |
| 91 | +^^^^^^^^^^ |
| 92 | + |
| 93 | +Gets the current fan mode. |
| 94 | + |
| 95 | +.. code-block:: arduino |
| 96 | +
|
| 97 | + ZigbeeFanMode getFanMode(); |
| 98 | +
|
| 99 | +This function will return current fan mode. |
| 100 | + |
| 101 | +getFanModeSequence |
| 102 | +^^^^^^^^^^^^^^^^^^ |
| 103 | + |
| 104 | +Gets the current fan mode sequence. |
| 105 | + |
| 106 | +.. code-block:: arduino |
| 107 | +
|
| 108 | + ZigbeeFanModeSequence getFanModeSequence(); |
| 109 | +
|
| 110 | +This function will return current fan mode sequence. |
| 111 | + |
| 112 | +Event Handling |
| 113 | +************** |
| 114 | + |
| 115 | +onFanModeChange |
| 116 | +^^^^^^^^^^^^^^^ |
| 117 | + |
| 118 | +Sets a callback function to be called when the fan mode changes. |
| 119 | + |
| 120 | +.. code-block:: arduino |
| 121 | +
|
| 122 | + void onFanModeChange(void (*callback)(ZigbeeFanMode mode)); |
| 123 | +
|
| 124 | +* ``callback`` - Function to call when fan mode changes |
| 125 | + |
| 126 | +Example |
| 127 | +------- |
| 128 | + |
| 129 | +Fan Control Implementation |
| 130 | +************************** |
| 131 | + |
| 132 | +.. literalinclude:: ../../../libraries/Zigbee/examples/Zigbee_Fan_Control/Zigbee_Fan_Control.ino |
| 133 | + :language: arduino |
0 commit comments