This commit is contained in:
Darter 2024-04-21 18:55:08 +02:00
parent f544f040f5
commit 1eaf5e0d97
2 changed files with 6 additions and 6 deletions

View File

@ -137,7 +137,7 @@ advanced stuff (see the full API Reference for more info).
.. code-block:: cpp
// Within lambda, set the date to 2024-02-25
auto call = id(my_date).make_call();
auto call = id(my_datetime_date).make_call();
call.set_date("2024-02-25");
call.perform();
@ -182,7 +182,7 @@ The ``time`` provided can be in one of 3 formats:
# Using a lambda
- datetime.time.set:
id: my_time
id: my_datetime_time
time: !lambda |-
// Return an ESPTime struct
return {.second: 56, .minute: 34, .hour: 12};
@ -207,7 +207,7 @@ advanced stuff (see the full API Reference for more info).
.. code-block:: cpp
// Within lambda, set the time to 12:34:56
auto call = id(my_time).make_call();
auto call = id(my_datetime_time).make_call();
call.set_date("12:34:56");
call.perform();
@ -222,7 +222,7 @@ advanced stuff (see the full API Reference for more info).
.. code-block:: cpp
// For example, create a custom log message when a value is received:
ESP_LOGI("main", "Value of my datetime: %0d:%02d:%02d", id(my_time).hour, id(my_time).minute, id(my_time).second);
ESP_LOGI("main", "Value of my datetime: %0d:%02d:%02d", id(my_datetime_time).hour, id(my_datetime_time).minute, id(my_datetime_time).second);
See Also

View File

@ -13,7 +13,7 @@ using :ref:`lambdas <config-lambda>`.
datetime:
# Example Date
- platform: template
id: my_date
id: my_datetime_date
type: date
name: Pick a Date
optimistic: yes
@ -22,7 +22,7 @@ using :ref:`lambdas <config-lambda>`.
# Example Time
- platform: template
id: my_time
id: my_datetime_time
type: time
name: Pick a Time
optimistic: yes