|
| 1 | +MY9231/MY9291 LED driver Component |
| 2 | +================================== |
| 3 | + |
| 4 | +The MY9231/MY9291 component represents a MY9231/MY9291 LED diver chain |
| 5 | +(`MY9231 description <http://www.my-semi.com.tw/file/MY9231_BF_0.91.pdf>`__, |
| 6 | +`MY9291 description <http://www.my-semi.com.tw/file/MY9291_BF_0.91.pdf>`__) in |
| 7 | +esphomelib. Communication is done with two GPIO pins (DI and DCKI) and multiple |
| 8 | +driver chips can be chained. There are two models with different number of |
| 9 | +output channels (MY9291 with 4 channels and MY9231 with 3 channels). They are |
| 10 | +popular driver chips used in smart light blubs: |
| 11 | + |
| 12 | +- Sonoff B1 (MY9231) |
| 13 | +- Ai-Thinker AiLight WiFi light bulb (MY9291) |
| 14 | +- Arilux E27 Smart Bulb (MY9231) |
| 15 | + |
| 16 | +To use the channels of this components, you first need to setup the |
| 17 | +global ``my9231`` hub and give it an id, and then define the |
| 18 | +:doc:`individual output channels </esphomeyaml/components/output/my9231>`. |
| 19 | + |
| 20 | +.. note:: |
| 21 | + |
| 22 | + One of the features of the MY9231/MY9291 driver is that the chips |
| 23 | + remember their state after a power cycling. Unfortunately, the |
| 24 | + state of the driver can not be read. Therefore, if esphomelib can |
| 25 | + not restore the previous state, it will result in a mismatch of |
| 26 | + the driver output and the internal state (= MQTT state). So you |
| 27 | + can configure the behaviour on boot time: |
| 28 | + |
| 29 | + ``update_on_boot: True`` |
| 30 | + On device power up/boot, the light may flash shortly, to the |
| 31 | + state before powering off. |
| 32 | + |
| 33 | + ``update_on_boot: False`` |
| 34 | + On device power up/boot, the light show the last state, but the |
| 35 | + internal data will not reflect this state. Thus, the first fade |
| 36 | + is wrong, as well as the MQTT state. |
| 37 | + |
| 38 | +.. code:: yaml |
| 39 | +
|
| 40 | + # Example configuration entry |
| 41 | + my9231: |
| 42 | + - data_pin: GPIO12 |
| 43 | + clock_pin: GPIO14 |
| 44 | +
|
| 45 | + # Individual outputs |
| 46 | + output: |
| 47 | + - platform: my9231 |
| 48 | + id: 'my9231_output1' |
| 49 | + channel: 0 |
| 50 | +
|
| 51 | +Configuration variables: |
| 52 | +------------------------ |
| 53 | + |
| 54 | +- **data_pin** (**Required**, :ref:`config-pin_schema`): The pin which DI is connected |
| 55 | + to. |
| 56 | +- **clock_pin** (**Required**, :ref:`config-pin_schema`): The pin which DCKI is |
| 57 | + connected to. |
| 58 | +- **num_channels** (*Optional*, int): Total number of channels of the whole |
| 59 | + chain. Must be in range from 3 to 1020. Defaults to 6. |
| 60 | +- **num_chips** (*Optional*, int): Number of chips in the chain. Must be |
| 61 | + in range from 1 to 255. Defaults to 2. |
| 62 | +- **bit_depths** (*Optional*, int): The bit depth to use for all output |
| 63 | + channels in this chain. Must be one of 8, 12, 14 or 16. Defaults to 16. |
| 64 | +- **update_on_boot** (*Optional*, boolean): Update/reset duty data at boot. Defaults to ``True``. |
| 65 | +- **id** (*Optional*, :ref:`config-id`): The id to use for |
| 66 | + this ``my9231`` component. Use this if you have multiple MY9231/MY9291 chains |
| 67 | + connected at the same time. |
| 68 | + |
| 69 | +Sonoff B1 configuration example |
| 70 | +------------------------------- |
| 71 | + |
| 72 | +This component can be used with a Sonoff B1 smart light blub. To flash |
| 73 | +the Sonoff B1, open the plastic cover and connect/solder wires to the |
| 74 | +PCB pads (3.3V, RX, TX, GND, GPIO0). If you connect GPIO0 to GND |
| 75 | +during power up, the device enters flash mode. For more information |
| 76 | +about flashing Sonoff devices, see: |
| 77 | +:doc:`/esphomeyaml/devices/sonoff_s20`. All LEDs are connected to a |
| 78 | +chain of two MY9321 chips that are connected to GPIO12 and GPIO14. A |
| 79 | +complete configuration for a Sonoff B1 looks like: |
| 80 | + |
| 81 | +.. code:: yaml |
| 82 | +
|
| 83 | + esphomeyaml: |
| 84 | + name: <NAME_OF_NODE> |
| 85 | + platform: ESP8266 |
| 86 | + board: esp01_1m |
| 87 | + board_flash_mode: dout |
| 88 | +
|
| 89 | + wifi: |
| 90 | + ssid: <YOUR_SSID> |
| 91 | + password: <YOUR_WIFI_PASSPHRASE> |
| 92 | +
|
| 93 | + mqtt: |
| 94 | + broker: <YOUR_MQTT_BROKER> |
| 95 | + username: <YOUR_MQTT_USERNAME> |
| 96 | + password: <YOUR_MQTT_PASSWORD> |
| 97 | +
|
| 98 | + logger: |
| 99 | +
|
| 100 | + ota: |
| 101 | + password: <YOUR_OTA_PASSWORD> |
| 102 | +
|
| 103 | + my9231: |
| 104 | + data_pin: GPIO12 |
| 105 | + clock_pin: GPIO14 |
| 106 | + num_channels: 6 |
| 107 | + num_chips: 2 |
| 108 | +
|
| 109 | + output: |
| 110 | + - platform: my9231 |
| 111 | + id: output_blue |
| 112 | + channel: 0 |
| 113 | + - platform: my9231 |
| 114 | + id: output_red |
| 115 | + channel: 1 |
| 116 | + - platform: my9231 |
| 117 | + id: output_green |
| 118 | + channel: 2 |
| 119 | + - platform: my9231 |
| 120 | + id: output_warm_white |
| 121 | + channel: 4 |
| 122 | + - platform: my9231 |
| 123 | + id: output_cold_white |
| 124 | + channel: 5 |
| 125 | +
|
| 126 | + light: |
| 127 | + - platform: rgbww |
| 128 | + name: <LIGHT_NAME> |
| 129 | + red: output_red |
| 130 | + green: output_green |
| 131 | + blue: output_blue |
| 132 | + cold_white: output_cold_white |
| 133 | + warm_white: output_warm_white |
| 134 | + cold_white_color_temperature: 6500 K |
| 135 | + warm_white_color_temperature: 2800 K |
| 136 | +
|
| 137 | +See Also |
| 138 | +-------- |
| 139 | + |
| 140 | +- :doc:`output/my9231` |
| 141 | +- :doc:`API Reference </api/output/my9231>` |
| 142 | +- `Edit this page on GitHub <https://github.com/OttoWinter/esphomedocs/blob/current/esphomeyaml/components/my9231.rst>`__ |
| 143 | + |
| 144 | +.. disqus:: |
0 commit comments