Merge branch 'current' into next

This commit is contained in:
Jesse Hills 2023-04-13 10:11:13 +12:00
commit cd92f71534
No known key found for this signature in database
GPG Key ID: BEAAE804EFD8E83A
82 changed files with 456 additions and 4092 deletions

View File

@ -61,13 +61,16 @@ To maximize the chances of catching advertisements of the sensors, you can set `
scan_parameters:
interval: 1100ms
window: 1100ms
.. note::
For WiFi-based proxies, changing the ``interval`` or ``window`` from their default values may result in an unstable WiFi connection. Using the default values for ``interval`` and ``window`` will usually resolve any instability.
Avoid placing the ESP node in racks, close to routers/switches or other network equipment as EMI interference will degrade Bluetooth signal reception. For best results put as far away as possible, at least 3 meters distance from any other such equipment. Place your ESPHome devices close to the Bluetooth devices that you want to interact with for the best experience.
Complete sample recommended configuration
-----------------------------------------
Complete sample recommended configuration for an ethernet-connected Bluetooth proxy
-----------------------------------------------------------------------------------
Below is a complete sample recommended configuration for a Bluetooth proxy. If you experience issues with your proxy, try reducing your configuration to be as similar to this as possible.
Below is a complete sample recommended configuration for an ethernet-connected Bluetooth proxy. This configuration is not for a Wi-Fi based proxy. If you experience issues with your proxy, try reducing your configuration to be as similar to this as possible.
This configuration is for an Olimex ESP32-PoE-ISO board with an Ethernet connection to the network. If you use a different board, you must change the ``board`` substitution to match your board.

View File

@ -20,7 +20,7 @@ The ``midea`` component creates a Midea air conditioner climate device.
- `Senville <https://senville.com/>`_
- and maybe others
Control is possible with a custom dongle. Example of hardware implementation is `IoT Uni Dongle <https://github.com/dudanov/iot-uni-dongle>`_ or `Midea SLWF-01pro <https://www.ebay.com/itm/164956459539>`_ (`store <https://smartlight.me/smart-home-devices/wifi-devices/wifi-dongle-air-conditioners-midea-idea-electrolux-for-home-assistant>`_, `Tindie <https://www.tindie.com/products/smartlightme/wifi-dongle-for-air-conditioners-midea-electrolux>`_).
Control is possible with a custom dongle. Example of hardware implementation is `IoT Uni Dongle <https://github.com/dudanov/iot-uni-dongle>`_ or `Midea SLWF-01pro <https://smartlight.me/smart-home-devices/wifi-devices/wifi-dongle-air-conditioners-midea-idea-electrolux-for-home-assistant>`_ (`CloudFree <https://cloudfree.shop/product/ductless-hvac-wi-fi-module/>`_, `Tindie <https://www.tindie.com/products/smartlightme/wifi-dongle-for-air-conditioners-midea-electrolux>`_).
.. code-block:: yaml

View File

@ -266,6 +266,7 @@ See Also
- :doc:`/components/switch/gpio`
- :doc:`/components/binary_sensor/gpio`
- :ref:`LCD Menu <lcd_menu>`
- :ref:`Add pages to LCD display <lambda_magic_pages>`
- :doc:`/components/pcf8574`
- `HD44780U (LCD-II) datasheet <https://www.sparkfun.com/datasheets/LCD/HD44780.pdf>`__
- `Charset cheatsheet <https://user-images.githubusercontent.com/1550668/173113487-9c98e866-8ee4-4a3c-a83f-61fe62057c5f.png>`__

View File

@ -218,37 +218,37 @@ appropriate lines of C code in the lambda to hide or show the image or text as y
id: tdisplay_button_input_1
# Allow dimmable control of the backlight (pin GPIO4)
output:
- platform: ledc
pin: GPIO4
id: gpio4
output:
- platform: ledc
pin: GPIO4
id: gpio4
light:
- platform: monochromatic
output: gpio4
name: "Backlight"
light:
- platform: monochromatic
output: gpio4
name: "Backlight"
image:
- file: "image.png"
id: my_image
resize: 200x200
type: RGB24
image:
- file: "image.png"
id: my_image
resize: 200x200
type: RGB24
time:
- platform: homeassistant
id: esptime
time:
- platform: homeassistant
id: esptime
spi:
clk_pin: GPIO18
mosi_pin: GPIO19
spi:
clk_pin: GPIO18
mosi_pin: GPIO19
display:
- platform: st7789v
cs_pin: GPIO5
dc_pin: GPIO16
reset_pin: GPIO23
rotation: 270
lambda: |-
display:
- platform: st7789v
cs_pin: GPIO5
dc_pin: GPIO16
reset_pin: GPIO23
rotation: 270
lambda: |-
it.rectangle(0, 0, it.get_width(), it.get_height(), id(my_blue));
it.rectangle(0, 20, it.get_width(), it.get_height(), id(my_blue)); // header bar

View File

@ -44,7 +44,7 @@ See Also
- :doc:`/components/switch/modbus_controller`
- :doc:`/components/number/modbus_controller`
- :doc:`/components/output/modbus_controller`
- :doc:`EPEVER MPPT Solar Charge Controller Tracer-AN Series</cookbook/tracer-an>`
- `EPEVER MPPT Solar Charge Controller (Tracer-AN Series) <https://devices.esphome.io/devices/epever_mptt_tracer_an>`__
- `Modbus RTU Protocol Description <https://www.modbustools.com/modbus.html>`__
- :ref:`uart`
- :apiref:`modbus/modbus.h`

View File

@ -53,7 +53,7 @@ Configuration variables:
- **address** (**Required**, :ref:`config-id`): The modbus address of the device
Specify the modbus device address of the.
- **command_throttle** (*Optional*, int): minimum time in milliseconds between 2 requests to the device. Default is 0ms
- **command_throttle** (*Optional*, :ref:`config-time`): minimum time in between 2 requests to the device. Default is 0ms
Because some modbus devices limit the rate of requests the interval between sending requests to the device can be modified.
- **update_interval** (*Optional*, :ref:`config-time`): The interval that the sensors should be checked.
@ -529,6 +529,6 @@ See Also
- :doc:`/components/switch/modbus_controller`
- :doc:`/components/number/modbus_controller`
- :doc:`/components/output/modbus_controller`
- :doc:`EPEVER MPPT Solar Charge Controller Tracer-AN Series</cookbook/tracer-an>`
- `EPEVER MPPT Solar Charge Controller (Tracer-AN Series) <https://devices.esphome.io/devices/epever_mptt_tracer_an>`__
- `Modbus RTU Protocol Description <https://www.modbustools.com/modbus.html>`__
- :ghedit:`Edit`

View File

@ -39,9 +39,9 @@ Configuration variables:
this ``bp1658cj`` component. Use this if you have multiple BP1658CJ chains
connected at the same time.
- **max_power_color_channels** (*Optional*, int 0-15): Adjusts the current supplied to the
color channels, higher is more power. Default is 2 per BP1658CJ datasheet. See table below.
color channels, higher is more power. Default is 4 per BP1658CJ datasheet. See table below.
- **max_power_white_channels** (*Optional*, int 0-15): Adjusts the current supplied to the
white channels, higher is more power. Default is 4 per BP1658CJ datasheet. See table below.
white channels, higher is more power. Default is 6 per BP1658CJ datasheet. See table below.
.. note::

View File

