Replace with new shorthand notation

This commit is contained in:
Otto Winter 2018-11-10 14:31:27 +01:00
parent f16b17aacd
commit a416804209
No known key found for this signature in database
GPG Key ID: DB66C0BE6013F97E
11 changed files with 59 additions and 28 deletions

View File

@ -113,8 +113,7 @@ edge of the signal.
# ...
on_press:
then:
- switch.turn_on:
id: relay_1
- switch.turn_on: relay_1
Configuration variables: See :ref:`Automation <automation>`.
@ -133,8 +132,7 @@ edge of the signal.
# ...
on_release:
then:
- switch.turn_off:
id: relay_1
- switch.turn_off: relay_1
Configuration variables: See :ref:`Automation <automation>`.
@ -156,8 +154,7 @@ The automation is therefore also triggered on the falling edge of the signal.
min_length: 50ms
max_length: 350ms
then:
- switch.turn_off:
id: relay_1
- switch.turn_off: relay_1
Configuration variables:
@ -183,8 +180,7 @@ This automation will be triggered when a button is pressed down twice, with the
min_length: 50ms
max_length: 350ms
then:
- switch.turn_off:
id: relay_1
- switch.turn_off: relay_1
Configuration variables:

View File

@ -22,14 +22,11 @@ as a cover and can be controlled through the frontend.
return cover::COVER_CLOSED;
}
open_action:
- switch.turn_on:
id: open_cover_switch
- switch.turn_on: open_cover_switch
close_action:
- switch.turn_on:
id: close_cover_switch
- switch.turn_on: close_cover_switch
stop_action:
- switch.turn_on:
id: stop_cover_switch
- switch.turn_on: stop_cover_switch
optimistic: true

View File

@ -106,7 +106,7 @@ Useful for
catch the ESP being active.
You can use this automation to automatically prevent deep sleep when a MQTT message on the topic
``livingroom/ota_mode`` with the payload ``ON`` is received. Then, to do the OTA update, just
``livingroom/ota_mode`` is received. Then, to do the OTA update, just
use a MQTT client to publish a retained MQTT message described above. When the node wakes up again
it will no longer enter deep sleep mode and you can upload your OTA update.
@ -122,10 +122,8 @@ Useful for
# ...
on_message:
topic: livingroom/ota_mode
payload: ON
then:
- deep_sleep.prevent:
id: deep_sleep_1
- deep_sleep.prevent: deep_sleep_1
See Also
--------

View File

@ -171,8 +171,7 @@ is already set up. You can however change this using the ``priority`` parameter.
priority: -10
# ...
then:
- switch.turn_off:
id: switch_1
- switch.turn_off: switch_1
Configuration variables:
@ -210,8 +209,7 @@ too many WiFi/MQTT connection attempts, Over-The-Air updates being applied or th
# ...
on_shutdown:
then:
- switch.turn_off:
id: switch_1
- switch.turn_off: switch_1
Configuration variables: See :ref:`Automation <automation>`.

View File

@ -73,6 +73,8 @@ Turns the fan with the given ID off when executed.
then:
- fan.turn_on:
id: fan_1
# Shorthand:
- fan.turn_on: fan_1
Configuration options:

View File

@ -18,6 +18,8 @@ This action toggles a light with the given ID when executed.
then:
- light.toggle:
id: light_1
# Shorthand:
- light.toggle: light_1
Configuration options:
@ -60,6 +62,9 @@ This action turns a light with the given ID on when executed.
// output value must be in range 0 - 1.0
return id(some_sensor).state / 100.0;
# Shorthand
- light.turn_on: light_1
Configuration options:
- **id** (**Required**, :ref:`config-id`): The ID of the light.
@ -109,6 +114,9 @@ This action turns a light with the given ID off when executed.
- light.turn_off:
id: light_1
# Shorthand
- light.turn_off: light_1
Configuration options:
- **id** (**Required**, :ref:`config-id`): The ID of the light.

View File

@ -289,8 +289,7 @@ template, the message payload is available under the name ``x`` inside that lamb
topic: my/custom/topic
qos: 0
then:
- switch.turn_on:
id: some_switch
- switch.turn_on: some_switch
Configuration variables:

View File

@ -39,6 +39,38 @@ Configuration variables:
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
- All other options from :ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.
Converting Units
----------------
As the HX711 does not have any calibration data, you have to convert the measurement to units yourself.
To calibrate the sensor:
1. Place nothing or a known mass on the sensor, for example ``0kg``
2. Wait for the data to arrive in the logs and write down the value. For example ``120``.
3. Place another (different) known mass on the sensor, for example ``1kg``
4. Again wait for the data to arrive and note the value, for example ``810``.
Once you've done those steps, you can use the ``map`` function to map the incoming value to the calibrated one:
.. code:: yaml
# Example configuration entry
sensor:
- platform: hx711
# ... Other HX711 options
filters:
- lambda: |-
auto first_mass = 0.0; // first known mass was 0kg
auto first_value = 120.0; // value for the first known mass was 120
auto second_mass = 1.0; // second mass was 1kg
auto second_value = 810.0; // second value was 810
return map(x, first_value, second_value, first_mass, second_mass);
unit_of_measurement: kg
Replace the masses and values ``120.0``, ``810.0``, etc with your values.
See Also
--------

View File

@ -4,7 +4,8 @@ Xiaomi MiFlora BLE Sensor
The ``xiaomi_miflora`` sensor platform lets you track the output of Xiaomi MiFlora Bluetooth Low Energy
devices using the :doc:`/esphomeyaml/components/esp32_ble_tracker`. This component will track the
temperature, humidity and optionally the battery level of the MiFlora device every time the sensor
sends out a BLE broadcast.
sends out a BLE broadcast. Note that contrary to other implementations, esphomelib can track as many
MiFlora devices at once as you want.
.. code:: yaml

View File

@ -4,7 +4,8 @@ Xiaomi MiJia BLE Sensor
The ``xiaomi_mijia`` sensor platform lets you track the output of Xiaomi MiJia Bluetooth Low Energy
devices using the :doc:`/esphomeyaml/components/esp32_ble_tracker`. This component will track the
temperature, humidity and optionally the battery level of the MiJia device every time the sensor
sends out a BLE broadcast.
sends out a BLE broadcast. Note that contrary to other implementations, esphomelib can track as many
MiJia devices at once as you want.
.. figure:: images/xiaomi_mijia-full.jpg
:align: center

View File

@ -87,8 +87,7 @@ There are also other triggers like ``on_release``, ``on_click`` or ``on_double_c
# ...
on_press:
then:
- switch.toggle:
id: dehumidifier1
- switch.toggle: dehumidifier1
.. _config-action: