Files
esphome/tests/components/globals/common.yaml
T

49 lines
1.2 KiB
YAML

esphome:
on_boot:
then:
- globals.set:
id: glob_int
value: "10"
# Set a float global with an integer literal - must emit the correct
# return type so TemplatableFn stores a direct function pointer.
- globals.set:
id: glob_float
value: "102"
- globals.set:
id: glob_float
value: !lambda "return 42;"
globals:
- id: glob_int
type: int
restore_value: true
initial_value: "0"
update_interval: 5s
- id: glob_float
type: float
restore_value: true
initial_value: "0.0f"
- id: glob_bool
type: bool
restore_value: false
initial_value: "true"
- id: glob_string
type: std::string
restore_value: false
# initial_value: ""
- id: glob_bool_processed
type: bool
restore_value: false
initial_value: "false"
# Test restore_value with string "false" - should be converted to bool false
- id: glob_no_restore_string_false
type: int
restore_value: "false"
initial_value: "42"
# Test restore_value with string "true" - should be converted to bool true
- id: glob_restore_string_true
type: int
restore_value: "true"
initial_value: "99"
update_interval: 5s