@ -12,7 +12,7 @@ Component/Hub
-------------
The PCA9685 component represents a PCA9685 12-bit PWM driver
(`datasheet <https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/peripherals/ledc.html#configure-channel>`__,
(`datasheet <https://www.nxp.com/docs/en/data-sheet/PCA9685.pdf>`__,
`adafruit <https://www.adafruit.com/product/815>`__) in ESPHome. It
uses :ref:`I²C Bus <i2c>` for communication.

View File

@ -895,6 +895,7 @@ See Also
- :doc:`index`
- :doc:`/components/remote_receiver`
- :ref:`lambda_magic_rf_queues`
- `RCSwitch <https://github.com/sui77/rc-switch>`__ by `Suat Özgür <https://github.com/sui77>`__
- `IRRemoteESP8266 <https://github.com/markszabo/IRremoteESP8266/>`__ by `Mark Szabo-Simon <https://github.com/markszabo>`__
- :apiref:`remote_transmitter/remote_transmitter.h`

View File

@ -402,6 +402,7 @@ See Also
--------
- :apiref:`rf_bridge/rf_bridge.h`
- :ref:`lambda_magic_rf_queues`
- `RF-Bridge-EFM8BB1 <https://github.com/Portisch/RF-Bridge-EFM8BB1>`__ by `Portisch <https://github.com/Portisch>`__
- :doc:`/components/uart`
- :doc:`/components/remote_receiver`

View File

@ -11,7 +11,7 @@ to values. When a given binary sensor is on, the value associated with it in thi
This sensor is **mostly used for touch** devices but could be used for any ``binary_sensor`` that publishes its ``ON`` or ``OFF`` state.
Add your binary sensors as ``channels`` to the binary sensor map. The binary sensor map then publishes a value depending
on the type of the binary sensor map and the values specified with each channel.
on the type of the binary sensor map and the values specified with each channel. The maximum amount of possible channels is 64.
This platform currently supports two measurement types: ``GROUP`` and ``SUM``, and others might get added later.
You need to specify which type of mapping you want with the ``type:`` configuration value:

View File

@ -145,6 +145,29 @@ You will see the outputted sensor values changing when they're being warmed.
When you're finished mapping each address to a name, just change the ``Temperature #1``
to your assigned names and you should be ready.
Multiple dallas hubs
********************
Use this if you have multiple dallas hubs:
.. code-block:: yaml
# Example configuration entry
dallas:
- pin: GPIO23
id: hub_1
- pin: GPIO24
id: hub_2
sensor:
- platform: dallas
dallas_id: hub_1
# ...
- platform: dallas
dallas_id: hub_2
# ...
See Also
--------

View File

@ -111,7 +111,7 @@ See Also
- :doc:`/components/sensor/bh1750`
- :doc:`/components/sensor/tsl2561`
- :doc:`/cookbook/temt6000`
- `TEMT6000 <https://devices.esphome.io/devices/temt6000>`__
- :ref:`sensor-filters`
- :apiref:`ltr390/ltr390.h`
- :ghedit:`Edit`

View File

@ -271,5 +271,5 @@ See Also
- :doc:`/components/binary_sensor/modbus_controller`
- :doc:`/components/text_sensor/modbus_controller`
- :doc:`/components/switch/modbus_controller`
- :doc:`EPEVER MPPT Solar Charge Controller Tracer-AN Series</cookbook/tracer-an>`
- `EPEVER MPPT Solar Charge Controller (Tracer-AN Series) <https://devices.esphome.io/devices/epever_mptt_tracer_an>`__
- :ghedit:`Edit`

View File

@ -93,7 +93,7 @@ measure the total consumed energy in kWh.
sensor:
- platform: pulse_counter
pin: 12
unit_of_measurement: 'Wh'
unit_of_measurement: 'kW'
name: 'Power Meter House'
filters:
- multiply: 0.06 # (60s/1000 pulses per kWh)

View File

@ -2,10 +2,10 @@ SHT3X-D Temperature+Humidity Sensor
===================================
.. seo::
:description: Instructions for setting up SHT31-D temperature and humidity sensors
:description: Instructions for setting up SHT31-D/SHT3x temperature and humidity sensors
:image: sht3xd.jpg
The ``sht3xd`` sensor platform Temperature+Humidity sensor allows you to use your Sensirion SHT31-D
The ``sht3xd`` sensor platform Temperature+Humidity sensor allows you to use your Sensirion SHT31-D/SHT3x
(`datasheet <https://cdn-shop.adafruit.com/product-files/2857/Sensirion_Humidity_SHT3x_Datasheet_digital-767294.pdf>`__,
`Adafruit`_ ) sensors with
ESPHome. The :ref:`I²C Bus <i2c>` is

View File

@ -461,10 +461,13 @@ section below for more detail and examples.
***********************************
Sets the multiplier value used to proportionally increase or decrease the run duration for all valves/zones.
When a given valve is activated, this value is multiplied by the valve's run duration (see below) to determine the
valve's actual run duration. *Note that a multiplier value of zero is allowed; if the multiplier value is zero, the
sprinkler controller will not start any valves.* **This can result in confusing/unexpected behavior if a visual
indication of this condition is not available!**
For seasonal changes, its easier to use the multiplier to adjust the watering time instead of adjusting the
run durations directly. Set your run duration to the time you want for mild weather (spring/autumn) and then
use the multiplier to increase (summer) or decrease (winter) the calculated run times. When a given valve is
activated, this value is multiplied by the valve's run duration (see below) to determine the valve's actual
run duration. *Note that a multiplier value of zero is allowed; if the multiplier value is zero, the
sprinkler controller will not start any valves.* **This can result in confusing/unexpected behavior if
a visual indication of this condition is not available!**
.. code-block:: yaml

View File

@ -5,7 +5,7 @@ Safe Mode Switch
:description: Instructions for setting up switches that can remotely reboot the ESP in ESPHome into safe mode.
:image: restart.svg
The ``safe_mode`` switch allows you to remotely reboot your node into :ref:`Safe Mode <config-ota>`. This is useful in certain situations where a misbehaving component, or low memoary state is preventing Over-The-Air updates from completing successfully.
The ``safe_mode`` switch allows you to remotely reboot your node into :ref:`Safe Mode <config-ota>`. This is useful in certain situations where a misbehaving component, or low memory state is preventing Over-The-Air updates from completing successfully.
This component requires :ref:`OTA <config-ota>` to be configured.

View File

@ -21,9 +21,10 @@ Configuration variables:
- **id** (*Optional*, :ref:`config-id`): Specify the ID of the time for use in lambdas.
- **timezone** (*Optional*, string): Manually tell ESPHome what time zone to use with `this format
<https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html>`__ (warning: the format is quite complicated)
<https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html>`__
(warning: the format is quite complicated, see `examples <https://github.com/nayarsystems/posix_tz_db/blob/master/zones.csv>`__)
or the simpler `TZ database name <https://en.wikipedia.org/wiki/List_of_tz_database_time_zones>`__ in the form
<Region>/<City>. ESPHome tries to automatically infer the time zone string based on the time zone of the computer
:code:`<Region>/<City>`. ESPHome tries to automatically infer the time zone string based on the time zone of the computer
that is running ESPHome, but this might not always be accurate.
- **on_time** (*Optional*, :ref:`Automation <automation>`): Automation to run at specific intervals using
a cron-like syntax. See :ref:`time-on_time`.

View File

@ -1,63 +0,0 @@
.. seo::
:description: AirGradient DIY Air Quality Sensor
:image: air_gradient_diy_air_quality_sensor.jpg
:keywords: Air Quality Sensor DIY
AirGradient DIY Air Quality Sensor
==================================
.. figure:: images/air_gradient_diy_air_quality_sensor.jpg
:align: center
:width: 100.0%
AirGradient has created a DIY Air Quality sensor.
They offer a PCB, PCB + components kit, etc.
A pretty neat package.
To use this you have to run their software but you can use the kit with ESPHome as well!
Here is what it can measure:
- **Temperature**
- **Humidity**
- **Air particles PM2.5**
- **Carbon Dioxide**
Additionally:
- There is a display so show off your data or whatever you desire from Home Assistant
- You can download a 3D printable case including a wall mount bracket
ESPHome Configuration
---------------------
Documentation:
- `Blog Article: Measuring Air Quality in your Home Office <https://www.ajfriesen.com/measuring-air-quality-in-your-home-office/>`__
- `ESPHome code with a setup guide for Home Assistant <https://github.com/ajfriesen/ESPHome-AirGradient>`__
- `AirGradient Shop for the PCB or PCB plus components <https://www.airgradient.com/diyshop/>`__
- `AirGradient Setup Guide (3D printeable case, setup guide, etc.) <https://www.airgradient.com/diy/>`__
`YAML configuration <https://github.com/ajfriesen/ESPHome-AirGradient/blob/main/air-gradient-diy.yaml>`__
Soldering and setup video:
.. raw:: html
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/Cmr5VNALRAg" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
See Also
--------
- :doc:`/devices/nodemcu_esp8266`
- :doc:`/components/display/ssd1306`
- :doc:`/components/i2c`
- :doc:`/components/uart`
- :doc:`/components/sensor/sht3xd`
- :doc:`/components/sensor/pmsx003`
- :doc:`/components/sensor/senseair`
- :doc:`/components/wifi`
- :doc:`/components/api`
- :doc:`/components/logger`
- :doc:`/components/ota`
- :doc:`/components/switch/safe_mode`
- :ghedit:`Edit`

View File

@ -1,121 +0,0 @@
BLE iTag Button
===============
.. seo::
:description: Receive events from a cheap BLE keyring button.
:image: bluetooth.svg
This example shows how to use a cheap BLE keyring tag to trigger arbitrary
events. An ESP32 is used, which provides a BLE peripheral.
.. figure:: images/esp32_ble_itag.png
:align: center
:width: 40%
These tags can be had for a couple of dollars each and run for several months
on a coin cell. Using the BLE features of ESPHome, you can use these as small
and cheap remotes to control any automation.
Quickstart
----------
Use the configuration block below for a basic setup which will provide a
binary_sensor that is momentarily turned on when the button is pressed.
You will need to find the MAC address of your tag. See the documentation
for :doc:`/components/ble_client` for how to find this out. You may also
wish to change the name and id fields where appropriate to suit your
device(s).
Note that a maximum of three devices are supported due to limitations in
the ESP32's BLE stack.
Configuration example:
------------------------
.. code-block:: yaml
esp32_ble_tracker:
ble_client:
# Replace with the MAC address of your device.
- mac_address: FF:FF:20:00:0F:15
id: itag_black
binary_sensor:
- platform: template
id: black_button
name: "Black iTag Button"
filters:
delayed_off: 200ms
sensor:
# This entry registers and awaits notifications for the
# characteristic that signals button presses. Each time
# a notification is received, the corresponding binary_sensor
# is briefly toggled.
- platform: ble_client
type: characteristic
ble_client_id: itag_black
name: "Black iTag btn"
service_uuid: 'ffe0'
characteristic_uuid: 'ffe1'
notify: true
update_interval: never
on_notify:
then:
- binary_sensor.template.publish:
id: black_button
state: ON
- binary_sensor.template.publish:
id: black_button
state: OFF
# This entry queries the battery level. Some tags may not
# support this characteristic, you will see 'Unknown' in the
# HA frontend.
- platform: ble_client
type: characteristic
ble_client_id: itag_black
name: "Black iTag Battery"
service_uuid: '180f'
characteristic_uuid: '2a19'
icon: 'mdi:battery'
unit_of_measurement: '%'
# This entry queries polls the RSSI when the tag is connected.
- platform: ble_client
type: rssi
ble_client_id: itag_black
name: "Black iTag RSSI"
Explanation
-----------
The first thing enabled is the ``esp32_ble_tracker`` component. This sets up
the BLE stack on the device and listens for available devices.
Next, the ``ble_client`` component will listen to devices discovered by
the tracker, and establish a connection to the given device when it is
available.
The ``binary_sensor`` provides a template sensor which will export to the
HA frontend the sensor that's switched by the BLE tag's button.
The first entry in the ``sensor`` component is used to configure the specific
Service and Characteristic UUIDs for an iTag's button. It also enables BLE
notifications and sets up an automation to toggle the ``binary_sensor`` when
a notification is received from the tag. Automatic updates are disabled, there
is no point querying the tag for the device state, as we will be immediately
notified when the button is pressed.
The next ``sensor`` entry listens for a well-known Service and Chacteristic
that is used by many BLE devices to give battery level information. This sensor
will be exposed in the HA frontend to determine the state of the tag's battery.
Note that many tags will not provide this service, so you will not see a valid
value. If not, you can remove this from the config.
See Also
--------
- :doc:`/components/ble_client`
- :doc:`/components/sensor/ble_client`
- :ghedit:`Edit`

View File

@ -1,550 +0,0 @@
Brilliant / Mirabella Genio Smart Plugs
=======================================
Brilliant / Mirabella Genio Smart Plugs are a Tuya-based smart plugs sold by Bunnings and Kmart respectively in Australia.
.. figure:: images/brilliant-mirabella-genio-smart-plugs.jpg
:align: center
:width: 50.0%
Originally intended to be used with their companion apps once flashed using `tuya-convert <https://github.com/ct-Open-Source/tuya-convert>`__ ESPHome generated
firmware can be uploaded allowing you to control the smart plugs via Home Assistant.
1. Create the ESPHome Firmware
------------------------------
#. Refer to either :doc:`/guides/getting_started_command_line` or :doc:`/guides/getting_started_hassio` before moving onto the next step.
#. Select a plug configuration below based on the plug/s you have and copy all of the text in the code block and paste into your
``name_of_esphome_configuration.yaml`` file.
#. Compile the firmware, again depending on your chosen setup refer to the guides in the first point.
2. Flashing
-----------
2.1 Prerequisites
*****************
#. Before you begin you'll need one of the following Linux machines running the latest copy of `Raspbian Stretch Lite
<https://www.raspberrypi.org/downloads/raspbian/>`__
a. Raspberry Pi 2B/B+ with `USB WiFi Dongle <https://www.raspberrypi.org/products/raspberry-pi-usb-wifi-dongle/>`__.
b. Raspberry Pi 3B/B+.
.. note::
As per the `tuya-convert documentation <https://github.com/ct-Open-Source/tuya-convert/blob/master/README.md#requirements>`__:
Any Linux with a Wifi adapter which can act as an Access Point should also work. Please note that we have tested the Raspberry Pi with clean installations
only. If you use your Raspberry Pi for anything else, we recommend using another SD card with a clean installation.
#. A microSD card (minimum 2GB, 8GB+ recommended).
#. Any WiFi device which can connect to the SSID generated by the Raspberry Pi and eventually the flashed Tuya device. **This cannot be an iOS / Apple device.
Android devices will work.**
2.2 Installing the OS
*********************
#. It's recommended to read the documentation provided by the Raspberry Pi Foundation on the best way to flash the OS to the microSD card depending on your
platform - `Installing operating system images <https://www.raspberrypi.org/documentation/installation/installing-images/>`__.
#. After you've flashed the microSD card browse to the "boot" partition and add a blank file called "ssh" **(without any extension)** which will enable the
SSH server upon first boot, extended information on this step can be found `here
<https://www.raspberrypi.org/documentation/remote-access/ssh/README.md#3-enable-ssh-on-a-headless-raspberry-pi-add-file-to-sd-card-on-another-machine>`__.
#. Plug the microSD card into the Raspberry Pi, connect network cable and power, the Raspberry Pi will start to boot.
2.3 Connecting to the Pi via SSH
********************************
#. Download and install `Putty <https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html>`__.
#. Open Putty.
#. Enter the IP of Raspberry Pi in the box that says "Host Name", leaving the port set to 22 (default for SSH). A list of recommended ways can be found `here
<https://www.raspberrypi.org/documentation/remote-access/ip-address.md>`__, but the easiest is to download and use `Fing <https://www.fing.com/>`__
(`Android <https://play.google.com/store/apps/details?id=com.overlook.android.fing&hl=en_GB>`__ / `iOS
<https://itunes.apple.com/us/app/fing-network-scanner/id430921107?mt=8>`__).
#. In the "Saved Sessions" input box, name the Raspberry Pi connection and then press "Save".
#. Select your new saved session from the list.
#. Press "Open".
2.4 Configuring the Pi
**********************
#. In the putty window login with the **pi** as the user and **raspberry** for the password.
#. Type ``sudo apt-get update && sudo apt-get dist-upgrade -y`` and wait for the upgrades to install.
#. Type ``sudo apt-get install git`` and wait for it to install.
2.5 Setup and Install tuya-convert
**********************************
#. In the putty window type ``git clone https://github.com/ct-Open-Source/tuya-convert`` press enter and wait while the repository is cloned.
#. Type ``cd tuya-convert`` and press enter.
#. Type ``./install_prereq.sh`` press enter and wait as the script gathers all the required components needed to function.
2.6 Upload ESPHome Firmware using SFTP
**************************************
#. Download `FileZilla <https://filezilla-project.org/download.php?type=client>`__ or `WinSCP <https://winscp.net/eng/index.php>`__ or use your preferred FTP
client.
#. Depending on the program you need to connect to the Pi using the IP address as the hostname and the username and password the same as you used to connect
via SSH and ensure your connection type is set to **SFTP**
#. Browse to ``/root/tuya-convert/files``.
#. Upload your compiled ``firmware.bin`` file to this directory. For command line based installs you can access the file under
``<CONFIG_DIR>/<NODE_NAME>/.pioenvs/<NODE_NAME>/firmware.bin`` alternatively Home Assistant add-on users can download the file directly from the web ui.
2.7 Use tuya-convert to install ESPHome Firmware
************************************************
#. Type ``./start_flash.sh``
#. Type ``yes`` to accept the warning.
#. Connect your alternative WiFi device (non iOS / Apple based) to the ``vtrust-flash`` SSID using ``flashmeifyoucan`` as the password. This is the network
being broadcast by the Pi from the tuya flash script.
#. If you haven't already connect your smart plug and turn it on. It should automatically enter pairing mode, if it doesn't follow the instructions below:
* Brilliant `(PDF Manual) <https://www.brilliantsmart.com.au/wp-content/uploads/2019/02/03.-How-to-setup-the-Smart-plug.pdf>`__
* To connect the Smart WiFi Plug to your WiFi press and hold the manual control button for about 5 seconds until you hear a click. Let go of the button
as soon as you hear the **click**. Then press button once again to activate blinking. **The red indicator light should now blink rapidly (2 times per
second)**.
* Mirabella `(PDF Manual) <https://img1.wsimg.com/blobby/go/67cdd3b9-3600-4104-b097-603c05201237/downloads/1cq5h6nt7_336441.pdf>`__
* To do this, ensure your plug is on (the indicator light should be blue), hold the power button down for 5 seconds until you hear a click, let go of the
power button and then press the button once to activate.
#. Press enter on your putty window to start the flash process and wait. If the connection is successful you should see a large amount of scrolling text, this
is the script backing up the factory shipped firmware.
#. Once the process is complete you can type ``curl http://10.42.42.42/flashURL?url=http://10.42.42.1/files/firmware.bin``
#. The plug will restart and if everything is working correctly after a few seconds you should be able to press the button triggering the relay and turning the
blue led on.
3. Smart Plug Configurations
----------------------------
Thanks to the existing work by `@ideasman69 <https://github.com/ct-Open-Source/tuya-convert/issues/66>`__ and
`afalzon <https://github.com/arendst/Sonoff-Tasmota/wiki/Mirabella-Genio-Smart-Plug>`__
which these adaptions created by `@cryptelli <https://community.home-assistant.io/u/cryptelli>`__ are based on.
3.1 Brilliant Smart Plug
************************
.. code-block:: yaml
substitutions:
name: brilliant_smart_plug
friendly_name: Brilliant Smart Plug
esphome:
name: ${name}
esp8266:
board: esp01_1m
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
logger:
api:
ota:
binary_sensor:
- platform: gpio
pin:
number: 14
mode:
input: true
pullup: true
inverted: true
name: "${friendly_name} Power Button"
on_press:
- switch.toggle: relay
switch:
- platform: gpio
id: red_led
pin:
number: GPIO12
inverted: true
- platform: gpio
name: "${friendly_name}"
pin: GPIO5
id: relay
# Turn off red LED to show blue when turned on
on_turn_on:
- switch.turn_off: red_led
# Turns on the red LED once the plug is turned off. Stock plug doesn't do this, to restore normal behavior remove the on_turn_on and on_turn_off
# blocks.
on_turn_off:
- switch.turn_on: red_led
3.2 Mirabella Genio Wi-Fi 1 USB Adaptor
***************************************
.. code-block:: yaml
substitutions:
name: mirabella_genio_smart_plug
friendly_name: Mirabella Genio Smart Plug
esphome:
name: ${name}
esp8266:
board: esp01_1m
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
logger:
api:
ota:
binary_sensor:
- platform: gpio
pin:
number: GPIO13
mode:
input: true
pullup: true
inverted: true
name: "${friendly_name} Button"
on_press:
- switch.toggle: relay
switch:
- platform: gpio
id: red_led
pin:
number: GPIO4
inverted: true
- platform: gpio
name: "${friendly_name}"
pin: GPIO12
id: relay
# Turn on red LED
on_turn_on:
- switch.turn_on: red_led
# Turns off red LED
on_turn_off:
- switch.turn_off: red_led
3.3 Gosund SP1
**************
.. code-block:: yaml
substitutions:
name: gosund_sp1_smart_plug
friendly_name: Gosund SP1
esphome:
name: gosund_sp1_smart_plug
esp8266:
board: esp8285
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
logger:
api:
ota:
binary_sensor:
- platform: gpio
pin:
number: GPIO3
inverted: true
name: "Power Button"
on_press:
- switch.toggle: relay
switch:
- platform: gpio
id: led
pin: GPIO1
- platform: gpio
name: "Gosund SP1 Smart Plug"
pin: GPIO14
id: relay
on_turn_on:
- switch.turn_on: led
on_turn_off:
- switch.turn_off: led
sensor:
- platform: hlw8012
sel_pin:
number: GPIO12
inverted: true
cf_pin: GPIO04
cf1_pin: GPIO05
current_resistor: 0.00221
voltage_divider: 871
current:
name: "Gosund SP1 Smart Plug current"
unit_of_measurement: A
voltage:
name: "Gosund SP1 Smart Plug Voltage"
unit_of_measurement: V
power:
name: "Gosund SP1 Smart Plug Wattage"
unit_of_measurement: W
id: "energy_temp_Wattage"
change_mode_every: 8
update_interval: 10s
Check the following page for calibrating the measurements: :ref:`sensor-filter-calibrate_linear`.
3.4 Topersun WL-SC01 Smart Plug
*******************************
.. code-block:: yaml
substitutions:
name: topersun_smart_plug
friendly_name: Topersun Smart Plug
esphome:
name: ${name}
esp8266:
board: esp01_1m
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
logger:
api:
ota:
binary_sensor:
- platform: gpio
pin:
number: 14
mode:
input: true
pullup: true
inverted: true
name: "${friendly_name} Power Button"
on_press:
- switch.toggle: relay
switch:
- platform: gpio
id: green_led
pin:
number: GPIO4
inverted: true
- platform: gpio
name: "friendly_name Relay"
pin: GPIO12
id: relay
# Turn off green LED to show red when turned on.
on_turn_on:
- switch.turn_off: green_led
# Turns on the green LED once the plug is turned off.
on_turn_off:
- switch.turn_on: green_led
3.5 NEO Coolcam wifi smart plug
*******************************
.. code-block:: yaml
substitutions:
name: coolcam_plug1
friendly_name: Coolcam Smart Plug
# Higher value gives lower watt readout
current_res: "0.00221"
# Lower value gives lower voltage readout
voltage_div: "800"
esphome:
name: ${name}
esp8266:
board: esp8285
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
logger:
api:
ota:
binary_sensor:
- platform: gpio
pin:
number: GPIO0
inverted: true
name: "${friendly_name} Button"
on_press:
- switch.toggle: relay
switch:
- platform: gpio
name: "${friendly_name} LED Red"
pin: GPIO13
inverted: true
restore_mode: ALWAYS_OFF
id: red_led
- platform: gpio
name: "${friendly_name} Relay"
pin: GPIO14
restore_mode: ALWAYS_ON
id: relay
on_turn_on:
- switch.turn_on: red_led
on_turn_off:
- switch.turn_off: red_led
sensor:
- platform: hlw8012
sel_pin:
number: GPIO12
inverted: true
cf_pin: GPIO04
cf1_pin: GPIO05
current_resistor: ${current_res}
voltage_divider: ${voltage_div}
current:
name: "${friendly_name} Amperage"
unit_of_measurement: A
voltage:
name: "${friendly_name} Voltage"
unit_of_measurement: V
power:
name: "${friendly_name} Power"
unit_of_measurement: W
id: power_sensor
change_mode_every: 8
update_interval: 10s
- platform: total_daily_energy
name: "${friendly_name} Total Daily Energy"
power_id: power_sensor
filters:
# Multiplication factor from W to kW is 0.001
- multiply: 0.001
unit_of_measurement: kWh
3.6 Arlec Grid Connect Smart Plug In Socket With 2.1A USB Charger
*****************************************************************
.. code-block:: yaml
substitutions:
name: arlec_pc389ha_001
friendly_name: Arlec Smart Plug
esphome:
name: ${name}
esp8266:
board: esp01_1m
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap: {}
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
binary_sensor:
- platform: gpio
pin:
number: 14
mode:
input: true
pullup: true
inverted: true
name: "${friendly_name} Button"
on_press:
- switch.toggle: relay
switch:
- platform: gpio
id: blue_led
pin:
number: GPIO4
inverted: true
- platform: gpio
id: red_led
pin:
number: GPIO13
inverted: true
- platform: gpio
name: "${friendly_name} Power"
pin: GPIO12
id: relay
on_turn_on:
# Turn off blue LED to show blue when turned on
- switch.turn_off: red_led
- switch.turn_on: blue_led
on_turn_off:
# Turns on the blue LED once the plug is turned off
- switch.turn_off: blue_led
- switch.turn_on: red_led
4. Adding to Home Assistant
---------------------------
You can now add your smart plug to home assistant via the configurations page, look for 'ESPHome' under the Integrations option and click 'Configure'.
.. figure:: images/brilliant-mirabella-genio-smart-plugs-homeassistant.jpg
:align: center
:width: 50.0%
See Also
--------
- :doc:`/components/switch/index`
- :doc:`/components/binary_sensor/index`
- :doc:`/components/light/index`
- :doc:`/components/light/monochromatic`
- :doc:`/components/output/index`
- :doc:`/components/output/esp8266_pwm`
- :doc:`/guides/automations`
- :ghedit:`Edit`

View File

@ -1,89 +0,0 @@
BRUH Multisensor
================
.. seo::
:description: Instructions for re-creating a BRUH multisensor using ESPHome.
:image: bruh.png
The BRUH Multisensor is a great introductory project into Home Automation with an
amazing setup tutorial. And fortunately ESPHome has complete support for all the
stuff used by the Multisensor 🎉
.. raw:: html
<iframe width="560" height="315" src="https://www.youtube.com/embed/jpjfVc-9IrQ" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
Thank you very much to `@jackjohnsonuk <https://github.com/jackjohnsonuk>`__ for providing this
configuration file 😀
.. code-block:: yaml
esphome:
name: <NODE_NAME>
esp8266:
board: nodemcuv2
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
api:
# Enable logging
logger:
ota:
sensor:
- platform: dht
pin: D7
temperature:
name: "Multisensor Temperature"
humidity:
name: "Multisensor Humidity"
- platform: adc
pin: A0
name: "Multisensor Brightness"
unit_of_measurement: lux
filters:
- lambda: |-
return (x / 10000.0) * 2000000.0;
binary_sensor:
- platform: gpio
pin: D5
name: "Multisensor Motion"
device_class: motion
output:
- platform: esp8266_pwm
pin: D1
id: redgpio
- platform: esp8266_pwm
pin: D2
id: greengpio
- platform: esp8266_pwm
pin: D3
id: bluegpio
light:
- platform: rgb
name: "Multisensor Light"
red: redgpio
green: greengpio
blue: bluegpio
See Also
--------
- :doc:`/devices/nodemcu_esp8266`
- :doc:`pir`
- :doc:`temt6000`
- :doc:`/components/light/rgb`
- :doc:`/components/output/esp8266_pwm`
- :doc:`/components/sensor/dht`
- :doc:`/components/sensor/adc`
- :doc:`/components/binary_sensor/gpio`
- :ghedit:`Edit`

View File

@ -29,7 +29,7 @@ Documentation:
- `Second discussion in the homeassistant community <https://community.home-assistant.io/t/a-simple-diy-status-display-with-an-8x32-rgb-led/379051>`__
- `Optional notify component <https://github.com/lubeda/EHMTX_custom_component>`__
`sample YAML configuration for ESP32 <https://raw.githubusercontent.com/lubeda/EsphoMaTrix/main/ehmtx32.yaml>`__
`YAML configuration example for ESP32 <https://github.com/lubeda/EsphoMaTrix/blob/main/UlanziTC001.yaml>`__.
Sample video:

View File

@ -1,124 +0,0 @@
Etekcity Voltson (ESW01-EU)
===========================
.. seo::
:description: Configure an Etekcity Voltson and calculate the missing current sensor
:image: esw01-eu.jpg
:keywords: Etekcity, Voltson, ESW01, ESW01-EU, HLW8012, Home Assistant, ESPHome
The Etekcity Voltson brings a 10A relay, two LEDs (blue and yellow), a push button and a :doc:`/components/sensor/hlw8012`
in a very small package and at a reasonable price.
.. note::
There are quite a few hardware revisions out there. Also reginal versions like US, UK and EU are different.
Flashing
--------
Opening the case for flashing varies a lot for different hardware revisions. Mine was easy as it had two tiny T5 Torx screws in the front and four Philipps screws inside.
Once you have opened the case, remove the PCB from it and attach your TTL as follows:
5V and GND go to the bottom:
.. figure:: images/esw01-eu-pcb-bottom.jpg
:align: center
:width: 75.0%
On the opposite side, T12 is TX, T13 is RX. During boot you need to connect T11 and T16 pads to GND. Easiest is to flash with pogo pins.
.. figure:: images/esw01-eu-pcb-top.jpg
:align: center
:width: 75.0%
Configuration
-------------
As the Voltson has its SEL pin permanently pulled high, we are unable to switch from voltage measurement to current measurement.
This will be circumvented by defining the initial mode to be voltage measurement (see :doc:`/components/sensor/hlw8012` documentation)
and calculating the current with `Ohm's law <https://en.wikipedia.org/wiki/Ohm%27s_law>`_: ``P (watts) = V (volts) x I (amps)``
.. code-block:: yaml
esphome:
name: voltson
esp8266:
board: esp01_1m
### you wifi and other settings here ###
### pins ###
# D1 GPIO5 | LED blue | status_led
# D0 GPIO16 | LED yellow | led1
# D5 GPIO14 | SW1 | button1
# D2 GPIO4 | REL1 | relay1
# D6 GPIO12 | HLW8012/CF1 | cf1_pin
# D7 GPIO13 | HLW8012/CF | cf_pin
status_led:
pin:
number: GPIO5
output:
- platform: gpio
id: relay1
pin: GPIO4
- platform: gpio
id: led1
pin: GPIO16
switch:
- platform: output
name: "Voltson Relay"
id: switch1
output: relay1
on_turn_on:
- output.turn_on: led1
on_turn_off:
- output.turn_off: led1
binary_sensor:
- platform: gpio
id: button1
pin:
number: GPIO14
mode:
input: true
pullup: true
inverted: true
on_press:
- switch.toggle: switch1
sensor:
- platform: hlw8012
sel_pin: 0 # not connected
cf_pin: GPIO13
cf1_pin: GPIO12
voltage:
id: hlw8012_voltage
name: "HLW8012 Voltage"
power:
id: hlw8012_power
name: "HLW8012 Power"
on_value:
- sensor.template.publish:
id: hlw8012_current_calculated
state: !lambda 'return id(hlw8012_power).state / id(hlw8012_voltage).state;'
update_interval: 10s
initial_mode: VOLTAGE
change_mode_every: 4294967295 # basically never
- platform: template
id: hlw8012_current_calculated
name: "HLW8012 Current (calculated)"
unit_of_measurement: A
accuracy_decimals: 2
See Also
--------
- :doc:`/components/sensor/hlw8012`
- :ghedit:`Edit`

View File

@ -1,80 +0,0 @@
Geiger counter RadiationD v1.1 (CAJOE)
======================================
.. seo::
:description: Instructions for setting up RadiationD v1.1(CAJOE) sensor in ESPHome and calculate the current radation level.
:image: radiationD-v1-1-cajoe_small.jpg
:keywords: Radiation Geiger counter
With the help of :doc:`/components/sensor/pulse_counter` and the RadiationD v1.1(CAJOE) you can make your own Geiger counter, which will give you
a more or less precise messurement of the current radation level. But it should be good enough to warn you about critical events.
Assembly:
---------
.. figure:: images/radiationD-v1-1-cajoe_small.jpg
:align: center
:width: 100.0%
The first step is to connect the sensor.
You just need to connect the +5V, the ground and a GPIO pin to the ESP.
In my case I used the pin 34 for the signal. (The print on the PCB is wrong VIN is the signal.)
This setup should give you the pulse of each messurement or count. For more information check the Video of `Andreas Spiess <https://www.youtube.com/watch?v=K28Az3-gV7E>`__.
Housing:
*********
I just 3D printed an small housing the avoid touching the high voltage Geiger Mueller tube.
`Counter Tube Case <https://www.thingiverse.com/thing:5425224>`__
(The tube should not be in direct sunlight. So maybe you will need another case.)
Configuration:
---------------
The block :doc:`/components/sensor/pulse_counter` will count the radation events per minute.
With the found specs of the tube you will be able to calculate the radiation in μSv/h.
It's just the counts per minute (CPM) times the factor of your Geiger Mueller tube you're using. It should be the J305ß, which comes with the PCB.
(To make sure - check your printing on the tube)
μSv/h = (CPM - Tube noise) * Factor
According to the video of `Andreas Spiess <https://www.youtube.com/watch?v=K28Az3-gV7E>`__ the tube should have about 12 CPM as background noise.
.. note::
The current version of the pack comes with the J305ß Geiger tube which detectes Beta and Gamma radiation. Specifications:
Manufacturer: North Optic Radiation Detection: β, γ Length: 111mm Diameter: 11mm Recommended Voltage: 350V Plateau Voltage: 360-440V
Sensitivy γ (60Co): 65cps/(μR/s)
Sensitivy γ (equivalent Sievert): 108cpm / (μSv/h)
Max cpm: 30000
cps/mR/h: 18
cpm/m/h: 1080
cpm/μSv/h: 123.147092360319
Factor: 0.00812037037037
`Source: opengeiger.de/LibeliumDoku.pdf <http://www.opengeiger.de/LibeliumDoku.pdf>`__.
.. code-block:: yaml
sensor:
- platform: pulse_counter
pin: 34
name: "Radiation"
unit_of_measurement: 'μSv/h'
count_mode:
rising_edge: DISABLE
falling_edge: INCREMENT
filters:
- offset: -12.0 # J305ß Geiger Mueller tube background noise 0.2 pulses / sec x 60 sec = 12 CPM (Counts per Minute)
- multiply: 0.00812037037037 # Factor: 0.00812037037037
See Also
--------
- :doc:`/components/sensor/pulse_counter`
- :ghedit:`Edit`

View File

@ -1,121 +0,0 @@
H801 RGBW LED controller
========================
The H801 is pretty affordable and easy to hack and adapt to your needs. It can be found on `AliExpress <https://s.click.aliexpress.com/e/bbnUDBZW>`__
`Here <http://tinkerman.cat/closer-look-h801-led-wifi-controller/>`__ is an article about the
hardware for those who have an interest for more details about the board.
It can be used as a RGB, RGBW, RGB dual white or even control 5 individual monochromatic strips if you want or combinations of these.
.. figure:: images/h801.jpg
:align: center
:width: 80.0%
For ESPHome, you can then use the :doc:`RGBW </components/light/rgbw>`
and the :doc:`ESP8266 Software PWM output </components/output/esp8266_pwm>` components using below configuration:
.. code-block:: yaml
esphome:
name: h801light
esp8266:
board: esp01_1m
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
logger:
api:
ota:
output:
- platform: esp8266_pwm
pin: 12
frequency: 1000 Hz
id: pwm_b
- platform: esp8266_pwm
pin: 13
frequency: 1000 Hz
id: pwm_g
- platform: esp8266_pwm
pin: 15
frequency: 1000 Hz
id: pwm_r
- platform: esp8266_pwm
pin: 14
frequency: 1000 Hz
id: pwm_w
light:
- platform: rgbw
name: "H801 Light"
red: pwm_r
green: pwm_g
blue: pwm_b
white: pwm_w
Make your node in the ESPHome dashboard and compile/upload it.
(if it fails OTA it must be uploaded manually with your favorite ESP flasher,
e.g. :ref:`esphome-flasher <esphome-flasher>`)
.. figure:: images/gpio.jpg
:align: center
:width: 80.0%
Front side of board with pins soldered on
.. figure:: images/back.jpg
:align: center
:width: 80.0%
Back side of the board (don't melt the blue and red wire when soldering)
.. figure:: images/rgbwarm.jpg
:align: center
:width: 80.0%
This LED strip can be used with the sketch as-is
.. figure:: images/rgbw.jpg
:align: center
:width: 80.0%
For this type of led strip you have to swap the white and blue GPIO numbers in the sketch.
You will need to solder pins to the board inside the H801 (fortunately it's pretty roomy and
not a lot of components or stuff in the way apart from the 2 wires on the back).
3.3V, GND, TX and RX (RX to RX and TX to TX) needs to be connected to your serial adapter, the
two other pins must be shorted throughout the flashing process by a jumper or a breadboard cable.
(Remember to remove it after flashing)
Add A PIR(Motion) Sensor
------------------------
It's possible to use the header that was soldered on for flashing as an input.
The example below uses the TX pin as a PIR motion sensor input:
.. figure:: images/h801-pir_sensor.jpg
:align: center
:width: 80.0%
H801 shown with PIR connected to header pins
The following can be appended to the YAML file for your H801 to configure the TX pin as a motion
sensor input.
.. code-block:: yaml
binary_sensor:
- platform: gpio
pin: GPIO3
name: "GPIO3-TX Motion"
device_class: motion
See Also
--------
- :doc:`/components/light/rgbw`
- :doc:`/components/output/esp8266_pwm`
- :ghedit:`Edit`

View File

@ -1,65 +0,0 @@
.. seo::
:description: IAQ (Indoor Air Quality) Board
:image: iaq_board2.jpg
:keywords: IAQ Board
IAQ (Indoor Air Quality) Board
==============================
.. figure:: images/iaq_board2.jpg
:align: center
:width: 100.0%
IAQ Board is a DIY device for measuring internal air quality running with esphome. It's quite small and is based on a custom PCB where part of the components are soldered and connected.
Here is what it can measure:
- **Temperature / Humidity / Pressure**
- **Air particles PM1, PM2.5, PM10**
- **Carbon Dioxide with NDIR sensor**
- **Air Quality Index by EPA, based on 24h average PM2.5 particles**
- **Ambient light**
- **Total VOC (volatile organic compound)**
- **equivalent CO2 (not very correct compared with the NDIR sensor, but it's provided by the VOC sensor)**
On top of that:
- **At least one OLED display to show the data (can have one more on the top of the MCU board)**
- **three RGB wide angle LEDs with auto brightness. LED1 indicates PM2.5, LED2 - Air quality index, LED3 - CO2.**
- **auto night dimming of the displays and LEDs (can be disabled)**
- **MIN/MAX values of Temperature, PM2.5 and CO2, and 24h average PM2.5 value.**
- **multi function button for selection of the data to show on the display**
ESPHome Configuration
---------------------
Full documentation (PCB, Schematic, esphome yaml config) is published here: `https://github.com/nkitanov/iaq_board <https://github.com/nkitanov/iaq_board>`__
YAML configuration is about 700 lines and can be downloaded from here: `iaq_board.yaml <https://github.com/nkitanov/iaq_board/blob/master/firmware/iaq_board.yaml>`__
.. figure:: images/iaq_board1.jpg
:align: center
:width: 100.0%
.. raw:: html
<iframe width="560" height="315" src="https://www.youtube.com/embed/X75OGs2TTT8" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
See Also
--------
- :doc:`/devices/nodemcu_esp8266`
- :doc:`/components/display/ssd1306`
- :doc:`/components/sensor/bme280`
- :doc:`/components/sensor/ee895`
- :doc:`/components/sensor/pmsx003`
- :doc:`/components/sensor/mhz19`
- :doc:`/components/sensor/sgp30`
- :doc:`/components/sensor/sgp4x`
- :doc:`/components/sensor/tsl2561`
- :doc:`/components/binary_sensor/gpio`
- :doc:`/components/sensor/template`
- :doc:`/components/light/neopixelbus`
- :doc:`/guides/automations`
- :doc:`/components/i2c`
- :doc:`/components/uart`
- :ghedit:`Edit`

View File

@ -1,214 +0,0 @@
Sonoff iFan02
=============
.. seo::
:description: Instructions for using Sonoff ifan02 in ESPHome.
:keywords: Fan, Sonoff, ifan02
:image: fan.svg
Sonoff iFan02 is a driver for ceiling fans with lights.
By replacing the old driver with iFan02, your non-smart led ceiling fan will be converted to a smart ceiling fan.
For more information see `iFan02 <https://www.itead.cc/sonoff-ifan02-wifi-smart-ceiling-fan-with-light.html>`__
This configuration will expose a :doc:`/components/light/binary` and a :doc:`/components/fan/speed`.
To get this working in ESPHome you first need to create a :doc:`/components/output/custom` to control the iFan02.
Create an ifan02.h file:
.. code-block:: c++
#include "esphome.h"
using namespace esphome;
class IFan02Output : public Component, public FloatOutput {
public:
void write_state(float state) override {
if (state < 0.3) {
// OFF
digitalWrite(5, LOW);
digitalWrite(4, LOW);
digitalWrite(15, LOW);
} else if (state < 0.6) {
// low speed
digitalWrite(5, HIGH);
digitalWrite(4, LOW);
digitalWrite(15, LOW);
} else if (state < 0.9) {
// medium speed
digitalWrite(5, HIGH);
digitalWrite(4, HIGH);
digitalWrite(15, LOW);
} else {
// high speed
digitalWrite(5, HIGH);
digitalWrite(4, LOW);
digitalWrite(15, HIGH);
}
}
};
Then you need to set it up with yaml.
.. code-block:: yaml
esphome:
name: ifan02
includes:
- ifan02.h
on_boot:
priority: 225
# turn off the light as early as possible
then:
- light.turn_off: ifan02_light
esp8266:
board: esp8285
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
api:
logger:
ota:
binary_sensor:
- platform: gpio
id: vbutton_light
pin:
number: GPIO0
inverted: true
on_press:
then:
- light.toggle: ifan02_light
- platform: gpio
id: vbutton_relay_1
pin:
number: GPIO9
inverted: true
on_press:
then:
- switch.toggle: fan_relay1
- switch.turn_on: update_fan_speed
- platform: gpio
id: vbutton_relay_2
pin:
number: GPIO10
inverted: true
on_press:
then:
- switch.toggle: fan_relay2
- switch.turn_on: update_fan_speed
- platform: gpio
id: vbutton_relay_3
pin:
number: GPIO14
inverted: true
on_press:
then:
- switch.toggle: fan_relay3
- switch.turn_on: update_fan_speed
output:
- platform: custom
type: float
outputs:
id: fanoutput
lambda: |-
auto ifan02_fan = new IFan02Output();
App.register_component(ifan02_fan);
return {ifan02_fan};
- platform: gpio
pin: GPIO12
id: light_output
light:
- platform: binary
name: "iFan02 Light"
output: light_output
id: ifan02_light
switch:
- platform: template
id: update_fan_speed
optimistic: true
turn_on_action:
then:
- delay: 200ms
- if:
condition:
and:
- switch.is_off: fan_relay1
- switch.is_off: fan_relay2
- switch.is_off: fan_relay3
then:
- fan.turn_off: ifan02_fan
- if:
condition:
and:
- switch.is_on: fan_relay1
- switch.is_off: fan_relay2
- switch.is_off: fan_relay3
then:
- fan.turn_on:
id: ifan02_fan
speed: 1
- if:
condition:
and:
- switch.is_on: fan_relay1
- switch.is_on: fan_relay2
- switch.is_off: fan_relay3
then:
- fan.turn_on:
id: ifan02_fan
speed: 2
- if:
condition:
and:
- switch.is_on: fan_relay1
- switch.is_off: fan_relay2
- switch.is_on: fan_relay3
then:
- fan.turn_on:
id: ifan02_fan
speed: 3
- switch.turn_off: update_fan_speed
- platform: gpio
pin: GPIO5
id: fan_relay1
- platform: gpio
pin: GPIO4
id: fan_relay2
- platform: gpio
pin: GPIO15
id: fan_relay3
fan:
- platform: speed
output: fanoutput
id: ifan02_fan
speed_count: 3
name: "iFan02 Fan"
See Also
--------
- :doc:`/components/light/index`
- :doc:`/components/light/binary`
- :doc:`/components/fan/index`
- :doc:`/components/fan/speed`
- :doc:`/components/output/index`
- :doc:`/components/output/custom`
- :doc:`/guides/automations`
- :ghedit:`Edit`

View File

@ -1,105 +0,0 @@
Ilonda Wifi Smart Fish Feeder (L88)
===================================
Ilonda Wifi Smart Fish Feeder (L88) is a Tuya-based device sold by Amazon (not only under Ilonda, but also under other brand names).
.. figure:: images/ilonda-wifi-smart-fish-feeder.jpg
:align: center
:width: 50.0%
Originally intended to be used with its companion app, once flashed using `tuya-convert <https://github.com/ct-Open-Source/tuya-convert>`__, ESPHome generated
firmware can be uploaded allowing you to control the Wifi Smart Fish Feeder via Home Assistant.
Wifi Smart Fish Feeder Configuration
------------------------------------
Thanks to the amazing `Tasmota template <https://templates.blakadder.com/ilonda_L88.html>`__,
managed to build a fully working esphome configuration. This assumes you have a secret.yaml with ssid and password keys.
.. code-block:: yaml
esphome:
name: wifi_smart_fish_feeder
esp8266:
board: esp01_1m
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
logger:
api:
ota:
# Binary Sensor to allow relay to be switched when physical button is pressed
binary_sensor:
- platform: gpio
id: button
pin:
number: GPIO4
mode:
input: true
pullup: true
inverted: True
name: 'Switch feeder'
on_press:
- switch.turn_on: relay
- platform: status
name: "Status"
switch:
# Switch to turn feeder on for 3 seconds/off and turn on/off LED
- platform: gpio
name: 'Relay feeder'
id: relay
pin: GPIO14
on_turn_on:
- light.turn_on: led
- delay: 3s
- switch.turn_off: relay
- light.turn_off: led
restore_mode: ALWAYS_OFF
sensor:
# Feeder counter
- platform: pulse_meter
pin: GPIO12
name: 'Counter/min'
unit_of_measurement: 'time(s)'
internal: true
total:
unit_of_measurement: 'time(s)'
name: 'Counter feeder'
# To allow led to be controlled via GPIO
output:
- platform: esp8266_pwm
id: blue_led
pin:
number: GPIO5
inverted: true
# LED control
light:
- platform: monochromatic
output: blue_led
id: led
You can now add your Wifi Smart Fish Feeder to Home Assistant via the configurations page, look for 'ESPHome' under the Integrations option and click 'Configure'.
See Also
--------
- :doc:`/components/binary_sensor/gpio`
- :doc:`/components/switch/gpio`
- :doc:`/components/sensor/pulse_meter`
- :doc:`/components/output/esp8266_pwm`
- :doc:`/components/light/monochromatic`
- :doc:`/guides/automations`
- `Fish Feeder diagrams and pictures <https://community.openhab.org/t/ilonda-fish-feeder-openhab/99190>`__.
- :ghedit:`Edit`

Binary file not shown.

Before

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 370 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 269 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 402 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 225 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 472 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

View File

@ -1,141 +0,0 @@
IWOOLE Table Lamp
===================================
.. seo::
:description: Instructions for flashing and configuring IWOOLE Table Lamps.
The IWOOLE Table Lamp is a RGBW lamp normally configured using the Tuya Smart App.
It is available from various retailers online or directly from `iwoole.com <https://www.iwoole.com/product/category/wifi-smart-table-lamp/>`__.
.. figure:: images/iwoole_rgbw_table_lamp.png
:align: center
:width: 50.0%
1. Device overview
==================
.. note::
The following information relates to the desk model depicted above. A free-standing version and a desk version with a longer arm are available. They are likely to share the same internals and configuration, but I can not be certain.
My device had no external markings at all.
The device is a basic 4-channel PWM RGBW light in a simple elegant housing.
The LEDs are not individually addressable.
No other sensors, outputs or status LEDs are available.
The MOSFETs for the different color channels are connected as follows:
- GPIO04: White
- GPIO12: Green
- GPIO13: Blue
- GPIO14: Red
1.1 Internal markings
----------------------
.. figure:: images/iwoole_rgbw_table_lamp_internal_1.jpg
:align: center
:width: 40.0%
.. figure:: images/iwoole_rgbw_table_lamp_internal_2.jpg
:align: center
:width: 40.0%
.. figure:: images/iwoole_rgbw_table_lamp_internal_3.jpg
:align: center
:width: 40.0%
2. ESPHome configuration
========================
Since there is only one RGBW light to configure the .yaml file is fairly straightforward.
Alternatively, you could configure each channel as a separate light if desired.
I prefer to use the :ref:`color-interlock <rgbw_color_interlock>` option along with the configuration below.
2.1 Example configuration
-------------------------
.. code-block:: yaml
esphome:
name: "IWOOLE Table Lamp"
#ESP type is ESP8266EX with 1MB flash
esp8266:
board: esp01_1m
# Insert wifi and api configuration here
# Configuration for IWOOLE PWM light
light:
- platform: rgbw
name: "Light"
red: output_red
green: output_green
blue: output_blue
white: output_white
output:
- platform: esp8266_pwm
id: output_red
pin: GPIO14
- platform: esp8266_pwm
id: output_green
pin: GPIO12
- platform: esp8266_pwm
id: output_blue
pin: GPIO13
- platform: esp8266_pwm
id: output_white
pin: GPIO4
3. Flashing
===========
.. warning::
The circuit inside will be exposed to mains voltage. Do not connect your device to the mains when flashing. Flashing this device via a serial connection will involve precarious soldering and cutting through insulating heat-shrink tubing which will have to be replaced.
If you are uncomfortable with this, or are not confident around mains voltage, do not attempt to do this! Using the Tuya-convert method is preferred.
1. Disconnect the device from mains voltage!
2. Open the device. The plastic and aluminum halves can be separated by twisting the plastic part counter-clockwise. If you're okay with a few scuffs you can also use a screwdriver (or a spudger) to separate the two halves.
3. Remove the two screws holding the round plate with the LEDs. It is connected to the main PCB with a little cable. Make note of the orientation of this connection to ensure you reconnect it correctly later.
4. Carefully remove the heat-shrink tubing around the two main PCBs.
5. Like any ESP device, to flash this chip using serial you'll need 3V3, GND, RX, TX and GPIO0
.. figure:: images/iwoole_rgbw_table_lamp_connections_top.jpg
:align: left
:width: 60.0%
There are pads available for 3V3 and GPIO0 on the back. I have tried to find easier solder points on the front, marked in the image above.
Be aware that the pin labeled VCC does not carry 3V3, but 24V DC. If, for any reason, you wanted to connect any other sensor or component, the exposed pin for GPIO5 can be used, in addition to RX (GPIO3) and TX (GPIO1).
.. figure:: images/iwoole_rgbw_table_lamp_connections_bottom.jpg
:align: left
:width: 60.0%
I have made the following connections, I used the pad for GPIO0 because I did not know of the other connection point yet.
.. figure:: images/iwoole_rgbw_table_lamp_wires_top.jpg
:align: left
:width: 60.0%
.. figure:: images/iwoole_rgbw_table_lamp_wires_bottom.jpg
:align: left
:width: 60.0%
6. Flash the chip as you would with any other, using `ESPHome-Flasher <https://github.com/esphome/esphome-flasher>`__ or any other tool of your choosing. While this is not meant as a tutorial on flashing ESP chips, some general hints:
- Always double-check your connections, and don't change any when the ESP is powered. I fried one of these mood lights this way.
- Ensure GPIO0 is connected to ground to get the device into programming mode, but also don't forget to disconnect this when you expect the device to start in normal mode.
- When working with a breadboard, an FTDI adapter and jumper wires, it is very easy for something to become disconnected. Try to use as few wires as possible.
7. Re-apply some heat-shrink tubing or cover the PCBs in electrical tape. Make sure none of the traces or solder joints are exposed anymore. Re-connect the LEDs (see cable orientation in one of the images above).
8. Screw down the plate with LEDs and close the device.
See Also
========
- :doc:`/components/light/index`
- :doc:`/components/light/rgbw`
- :doc:`/components/output/index`
- :doc:`/components/output/esp8266_pwm`
- :ghedit:`Edit`

306
cookbook/lambda_magic.rst Normal file
View File

@ -0,0 +1,306 @@
Lambda Magic
============
.. seo::
:description: Recipes for various interesting things you can do with Lambdas in ESPHome
:image: language-cpp.svg
Here are a couple recipes for various interesting things you can do with :ref:`Lambdas <config-lambda>` in ESPHome.
These things don't need external or custom components, and show how powerful :ref:`Lambda <config-lambda>` usage can be.
.. _lambda_magic_pages:
Display pages alternative
-------------------------
Some displays like :ref:`lcd-pcf8574` don't support pages natively, but you can easily implement them
using Lambdas:
.. code-block:: yaml
display:
- platform: lcd_pcf8574
dimensions: 20x4
address: 0x27
id: lcd
lambda: |-
switch (id(page)){
case 1:
it.print(0, 1, "Page1");
break;
case 2:
it.print(0, 1, "Page2");
break;
case 3:
it.print(0, 1, "Page3");
break;
}
globals:
- id: page
type: int
initial_value: "1"
interval:
- interval: 5s
then:
- lambda: |-
id(page) = (id(page) + 1);
if (id(page) > 3) {
id(page) = 1;
}
.. _lambda_magic_udp_sender:
Send UDP commands
-----------------
There are various network devices which can be commanded with UDP packets containing command strings.
You can send such UDP commands from ESPHome using a Lambda in a script.
.. code-block:: yaml
script:
- id: send_udp
parameters:
msg: string
host: string
port: int
then:
- lambda: |-
int sock = ::socket(AF_INET, SOCK_DGRAM, 0);
struct sockaddr_in destination, source;
destination.sin_family = AF_INET;
destination.sin_port = htons(port);
destination.sin_addr.s_addr = inet_addr(host.c_str());
// you can remove the next 4 lines if you don't want to set the source port for outgoing packets
source.sin_family = AF_INET;
source.sin_addr.s_addr = htonl(INADDR_ANY);
source.sin_port = htons(64998); // the source port number
bind(sock, (struct sockaddr*)&source, sizeof(source));
int n_bytes = ::sendto(sock, msg.c_str(), msg.length(), 0, reinterpret_cast<sockaddr*>(&destination), sizeof(destination));
ESP_LOGD("lambda", "Sent %s to %s:%d in %d bytes", msg.c_str(), host.c_str(), port, n_bytes);
::close(sock);
button:
- platform: template
id: button_udp_sender
name: "Send UDP Command"
on_press:
- script.execute:
id: send_udp
msg: "Hello World!"
host: "192.168.1.10"
port: 5000
Tested on both `arduino` and `esp-idf` platforms.
.. _lambda_magic_uart_text_sensor:
Custom UART Text Sensor
-----------------------
Lots of devices communicate using the UART protocol. If you want to read
lines from uart to a Text Sensor you can do so using this code example.
With this you can use automations or lambda to set switch or sensor states.
.. code-block:: cpp
#include "esphome.h"
class UartReadLineSensor : public Component, public UARTDevice, public TextSensor {
public:
UartReadLineSensor(UARTComponent *parent) : UARTDevice(parent) {}
void setup() override {
// nothing to do here
}
int readline(int readch, char *buffer, int len)
{
static int pos = 0;
int rpos;
if (readch > 0) {
switch (readch) {
case '\n': // Ignore new-lines
break;
case '\r': // Return on CR
rpos = pos;
pos = 0; // Reset position index ready for next time
return rpos;
default:
if (pos < len-1) {
buffer[pos++] = readch;
buffer[pos] = 0;
}
}
}
// No end of line has been found, so return -1.
return -1;
}
void loop() override {
const int max_line_length = 80;
static char buffer[max_line_length];
while (available()) {
if(readline(read(), buffer, max_line_length) > 0) {
publish_state(buffer);
}
}
}
};
(Store this file in your configuration directory, for example ``uart_read_line_sensor.h``)
And in YAML:
.. code-block:: yaml
# Example configuration entry
esphome:
includes:
- uart_read_line_sensor.h
logger:
level: VERBOSE #makes uart stream available in esphome logstream
baud_rate: 0 #disable logging over uart
uart:
id: uart_bus
tx_pin: D0
rx_pin: D1
baud_rate: 9600
text_sensor:
- platform: custom
lambda: |-
auto my_custom_sensor = new UartReadLineSensor(id(uart_bus));
App.register_component(my_custom_sensor);
return {my_custom_sensor};
text_sensors:
id: "uart_readline"
.. _lambda_magic_uart_switch:
Custom UART Switch
------------------
Here is an example switch using the uart text sensor above to set switch state.
Here we use interval to request status from the device. The response will be stored in uart text sensor.
Then the switch uses the text sensor state to publish its own state.
.. code-block:: yaml
switch:
- platform: template
name: "Switch"
lambda: |-
if (id(uart_readline).state == "*POW=ON#") {
return true;
} else if(id(uart_readline).state == "*POW=OFF#") {
return false;
} else {
return {};
}
turn_on_action:
- uart.write: "\r*pow=on#\r"
turn_off_action:
- uart.write: "\r*pow=off#\r"
interval:
- interval: 10s
then:
- uart.write: "\r*pow=?#\r"
.. _lambda_magic_rf_queues:
Delaying Remote Transmissions
-----------------------------
The solution below handles the problem of RF frames being sent out by :doc:`/components/rf_bridge` (or
:doc:`/components/remote_transmitter`) too quickly one after another when operating radio controlled
covers. The cover motors seem to need at least 600-700ms of silence between the individual code transmissions
to be able to recognize them.
This can be solved by building up a queue of raw RF codes and sending them out one after the other with
(a configurable) delay between them. Delay is only added to the next commands coming from a list of
covers which have to be operated at once from Home Assistant. This is transparent to the system, which
will still look like they operate simultaneously.
.. code-block:: yaml
rf_bridge:
number:
- platform: template
name: Delay commands
icon: mdi:clock-fast
entity_category: config
optimistic: true
restore_value: true
initial_value: 750
unit_of_measurement: "ms"
id: queue_delay
min_value: 10
max_value: 1000
step: 50
mode: box
globals:
- id: rf_code_queue
type: 'std::vector<std::string>'
script:
- id: rf_transmitter_queue
mode: single
then:
while:
condition:
lambda: 'return !id(rf_code_queue).empty();'
then:
- rf_bridge.send_raw:
raw: !lambda |-
std::string rf_code = id(rf_code_queue).front();
id(rf_code_queue).erase(id(rf_code_queue).begin());
return rf_code;
- delay: !lambda 'return id(queue_delay).state;'
cover:
# have multiple covers
- platform: time_based
name: 'My Room 1'
disabled_by_default: false
device_class: shutter
assumed_state: true
has_built_in_endstop: true
close_action:
- lambda: id(rf_code_queue).push_back("AAB0XXXXX..the.closing.code..XXXXXXXXXX");
- script.execute: rf_transmitter_queue
close_duration: 26s
stop_action:
- lambda: id(rf_code_queue).push_back("AAB0YXXXX..the.stopping.code..XXXXXXXXXX");
- script.execute: rf_transmitter_queue
open_action:
- lambda: id(rf_code_queue).push_back("AAB0ZXXXX..the.opening.code..XXXXXXXXXX");
- script.execute: rf_transmitter_queue
open_duration: 27s
See Also
--------
- :ref:`config-lambda`
- :ref:`automation`
- :doc:`/components/uart`
- :doc:`/custom/uart`
- :ghedit:`Edit`

View File

@ -1,309 +0,0 @@
Mirabella Genio Bulbs
=====================
The Mirabella Genio is a Tuya-based smart bulb sold by Kmart in Australia.
.. figure:: images/mirabella-genio-b22-rgbw.jpg
:align: center
:width: 50.0%
Originally intended to be used with their companion app once flashed using `tuya-convert <https://github.com/ct-Open-Source/tuya-convert>`__ ESPHome generated
firmware can be uploaded allowing you to control the bulbs via Home Assistant.
.. note::
Please note that the new version of this bulb that comes in a cardboard box are using the TYLC5 module which does not work via tuya-convert.
These bulbs are also using the SM2135 chipset and not PWM anymore.
1. Create the ESPHome Firmware
------------------------------
#. Refer to either :doc:`/guides/getting_started_command_line` or :doc:`/guides/getting_started_hassio` before moving onto the next step.
#. Select a bulb configuration below based on the bulb/s you have and copy all of the text in the code block and paste into your
``name_of_esphome_configuration.yaml`` file.
#. Compile the firmware, again depending on your chosen setup refer to the guides in the first point.
2. Flashing
-----------
2.1 Prerequisites
*****************
#. Before you begin you'll need one of the following Linux machines running the latest copy of `Raspbian Stretch Lite
<https://www.raspberrypi.org/downloads/raspbian/>`__
a. Raspberry Pi 2B/B+ with `USB WiFi Dongle <https://www.raspberrypi.org/products/raspberry-pi-usb-wifi-dongle/>`__.
b. Raspberry Pi 3B/B+.
.. note::
As per the `tuya-convert documentation <https://github.com/ct-Open-Source/tuya-convert/blob/master/README.md#requirements>`__:
Any Linux with a Wifi adapter which can act as an Access Point should also work. Please note that we have tested the Raspberry Pi with clean installations
only. If you use your Raspberry Pi for anything else, we recommend using another SD card with a clean installation.
#. A microSD card (minimum 2GB, 8GB+ recommended).
#. Any WiFi device which can connect to the SSID generated by the Raspberry Pi and eventually the flashed Tuya device. **This cannot be an iOS / Apple device.
Android devices will work.**
2.2 Installing the OS
*********************
#. It's recommended to read the documentation provided by the Raspberry Pi Foundation on the best way to flash the OS to the microSD card depending on your
platform - `Installing operating system images <https://www.raspberrypi.org/documentation/installation/installing-images/>`__.
#. After you've flashed the microSD card browse to the "boot" partition and add a blank file called "ssh" **(without any extension)** which will enable the
SSH server upon first boot, extended information on this step can be found `here
<https://www.raspberrypi.org/documentation/remote-access/ssh/README.md#3-enable-ssh-on-a-headless-raspberry-pi-add-file-to-sd-card-on-another-machine>`__.
#. Plug the microSD card into the Raspberry Pi, connect network cable and power, the Raspberry Pi will start to boot.
2.3 Connecting to the Pi via SSH
********************************
#. Download and install `Putty <https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html>`__.
#. Open Putty.
#. Enter the IP of Raspberry Pi in the box that says "Host Name", leaving the port set to 22 (default for SSH). A list of recommended ways can be found `here
<https://www.raspberrypi.org/documentation/remote-access/ip-address.md>`__, but the easiest is to download and use `Fing <https://www.fing.com/>`__
(`Android <https://play.google.com/store/apps/details?id=com.overlook.android.fing&hl=en_GB>`__ / `iOS
<https://itunes.apple.com/us/app/fing-network-scanner/id430921107?mt=8>`__).
#. In the "Saved Sessions" input box, name the Raspberry Pi connection and then press "Save".
#. Select your new saved session from the list.
#. Press "Open".
2.4 Configuring the Pi
**********************
#. In the putty window login with the **pi** as the user and **raspberry** for the password.
#. Type ``sudo apt-get update && sudo apt-get dist-upgrade -y`` and wait for the upgrades to install.
#. Type ``sudo apt-get install git`` and wait for it to install.
2.5 Setup and Install tuya-convert
**********************************
#. In the putty window type ``git clone https://github.com/ct-Open-Source/tuya-convert`` press enter and wait while the repository is cloned.
#. Type ``cd tuya-convert`` and press enter.
#. Type ``./install_prereq.sh`` press enter and wait as the script gathers all the required components needed to function.
2.6 Upload ESPHome Firmware using SFTP
**************************************
#. Download `FileZilla <https://filezilla-project.org/download.php?type=client>`__ or `WinSCP <https://winscp.net/eng/index.php>`__ or use your preferred FTP
client.
#. Depending on the program you need to connect to the Pi using the IP address as the hostname and the username and password the same as you used to connect
via SSH and ensure your connection type is set to **SFTP**
#. Browse to ``/root/tuya-convert/files``.
#. Upload your compiled ``firmware.bin`` file to this directory. For command line based installs you can access the file under
``<CONFIG_DIR>/<NODE_NAME>/.pioenvs/<NODE_NAME>/firmware.bin`` alternatively Home Assistant add-on users can download the file directly from the web ui.
2.7 Use tuya-convert to install ESPHome Firmware
************************************************
#. Type ``./start_flash.sh``
#. Type ``yes`` to accept the warning.
#. Connect your alternative WiFi device (non iOS / Apple based) to the ``vtrust-flash`` SSID using ``flashmeifyoucan`` as the password. This is the network
being broadcast by the Pi from the tuya flash script.
#. If you haven't already install your bulb and flip the switch. It should automatically enter pairing mode represented by the bulb flashing on and off. If it
doesn't, switch your bulb, on-off-on-off-on as per the instructions `here
<https://img1.wsimg.com/blobby/go/67cdd3b9-3600-4104-b097-603c05201237/downloads/1cq3j1sq1_277630.pdf>`__.
#. Press enter on your putty window to start the flash process and wait. The bulb will stop flashing followed by a large amount of scrolling text, this is the
script backing up the factory shipped firmware.
#. Once the process is complete you can type ``curl http://10.42.42.42/flashURL?url=http://10.42.42.1/files/firmware.bin``
#. The bulb will restart and if everything is working correctly after a few seconds the light should be on.
3. Bulb Configurations
----------------------
Thanks to the `existing work <https://github.com/arendst/Sonoff-tasmota/wiki/Mirabella-Genio-Bulb>`__ by
`@so3n <https://github.com/arendst/Sonoff-tasmota/wiki/Mirabella-Genio-Bulb>`__ which these adaptions created by `@cryptelli
<https://community.home-assistant.io/u/cryptelli>`__ and `@bircoe <https://community.home-assistant.io/u/bircoe>`__ are based on.
3.1 Monochromatic Bulbs
***********************
The brightness of the bulb can be controlled using the ``esp8266_pwm`` output component connected to the light component using the id configuration
variable ``output_component1``.
.. code-block:: yaml
esphome:
name: mirabella_genio_cw_1
esp8266:
board: esp01_1m
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
logger:
api:
ota:
light:
- platform: monochromatic
name: "Mirabella Genio Smart Bulb"
id: light
output: output_component1
# Ensure the light turns on by default if the physical switch is actuated.
restore_mode: ALWAYS_ON
output:
- platform: esp8266_pwm
id: output_component1
# May need to use GPIO14 instead for certain globes
pin: GPIO13
3.2 Cold + Warm White Bulbs
***************************
.. code-block:: yaml
esphome:
name: mirabella_genio_cwww_1
esp8266:
board: esp01_1m
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
logger:
api:
ota:
output:
- platform: esp8266_pwm
id: output_warm_white
pin: GPIO13
- platform: esp8266_pwm
id: output_daylight
pin: GPIO5
light:
- platform: cwww
name: "Mirabella Genio Smart Bulb"
id: light
cold_white: output_daylight
warm_white: output_warm_white
cold_white_color_temperature: 6500 K
warm_white_color_temperature: 2700 K
# Ensure the light turns on by default if the physical switch is actuated.
restore_mode: ALWAYS_ON
3.3 RGBW Color Bulbs
********************
.. code-block:: yaml
esphome:
name: rgbw_e27_01
esp8266:
board: esp01_1m
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
logger:
api:
ota:
output:
- platform: esp8266_pwm
id: output_red
pin: GPIO4
- platform: esp8266_pwm
id: output_green
pin: GPIO12
- platform: esp8266_pwm
id: output_blue
pin: GPIO14
- platform: esp8266_pwm
id: output_white
pin: GPIO5
light:
- platform: rgbw
name: "rgbw_e27_01"
id: light
red: output_red
green: output_green
blue: output_blue
white: output_white
# Ensure the light turns on by default if the physical switch is actuated.
restore_mode: ALWAYS_ON
3.4 CWWW Mirabella Genio Downlights
***********************************
.. code-block:: yaml
esphome:
name: rgbw_e27_01
esp8266:
board: esp01_1m
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
logger:
api:
ota:
output:
- platform: esp8266_pwm
id: output1
pin: GPIO14
- platform: esp8266_pwm
id: output2
pin: GPIO12
light:
- platform: cwww2
id: LED
name: "Downlight"
color_temperature: output2
brightness: output1
cold_white_color_temperature: 6500 K
warm_white_color_temperature: 2700 K
# Ensure the light turns on by default if the physical switch is actuated.
restore_mode: ALWAYS_ON
4. Adding to Home Assistant
---------------------------
You can now add your bulb to home assistant via the configurations page, look for 'ESPHome' under the Integrations option and click 'Configure'.
.. figure:: images/mirabella-genio-b22-rgbw-homeassistant.jpg
:align: center
:width: 50.0%
See Also
--------
- :doc:`/components/light/index`
- :doc:`/components/light/monochromatic`
- :doc:`/components/light/cwww`
- :doc:`/components/light/rgbw`
- :doc:`/components/output/index`
- :doc:`/components/output/esp8266_pwm`
- :doc:`/guides/automations`
- :ghedit:`Edit`

View File

@ -1,66 +0,0 @@
Passive Infrared Sensor
=======================
.. seo::
:description: Instructions for setting up PIR (passive infrared) motion detection sensors in ESPHome
:image: pir.jpg
:keywords: PIR
.. figure:: images/pir-header.jpg
:align: center
:width: 75.0%
Passive Infrared Sensors (or PIR sensors for short) are completely supported by
ESPHome. These sensors measure the infrared light emitted from objects in its
field of view, and if it detects a sudden change between different parts of the
sensing area, the signal is pulled high.
.. figure:: images/pir-inside.jpg
:align: center
:width: 60.0%
Connecting the PIR sensor is also quite simple. You need to connect ``GND`` to a GND pin
on your board and ``VCC`` to a ``5V`` or ``12V`` pin. Technically you can also connect
``VCC`` to ``3.3V``, but the sensor measurements won't be as stable.
Next you need to connect the signal pin (``OUT``). Fortunately, the sensor signal has
a voltage of ``3.3V`` max, so we can directly connect it to a free GPIO pin on the ESP board.
Otherwise, we would need to step down the voltage in order to not damage the ESP.
.. figure:: images/pir-pins.jpg
:align: center
:width: 75.0%
.. warning::
Some PIR sensors have the GND and power supply pins swapped, please open the front
cover to see which pin mapping your PIR sensor is using to make sure.
On the back side you will additionally find two knobs that you can turn to change the sensor
sensitivity and time the signal will stay active for once motion has been detected. Turning
these clockwise will increase sensitivity/re-trigger time.
To configure ESPHome for use with the PIR sensor, use a
:doc:`GPIO Binary Sensor </components/binary_sensor/gpio>`. It can detect
if a pin is pulled HIGH/LOW and reports those values to Home Assistant. Optionally also
set a ``device_class`` so that Home Assistant uses a nice icon for the binary sensor.
.. code-block:: yaml
binary_sensor:
- platform: gpio
pin: <PIN_PIR_SENSOR_IS_CONNECTED_TO>
name: "PIR Sensor"
device_class: motion
.. figure:: images/pir-ui.png
:align: center
:width: 60.0%
See Also
--------
- `Awesome article explaining how PIR Sensors work <https://learn.adafruit.com/pir-passive-infrared-proximity-motion-sensor/how-pirs-work>`__.
- :doc:`/components/binary_sensor/gpio`
- :doc:`bruh`
- :ghedit:`Edit`

View File

@ -1,51 +0,0 @@
Relay
=====
.. seo::
:description: Instructions for using relays in ESPHome.
:image: relay.jpg
:keywords: Relay
.. figure:: images/relay-full.jpg
:align: center
:width: 80.0%
Relays are simple electronics components that allow you to switch a high load
using only a single pin on your board.
On the inside of a relay there is a coil that's connected to the input signal.
Every time the input signal switches on, the current flowing through the coil induces
a magnetic field that closes a contact.
On the output side you have three pins: common (``COM``), normally open (``NO``) and
normally closed (``NC``). Connect ``COM`` and one of ``NO`` and ``NC`` in series
with your load. When the input turns on, ``NO`` is connected to ``COM`` and
when the input turns off, ``NC`` is connected to ``COM``.
.. warning::
Relays are a very common component in electronics, so there are *many* types of them and
I won't attempt to describe all of them (partly due to my own lack of knowledge). Please
check with the datasheet of your relay to see its current limits, what voltage it requires
and so on. Please also note that relays are physical components - as such, they have a limited
number of switches that can happen before they break.
To use a relay with ESPHome, use a :doc:`GPIO Switch </components/switch/gpio>`.
.. code-block:: yaml
switch:
- platform: gpio
name: "Relay"
pin: <PIN_RELAY_IS_CONNECTED_TO>
For a more complete example, check :doc:`Simple Garage Door </cookbook/garage-door>`.
See Also
--------
- :doc:`/components/switch/gpio`
- :doc:`/components/output/gpio`
- :doc:`/cookbook/garage-door`
- `How do relays work <https://www.explainthatstuff.com/howrelayswork.html>`__.
- :ghedit:`Edit`

View File

@ -1,88 +0,0 @@
TECKIN SB50 LED Bulb
====================
.. seo::
:description: ESPHome configuration for Teckin SB50 LED Bulb.
:image: teckin_sb50.jpg
:keywords: Teckin SB50
.. figure:: images/teckin_sb50.jpg
:align: center
:width: 50.0%
.. warning::
It is not currently possible to flash these bulbs with ``tuya-convert`` due to shipping with an updated/patched firmware.
Please check `this issue <https://github.com/ct-Open-Source/tuya-convert/issues/483>`__ for details and progress on a workaround.
The Teckin SB50 Bulb's are a great option for lighting that could previously be flashed with tuya-convert. More details can be found at tuya-convert `github page <https://github.com/ct-Open-Source/tuya-convert>`__.
Below is the ESPHome configuration file that will get you up and running. This assumes you have a ``secret.yaml`` with ssid, password, api_password and ota_password keys.
.. code-block:: yaml
substitutions:
devicename: <Enter a name for your light here>
esphome:
name: $devicename
esp8266:
board: esp01_1m
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable logging to ESPHome
logger:
# Disable logging to serial
baud_rate: 0
# Enable Home Assistant API
api:
# Setup OTA
ota:
# Define output pins
output:
- platform: esp8266_pwm
id: output_red
pin: GPIO4
- platform: esp8266_pwm
id: output_green
pin: GPIO12
- platform: esp8266_pwm
id: output_blue
pin: GPIO14
- platform: esp8266_pwm
id: output_warm_white
pin: GPIO13
- platform: esp8266_pwm
id: output_cold_white
pin: GPIO5
# Define a light entity
light:
- platform: rgbww
name: $devicename
id: $devicename
red: output_red
green: output_green
blue: output_blue
warm_white: output_warm_white
cold_white: output_cold_white
cold_white_color_temperature: 6200 K
warm_white_color_temperature: 2800 K
color_interlock: true # avoids simultaneous RGB and W/W
See Also
--------
- :doc:`/devices/nodemcu_esp8266`
- :doc:`/cookbook/mirabella-genio-bulb`
- :doc:`/components/light/rgb`
- :doc:`/components/output/esp8266_pwm`
- :doc:`/components/binary_sensor/gpio`
- :ghedit:`Edit`

View File

@ -1,74 +0,0 @@
TEMT6000
========
.. seo::
:description: Instructions for setting up TEMT6000 ambient light sensors in ESPHome using the ADC sensor component.
:image: temt6000.jpg
:keywords: TEMT6000
The TEMT6000 is a simple and cheap ambient light sensor. The sensor itself
changes its resistance based on how much light hits the sensor. In order
for us to read this resistance the breakout boards you can buy these chips on
often have a small constant value resistor and three pins: ``GND``, ``VCC`` and
``SIG``. Connect ``VCC`` to ``3.3V``, ``GND`` to ``GND`` and ``SIG`` to any
available :doc:`analog pin </components/sensor/adc>`.
.. figure:: images/temt6000-header.jpg
:align: center
:width: 75.0%
To get the brightness the sensor measures, we then simply have to measure the voltage
on the ``SIG`` (also called ``OUT``) pin using the :doc:`/components/sensor/adc`
and convert those voltage measurements to illuminance values in lux using a formula:
.. code-block:: yaml
sensor:
- platform: adc
pin: A0
name: "TEMT6000 Illuminance"
device_class: illuminance
unit_of_measurement: lx
filters:
- lambda: |-
return (x / 10000.0) * 2000000.0;
.. figure:: images/temt6000-pins.jpg
:align: center
:width: 75.0%
Pins on the TEMT6000. Connect ``OUT`` to an ADC pin, ``GND`` to ``GND``, and ``VCC``
to ``3.3V``
Formula Explanation:
--------------------
To get the illuminance in lux, we first need to convert the measured voltage to the
current flowing across the TEMT6000 sensor. This current is also equal to the current
flowing across the 10kΩ resistor in the voltage divider circuit, which is
``I = adc_value/10000kΩ``.
The `datasheet for the TEMT6000 <https://www.sparkfun.com/datasheets/Sensors/Imaging/TEMT6000.pdf>`__
specifies a proportional correlation between current and illuminance: Every 2 µA of current
correlates to 1 lx in the illuminance.
.. note::
The default voltage range of the ADC for the ESP8266 and ESP32 are from 0 to 1.0V.
So you won't be able to measure any value above 200 lx using the default setup.
For the ESP32, you have the option of setting a :ref:`Voltage Attenuation <adc-esp32_attenuation>`
(note that the formula doesn't need to be adjusted if you set an attenuation, as the value ``x``
is automatically converted to volts).
For the ESP8266, you unfortunately need to tinker with the hardware a bit to decrease
the voltage a bit. So one option would be to create another voltage divider on the ``SIG`` pin
to divide the analog voltage by a constant value.
See Also
--------
- :doc:`/components/sensor/adc`
- `TEMT6000 datasheet <https://www.sparkfun.com/datasheets/Sensors/Imaging/TEMT6000.pdf>`__
- :doc:`bruh`
- :ghedit:`Edit`

File diff suppressed because it is too large Load Diff

View File

@ -1,88 +0,0 @@
Tuya RGBW LED controller
========================
The Tuya RGBW controller is inexpensive, available on ebay, and can be OTA flashed using `tuya-convert <https://github.com/ct-Open-Source/tuya-convert>`__, after which it can be OTA flashed via the ESPHome web interface (NOTE: a port must be explicitly set if using a Home Assistant add-on for this, and you need to connect directly to that port instead of using the proxied port via Home Assistant).
.. figure:: images/tuya_rgbw.jpg
:align: center
:width: 80.0%
The configuration below shows an example that can be compiled to a binary firmware file that works correctly for this device, and that cycles through three different brightnesses and an off state based on the number of button presses. The device can also be controlled via Home Assistant, of course, setting specific RGBW combinations and brightness levels.
.. code-block:: yaml
# Example configuration entry
output:
- platform: esp8266_pwm
id: output_red
pin: GPIO14
- platform: esp8266_pwm
id: output_green
pin: GPIO5
- platform: esp8266_pwm
id: output_blue
pin: GPIO12
- platform: esp8266_pwm
id: output_white
pin: GPIO15
globals:
- id: action_state
type: int
restore_value: no
initial_value: '0'
binary_sensor:
- platform: gpio
pin: GPIO13
name: "RGBW Controller Button"
filters:
- invert:
- delayed_on_off: 20ms
on_press:
then:
- lambda: id(action_state) = (id(action_state) + 1) % 4;
- if:
condition:
lambda: 'return id(action_state) == 0;'
then:
- light.turn_off: rgbw_lightstrip1
- if:
condition:
lambda: 'return id(action_state) == 1;'
then:
- light.turn_on:
id: rgbw_lightstrip1
brightness: 60%
- if:
condition:
lambda: 'return id(action_state) == 2;'
then:
- light.turn_on:
id: rgbw_lightstrip1
brightness: 40%
- if:
condition:
lambda: 'return id(action_state) == 3;'
then:
- light.turn_on:
id: rgbw_lightstrip1
brightness: 15%
light:
- platform: rgbw
name: "rgbw_strip_01"
id: rgbw_lightstrip1
red: output_red
green: output_green
blue: output_blue
white: output_white
# Ensure the light turns on by default if the physical switch is actuated.
restore_mode: ALWAYS_OFF
See Also
--------
- :doc:`/components/light/rgbw`
- :doc:`/components/output/esp8266_pwm`
- :ghedit:`Edit`

View File

@ -1,126 +0,0 @@
Custom UART Text Sensor
=======================
.. seo::
:description: Instructions for setting up a custom uart text sensor.
:image: language-cpp.svg
Lots of devices communicate using the UART protocol. If you want to read
lines from uart to a Text Sensor you can do so using this code example.
With this you can use automations or lambda to set switch or sensor states.
.. code-block:: cpp
#include "esphome.h"
class UartReadLineSensor : public Component, public UARTDevice, public TextSensor {
public:
UartReadLineSensor(UARTComponent *parent) : UARTDevice(parent) {}
void setup() override {
// nothing to do here
}
int readline(int readch, char *buffer, int len)
{
static int pos = 0;
int rpos;
if (readch > 0) {
switch (readch) {
case '\n': // Ignore new-lines
break;
case '\r': // Return on CR
rpos = pos;
pos = 0; // Reset position index ready for next time
return rpos;
default:
if (pos < len-1) {
buffer[pos++] = readch;
buffer[pos] = 0;
}
}
}
// No end of line has been found, so return -1.
return -1;
}
void loop() override {
const int max_line_length = 80;
static char buffer[max_line_length];
while (available()) {
if(readline(read(), buffer, max_line_length) > 0) {
publish_state(buffer);
}
}
}
};
(Store this file in your configuration directory, for example ``uart_read_line_sensor.h``)
And in YAML:
.. code-block:: yaml
# Example configuration entry
esphome:
includes:
- uart_read_line_sensor.h
logger:
level: VERBOSE #makes uart stream available in esphome logstream
baud_rate: 0 #disable logging over uart
uart:
id: uart_bus
tx_pin: D0
rx_pin: D1
baud_rate: 9600
text_sensor:
- platform: custom
lambda: |-
auto my_custom_sensor = new UartReadLineSensor(id(uart_bus));
App.register_component(my_custom_sensor);
return {my_custom_sensor};
text_sensors:
id: "uart_readline"
Example usage
-------------
Here is an example switch using the uart text sensor to set switch state.
Here we use interval to request status from the device. The response will be stored in uart text sensor.
Then the switch uses the text sensor state to set its own state.
.. code-block:: yaml
switch:
- platform: template
name: "Switch"
lambda: |-
if (id(uart_readline).state == "*POW=ON#") {
return true;
} else if(id(uart_readline).state == "*POW=OFF#") {
return false;
} else {
return {};
}
turn_on_action:
- uart.write: "\r*pow=on#\r"
turn_off_action:
- uart.write: "\r*pow=off#\r"
interval:
- interval: 10s
then:
- uart.write: "\r*pow=?#\r"
See Also
--------
- :doc:`/components/uart`
- :doc:`/custom/uart`
- :ghedit:`Edit`

View File

@ -1,234 +0,0 @@
Zemismart LED RGBW/RGBWW Downlights
===================================
The Zemismart LED RGBW Downlight is a Tuya-based downlight available from various retailers online or from `zemismart.com <https://www.zemismart.com>`__ direct.
.. figure:: images/zemismart-rgbw-downlight.jpg
:align: center
:width: 50.0%
Originally intended to be used with their companion app once flashed using `tuya-convert <https://github.com/ct-Open-Source/tuya-convert>`__ ESPHome generated
firmware can be uploaded allowing you to control the smart plugs via Home Assistant.
1. Create the ESPHome Firmware
------------------------------
#. Refer to either :doc:`/guides/getting_started_command_line` or :doc:`/guides/getting_started_hassio` before moving onto the next step.
#. Select a plug configuration below based on the plug/s you have and copy all of the text in the code block and paste into your
``name_of_esphome_configuration.yaml`` file.
#. Compile the firmware, again depending on your chosen setup refer to the guides in the first point.
2. Flashing
-----------
2.1 Prerequisites
*****************
#. Before you begin you'll need one of the following Linux machines running the latest copy of `Raspbian Stretch Lite
<https://www.raspberrypi.org/downloads/raspbian/>`__
a. Raspberry Pi 2B/B+ with `USB WiFi Dongle <https://www.raspberrypi.org/products/raspberry-pi-usb-wifi-dongle/>`__.
b. Raspberry Pi 3B/B+.
.. note::
As per the `tuya-convert documentation <https://github.com/ct-Open-Source/tuya-convert/blob/master/README.md#requirements>`__:
Any Linux with a Wifi adapter which can act as an Access Point should also work. Please note that we have tested the Raspberry Pi with clean installations
only. If you use your Raspberry Pi for anything else, we recommend using another SD card with a clean installation.
#. A microSD card (minimum 2GB, 8GB+ recommended).
#. Any WiFi device which can connect to the SSID generated by the Raspberry Pi and eventually the flashed Tuya device. **This cannot be an iOS / Apple device.
Android devices will work.**
2.2 Installing the OS
*********************
#. It's recommended to read the documentation provided by the Raspberry Pi Foundation on the best way to flash the OS to the microSD card depending on your
platform - `Installing operating system images <https://www.raspberrypi.org/documentation/installation/installing-images/>`__.
#. After you've flashed the microSD card browse to the "boot" partition and add a blank file called "ssh" **(without any extension)** which will enable the
SSH server upon first boot, extended information on this step can be found `here
<https://www.raspberrypi.org/documentation/remote-access/ssh/README.md#3-enable-ssh-on-a-headless-raspberry-pi-add-file-to-sd-card-on-another-machine>`__.
#. Plug the microSD card into the Raspberry Pi, connect network cable and power, the Raspberry Pi will start to boot.
2.3 Connecting to the Pi via SSH
********************************
#. Download and install `Putty <https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html>`__.
#. Open Putty.
#. Enter the IP of Raspberry Pi in the box that says "Host Name", leaving the port set to 22 (default for SSH). A list of recommended ways can be found `here
<https://www.raspberrypi.org/documentation/remote-access/ip-address.md>`__, but the easiest is to download and use `Fing <https://www.fing.com/>`__
(`Android <https://play.google.com/store/apps/details?id=com.overlook.android.fing&hl=en_GB>`__ / `iOS
<https://itunes.apple.com/us/app/fing-network-scanner/id430921107?mt=8>`__).
#. In the "Saved Sessions" input box, name the Raspberry Pi connection and then press "Save".
#. Select your new saved session from the list.
#. Press "Open".
2.4 Configuring the Pi
**********************
#. In the putty window login with the **pi** as the user and **raspberry** for the password.
#. Type ``sudo apt-get update && sudo apt-get dist-upgrade -y`` and wait for the upgrades to install.
#. Type ``sudo apt-get install git`` and wait for it to install.
2.5 Setup and Install tuya-convert
**********************************
#. In the putty window type ``git clone https://github.com/ct-Open-Source/tuya-convert`` press enter and wait while the repository is cloned.
#. Type ``cd tuya-convert`` and press enter.
#. Type ``./install_prereq.sh`` press enter and wait as the script gathers all the required components needed to function.
2.6 Upload ESPHome Firmware using SFTP
**************************************
#. Download `FileZilla <https://filezilla-project.org/download.php?type=client>`__ or `WinSCP <https://winscp.net/eng/index.php>`__ or use your preferred FTP
client.
#. Depending on the program you need to connect to the Pi using the IP address as the hostname and the username and password the same as you used to connect
via SSH and ensure your connection type is set to **SFTP**
#. Browse to ``/root/tuya-convert/files``.
#. Upload your compiled ``firmware.bin`` file to this directory. For command line based installs you can access the file under
``<CONFIG_DIR>/<NODE_NAME>/.pioenvs/<NODE_NAME>/firmware.bin`` alternatively Home Assistant add-on users can download the file directly from the web UI.
2.7 Use tuya-convert to install ESPHome Firmware
************************************************
#. Type ``./start_flash.sh``
#. Type ``yes`` to accept the warning.
#. Connect your alternative WiFi device (non iOS / Apple based) to the ``vtrust-flash`` SSID using ``flashmeifyoucan`` as the password. This is the network
being broadcast by the Pi from the Tuya flash script.
#. If you haven't already plug your downlight into a power point and turn it on and follow the instructions below:
#. Once turned on a stable white light will be emitted.
#. Switch off, then back on **3** times ensuring each off-on cycle is no longer 10 seconds apart and between each the light visibly turns off.
#. The light should have entered into a fast flashing state, if this is the case continue onto **Step 5** below. *Otherwise please turn the downlight off-on
within 3 minutes which will restore it back to a stable white light.*
#. Press enter on your putty window to start the flash process and wait. If the connection is successful you should see a large amount of scrolling text, this
is the script backing up the factory shipped firmware.
#. Once the process is complete you can type ``curl http://10.42.42.42/flashURL?url=http://10.42.42.1/files/firmware.bin``
#. The plug will restart and if everything is working correctly after a few seconds you should be able to press the button triggering the relay and turning the
blue led on.
3. Downlight Configuration
--------------------------
Thanks to `@1972rx2 <https://community.home-assistant.io/u/1972rx2>`__ for creating the below ESPHome configuration
which this cookbook article by `@cryptelli <https://community.home-assistant.io/u/cryptelli>`__ is based on.
Depending on the type of your light you either need a config using my9231 driver (RGBW) or 5 PWM channels (RGBWW).
3.1 Zemismart LED RGBW Downlight YAML
*************************************
.. code-block:: yaml
esphome:
name: downlight01
esp8266:
board: esp01_1m
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
my9231:
data_pin: GPIO13
clock_pin: GPIO15
num_channels: 4
num_chips: 1
output:
- platform: my9231
id: output_blue
channel: 1
- platform: my9231
id: output_red
channel: 3
- platform: my9231
id: output_green
channel: 2
- platform: my9231
id: output_white
channel: 0
light:
- platform: rgbw
name: Downlight01
red: output_red
green: output_green
blue: output_blue
white: output_white
3.2. Zemismart LED RGBWw Downlight YAML
***************************************
Known devices: *Zemismart 2,5 zoll WiFi RGBW Led Downlight 7w*
.. code-block:: yaml
output:
- platform: esp8266_pwm
pin: 14
id: output_blue
- platform: esp8266_pwm
pin: 12
id: output_green
- platform: esp8266_pwm
pin: 4
id: output_red
- platform: esp8266_pwm
pin: 5
id: output_coldwhite
- platform: esp8266_pwm
pin: 13
id: output_warmwhite
light:
- platform: rgbww
name: '${device_name} Light'
default_transition_length: 0s
red: output_red
green: output_green
blue: output_blue
cold_white: output_coldwhite
warm_white: output_warmwhite
cold_white_color_temperature: 6500 K
warm_white_color_temperature: 2700 K
4. Adding to Home Assistant
---------------------------
You can now add your downlight to Home Assistant using the below instructions:
#. In the left hand sidebar, select **Configuration**.
#. Select **Integrations**
#. Click the **Orange** plus button *(lower right hand corner)* and look for **ESPHome** in the list of available integrations and select.
#. Type the host of the downlight, in most cases this is simply the IP address.
#. Leave the port set to the default of ``6053``.
#. Click **Submit**
If you've gotten this far, congratulations! Below is the card you should see inside Home Assistant which allows you to control the downlight.
.. figure:: images/zemismart-rgbw-downlight-homeassistant.jpg
:align: center
:width: 50.0%
See Also
--------
- :doc:`/components/light/index`
- :doc:`/components/light/rgbw`
- :doc:`/components/output/index`
- :doc:`/components/output/my9231`
- :ghedit:`Edit`

114
index.rst
View File

@ -149,7 +149,7 @@ Core Components
Sensor Components
-----------------
Sensors have been split into categories. If a sensor fits into more than one category, it will be listed multiple times.
Sensors are split into categories. If a sensor fits into more than one category, it will be listed multiple times.
Core
****
@ -400,38 +400,75 @@ Weight
Looking for a sensor that outputs its values as an analog voltage? Have a look at the
:doc:`ADC Sensor </components/sensor/adc>` together with a formula like in the :doc:`TEMT6000
example </cookbook/temt6000>`.
:doc:`ADC Sensor </components/sensor/adc>` together with a formula like in the `TEMT6000
configuration <https://devices.esphome.io/devices/temt6000>`__.
Binary Sensor Components
------------------------
Binary Sensors are split into categories. If a sensor fits into more than one category, it will be listed multiple times.
Core
****
.. imgtable::
Binary Sensor Core, components/binary_sensor/index, folder-open.svg
Custom Binary Sensor, components/binary_sensor/custom, language-cpp.svg
GPIO, components/binary_sensor/gpio, pin.svg
Home Assistant, components/binary_sensor/homeassistant, home-assistant.svg
Status, components/binary_sensor/status, server-network.svg
Analog Threshold, components/binary_sensor/analog_threshold, analog_threshold.svg
ESP32 BLE Presence, components/binary_sensor/ble_presence, bluetooth.svg
ESP32 Touch Pad, components/binary_sensor/esp32_touch, touch.svg
Hydreon Rain Sensor Binary Sensor, components/binary_sensor/hydreon_rgxx, hydreon_rg9.jpg
MPR121 Capacitive Touch Sensor, components/binary_sensor/mpr121, mpr121.jpg
Nextion Binary Sensor, components/binary_sensor/nextion, nextion.jpg
Template Binary Sensor, components/binary_sensor/template, description.svg
Capacitive Touch
****************
.. imgtable::
CAP1188 Capacitive Touch Sensor, components/binary_sensor/cap1188, cap1188.jpg
ESP32 Touch Pad, components/binary_sensor/esp32_touch, touch.svg
MPR121 Capacitive Touch Sensor, components/binary_sensor/mpr121, mpr121.jpg
TTP229, components/binary_sensor/ttp229, ttp229.jpg
Mechanical
**********
.. imgtable::
Matrix Keypad, components/matrix_keypad, matrix_keypad.jpg
TM1637, components/display/tm1637, tm1637.jpg
TM1638, components/display/tm1638, tm1638.jpg
NFC/RFID Components
*******************
Often known as "tag" or "card" readers within the community.
.. imgtable::
PN532, components/binary_sensor/pn532, pn532.jpg
RC522, components/binary_sensor/rc522, rc522.jpg
RDM6300, components/binary_sensor/rdm6300, rdm6300.jpg
TTP229, components/binary_sensor/ttp229, ttp229.jpg
Tuya Binary Sensor, components/binary_sensor/tuya, tuya.png
Modbus Binary Sensor, components/binary_sensor/modbus_controller, modbus.png
XPT2046, components/binary_sensor/xpt2046, xpt2046.jpg
CAP1188 Capacitive Touch Sensor, components/binary_sensor/cap1188, cap1188.jpg
Touchscreen
***********
.. imgtable::
Nextion Binary Sensor, components/binary_sensor/nextion, nextion.jpg
Touchscreen, components/touchscreen/index, touch.svg
Resol VBus, components/vbus, resol_deltasol_bs_plus.jpg
XPT2046, components/binary_sensor/xpt2046, xpt2046.jpg
Miscellaneous
*************
.. imgtable::
Analog Threshold, components/binary_sensor/analog_threshold, analog_threshold.svg
ESP32 BLE Presence, components/binary_sensor/ble_presence, bluetooth.svg
Hydreon Rain Sensor Binary Sensor, components/binary_sensor/hydreon_rgxx, hydreon_rg9.jpg
LD2410, components/sensor/ld2410, ld2410.jpg
Custom Binary Sensor, components/binary_sensor/custom, language-cpp.svg
Modbus Binary Sensor, components/binary_sensor/modbus_controller, modbus.png
PipSolar - compatible PV Inverter, components/pipsolar, pipsolar.jpg
Remote Receiver, components/remote_receiver, remote.svg
Resol VBus, components/vbus, resol_deltasol_bs_plus.jpg
Tuya Binary Sensor, components/binary_sensor/tuya, tuya.png
Output Components
-----------------
@ -652,7 +689,7 @@ Select Components
Tuya Select, components/select/tuya, tuya.png
Lock Components
-----------------
---------------
.. imgtable::
@ -699,8 +736,8 @@ Home Assistant Companion Components
Text Sensor, components/text_sensor/homeassistant, home-assistant.svg
Binary Sensor, components/binary_sensor/homeassistant, home-assistant.svg
Misc Components
---------------
Miscellaneous Components
------------------------
.. imgtable::
@ -778,41 +815,24 @@ Cookbook
.. imgtable::
Arduino Port Extender, cookbook/arduino_port_extender, arduino_logo.svg
Endstop Cover, cookbook/endstop-cover, window-open.svg
PIR Sensor, cookbook/pir, pir.jpg
Relay, cookbook/relay, relay.jpg
BRUH Multisensor, cookbook/bruh, bruh.png
TEMT6000, cookbook/temt6000, temt6000.jpg
Non-Invasive Power Meter, cookbook/power_meter, power_meter.jpg
Dual Relay Motor Cover, cookbook/dual-r2-cover, sonoff_dual_r2.jpg
BME280 Environment, cookbook/bme280_environment, bme280.jpg
Sonoff Fishpond Pump, cookbook/sonoff-fishpond-pump, cookbook-sonoff-fishpond-pump.jpg
H801 LED Controller, cookbook/h801, h801.jpg
Time & Temperature on OLED Display, cookbook/display_time_temp_oled, display_time_temp_oled_2.jpg
Mirabella Genio Bulb, cookbook/mirabella-genio-bulb, cookbook-mirabella-genio-b22-rgbw.jpg
Garage Door, cookbook/garage-door, window-open.svg
Brilliant / Mirabella Genio Smart Plugs, cookbook/brilliant-mirabella-genio-smart-plugs, cookbook-brilliant-mirabella-genio-smart-plugs.jpg
Etekcity Voltson (ESW01-EU) , cookbook/esw01-eu, esw01-eu.jpg
Sonoff iFan02, cookbook/ifan02, fan.svg
Zemismart RGBW Downlights, cookbook/zemismart-rgbw-downlights, cookbook-zemismart-rgbw-downlight.jpg
Teckin SB50, cookbook/teckin_sb50, teckin_sb50.jpg
Sonoff light switch options, cookbook/sonoff-light-switch, light_switch.png
Garage Door, cookbook/garage-door, window-open.svg
Dual Relay Motor Cover, cookbook/dual-r2-cover, sonoff_dual_r2.jpg
ESP32 Water Leak Detector, cookbook/leak-detector-m5stickC, leak-detector-m5stickC_main_index.jpg
ESP32 BLE iTag Button, cookbook/ble_itag, esp32_ble_itag.jpg
IAQ (Indoor Air Quality) Board, cookbook/iaq_board, iaq_board2.jpg
TUYA Smart Life RGBW Controller, cookbook/tuya_rgbw, tuya_rgbw.jpg
Custom UART Text Sensor, cookbook/uart_text_sensor, language-cpp.svg
IWOOLE Table Lamp, cookbook/iwoole_rgbw_table_lamp, iwoole_rgbw_table_lamp.png
EPEVER Tracer, cookbook/tracer-an, tracer-an.jpg
Ilonda Wifi Smart Fish Feeder, cookbook/ilonda-wifi-smart-fish-feeder, ilonda-wifi-smart-fish-feeder-cookbook.jpg
AirGradient DIY Air Quality Sensor, cookbook/air_gradient_diy_air_quality_sensor, air_gradient_diy_air_quality_sensor.jpg
Geiger Counter, cookbook/geiger-counter, radiationD-v1-1-cajoe_small.jpg
BME280 Environment, cookbook/bme280_environment, bme280.jpg
Time & Temperature on OLED Display, cookbook/display_time_temp_oled, display_time_temp_oled_2.jpg
Lambda Magic, cookbook/lambda_magic, language-cpp.svg
Endstop Cover, cookbook/endstop-cover, window-open.svg
Non-Invasive Power Meter, cookbook/power_meter, power_meter.jpg
Sonoff Fishpond Pump, cookbook/sonoff-fishpond-pump, cookbook-sonoff-fishpond-pump.jpg
Arduino Port Extender, cookbook/arduino_port_extender, arduino_logo.svg
EHMTX a matrix status/text display, cookbook/ehmtx, ehmtx.jpg
Do you have other awesome automations or cool setups? Please feel free to add them to the
documentation for others to copy. See :doc:`Contributing </guides/contributing>`.
If you'd like to share configurations for specific devices, please contribute to our `ESPHome Devices <https://devices.esphome.io/>`__ database.
.. toctree::
:hidden: