AM43 Cover
==========

.. seo::
    :description: Setting up AM43/BLE covers in ESPHome.
    :image: am43.jpg

The ``am43`` cover platform allows you to control an AM43 based
BLE cover motor. These devices are sold under various brands, such
as Zemismart and A-OK. The platform connects to the device over the
ESP32's BLE peripheral and both controls and fetches the position
and state of the motor.

.. note::

    This component does NOT support Tuya-based versions of this device,
    as the protocol is completely different. If your device is controlled
    with the SmartLife app, then it will not work.

.. figure:: images/am43.jpg
    :align: right

.. code-block:: yaml

    # Example configuration entry

    esp32_ble_tracker:

    ble_client:
      - mac_address: AA:BB:CC:DD:EE:FF
        id: am43_kitchen

    cover:
      - platform: am43
        name: "Kitchen blinds"
        ble_client_id: am43_kitchen

Setup
-----

The AM43 should first be setup either with the OEM app or the buttons
following the instruction sheet, so that the speed, direction, limits,
etc are programmed in (this component does not yet support setting these).

Once setup, configure the yaml per the above example, using the MAC
address of your device.
See :ref:`Setting up devices <esp32_ble_tracker-setting_up_devices>` for
how to discover the MAC address.

To make use of the battery and light level sensors, see the
:doc:`/components/sensor/am43` component.

Configuration variables:
------------------------

- **name** (**Required**, string): The name of the cover.
- **ble_client_id** (**Required**, :ref:`config-id`): The id of the ``ble_client`` entry associated with the device.
- **pin** (*Optional*, int): The pin for the device, as
  set in the app. The default is usually printed on the
  device. Defaults to ``8888``.
- **invert_position** (*Optional*, boolean): Inverts the position value to and from the device. Set if ESPHome is swapping around the open/close state of the cover.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
- All other options from :ref:`Cover <config-cover>`.


.. note::

    The BLE stack on the ESP32 has a limit of three connected devices.


See Also
--------

- :doc:`index`
- :ref:`automation`
- :apiref:`am43/am43_cover.h`
- :ghedit:`Edit`
