mirror of
https://github.com/esphome/esphome.git
synced 2025-10-30 14:43:51 +00:00
Merge remote-tracking branch 'origin/dev' into nrf52
This commit is contained in:
@@ -54,3 +54,17 @@ def test_text_config_value_mode_set(generate_main):
|
||||
# Then
|
||||
assert "it_1->traits.set_mode(text::TEXT_MODE_TEXT);" in main_cpp
|
||||
assert "it_3->traits.set_mode(text::TEXT_MODE_PASSWORD);" in main_cpp
|
||||
|
||||
|
||||
def test_text_config_lamda_is_set(generate_main):
|
||||
"""
|
||||
Test if lambda is set for lambda mode
|
||||
"""
|
||||
# Given
|
||||
|
||||
# When
|
||||
main_cpp = generate_main("tests/component_tests/text/test_text.yaml")
|
||||
|
||||
# Then
|
||||
assert "it_4->set_template([=]() -> optional<std::string> {" in main_cpp
|
||||
assert 'return std::string{"Hello"};' in main_cpp
|
||||
|
||||
@@ -31,3 +31,15 @@ text:
|
||||
optimistic: true
|
||||
internal: true
|
||||
max_length: 255
|
||||
|
||||
- platform: template
|
||||
name: "test 4 key"
|
||||
id: "it_4"
|
||||
mode: text
|
||||
set_action:
|
||||
- then:
|
||||
- logger.log:
|
||||
format: Template text set to %s
|
||||
args: ["x.c_str()"]
|
||||
lambda: |
|
||||
return std::string{"Hello"};
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
i2c:
|
||||
- id: i2c_bmp3xx
|
||||
scl: 5
|
||||
sda: 4
|
||||
|
||||
sensor:
|
||||
- platform: bmp3xx
|
||||
address: 0x77
|
||||
temperature:
|
||||
name: BMP Temperature
|
||||
oversampling: 16x
|
||||
pressure:
|
||||
name: BMP Pressure
|
||||
iir_filter: 2X
|
||||
@@ -1,14 +0,0 @@
|
||||
i2c:
|
||||
- id: i2c_bmp3xx
|
||||
scl: 16
|
||||
sda: 17
|
||||
|
||||
sensor:
|
||||
- platform: bmp3xx
|
||||
address: 0x77
|
||||
temperature:
|
||||
name: BMP Temperature
|
||||
oversampling: 16x
|
||||
pressure:
|
||||
name: BMP Pressure
|
||||
iir_filter: 2X
|
||||
@@ -1,14 +0,0 @@
|
||||
i2c:
|
||||
- id: i2c_bmp3xx
|
||||
scl: 16
|
||||
sda: 17
|
||||
|
||||
sensor:
|
||||
- platform: bmp3xx
|
||||
address: 0x77
|
||||
temperature:
|
||||
name: BMP Temperature
|
||||
oversampling: 16x
|
||||
pressure:
|
||||
name: BMP Pressure
|
||||
iir_filter: 2X
|
||||
@@ -1,14 +0,0 @@
|
||||
i2c:
|
||||
- id: i2c_bmp3xx
|
||||
scl: 5
|
||||
sda: 4
|
||||
|
||||
sensor:
|
||||
- platform: bmp3xx
|
||||
address: 0x77
|
||||
temperature:
|
||||
name: BMP Temperature
|
||||
oversampling: 16x
|
||||
pressure:
|
||||
name: BMP Pressure
|
||||
iir_filter: 2X
|
||||
@@ -1,14 +0,0 @@
|
||||
i2c:
|
||||
- id: i2c_bmp3xx
|
||||
scl: 5
|
||||
sda: 4
|
||||
|
||||
sensor:
|
||||
- platform: bmp3xx
|
||||
address: 0x77
|
||||
temperature:
|
||||
name: BMP Temperature
|
||||
oversampling: 16x
|
||||
pressure:
|
||||
name: BMP Pressure
|
||||
iir_filter: 2X
|
||||
@@ -1,10 +1,11 @@
|
||||
i2c:
|
||||
- id: i2c_bmp3xx
|
||||
scl: 5
|
||||
sda: 4
|
||||
scl: ${scl_pin}
|
||||
sda: ${sda_pin}
|
||||
|
||||
sensor:
|
||||
- platform: bmp3xx
|
||||
- platform: bmp3xx_i2c
|
||||
i2c_id: i2c_bmp3xx
|
||||
address: 0x77
|
||||
temperature:
|
||||
name: BMP Temperature
|
||||
5
tests/components/bmp3xx_i2c/test.esp32-c3-idf.yaml
Normal file
5
tests/components/bmp3xx_i2c/test.esp32-c3-idf.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
substitutions:
|
||||
scl_pin: GPIO5
|
||||
sda_pin: GPIO4
|
||||
|
||||
<<: !include common.yaml
|
||||
5
tests/components/bmp3xx_i2c/test.esp32-c3.yaml
Normal file
5
tests/components/bmp3xx_i2c/test.esp32-c3.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
substitutions:
|
||||
scl_pin: GPIO5
|
||||
sda_pin: GPIO4
|
||||
|
||||
<<: !include common.yaml
|
||||
5
tests/components/bmp3xx_i2c/test.esp32-idf.yaml
Normal file
5
tests/components/bmp3xx_i2c/test.esp32-idf.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
substitutions:
|
||||
scl_pin: GPIO16
|
||||
sda_pin: GPIO17
|
||||
|
||||
<<: !include common.yaml
|
||||
5
tests/components/bmp3xx_i2c/test.esp32.yaml
Normal file
5
tests/components/bmp3xx_i2c/test.esp32.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
substitutions:
|
||||
scl_pin: GPIO16
|
||||
sda_pin: GPIO17
|
||||
|
||||
<<: !include common.yaml
|
||||
5
tests/components/bmp3xx_i2c/test.esp8266.yaml
Normal file
5
tests/components/bmp3xx_i2c/test.esp8266.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
substitutions:
|
||||
scl_pin: GPIO5
|
||||
sda_pin: GPIO4
|
||||
|
||||
<<: !include common.yaml
|
||||
5
tests/components/bmp3xx_i2c/test.rp2040.yaml
Normal file
5
tests/components/bmp3xx_i2c/test.rp2040.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
substitutions:
|
||||
scl_pin: GPIO5
|
||||
sda_pin: GPIO4
|
||||
|
||||
<<: !include common.yaml
|
||||
16
tests/components/bmp3xx_spi/common.yaml
Normal file
16
tests/components/bmp3xx_spi/common.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
spi:
|
||||
- id: spi_bmp3xx
|
||||
clk_pin: ${clk_pin}
|
||||
mosi_pin: ${mosi_pin}
|
||||
miso_pin: ${miso_pin}
|
||||
|
||||
sensor:
|
||||
- platform: bmp3xx_spi
|
||||
spi_id: spi_bmp3xx
|
||||
cs_pin: ${cs_pin}
|
||||
temperature:
|
||||
name: BMP Temperature
|
||||
oversampling: 16x
|
||||
pressure:
|
||||
name: BMP Pressure
|
||||
iir_filter: 2X
|
||||
7
tests/components/bmp3xx_spi/test.esp32-c3-idf.yaml
Normal file
7
tests/components/bmp3xx_spi/test.esp32-c3-idf.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
substitutions:
|
||||
clk_pin: GPIO6
|
||||
mosi_pin: GPIO7
|
||||
miso_pin: GPIO5
|
||||
cs_pin: GPIO8
|
||||
|
||||
<<: !include common.yaml
|
||||
7
tests/components/bmp3xx_spi/test.esp32-c3.yaml
Normal file
7
tests/components/bmp3xx_spi/test.esp32-c3.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
substitutions:
|
||||
clk_pin: GPIO6
|
||||
mosi_pin: GPIO7
|
||||
miso_pin: GPIO5
|
||||
cs_pin: GPIO8
|
||||
|
||||
<<: !include common.yaml
|
||||
7
tests/components/bmp3xx_spi/test.esp32-idf.yaml
Normal file
7
tests/components/bmp3xx_spi/test.esp32-idf.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
substitutions:
|
||||
clk_pin: GPIO16
|
||||
mosi_pin: GPIO17
|
||||
miso_pin: GPIO15
|
||||
cs_pin: GPIO5
|
||||
|
||||
<<: !include common.yaml
|
||||
7
tests/components/bmp3xx_spi/test.esp32.yaml
Normal file
7
tests/components/bmp3xx_spi/test.esp32.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
substitutions:
|
||||
clk_pin: GPIO16
|
||||
mosi_pin: GPIO17
|
||||
miso_pin: GPIO15
|
||||
cs_pin: GPIO5
|
||||
|
||||
<<: !include common.yaml
|
||||
7
tests/components/bmp3xx_spi/test.esp8266.yaml
Normal file
7
tests/components/bmp3xx_spi/test.esp8266.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
substitutions:
|
||||
clk_pin: GPIO14
|
||||
mosi_pin: GPIO13
|
||||
miso_pin: GPIO12
|
||||
cs_pin: GPIO15
|
||||
|
||||
<<: !include common.yaml
|
||||
7
tests/components/bmp3xx_spi/test.rp2040.yaml
Normal file
7
tests/components/bmp3xx_spi/test.rp2040.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
substitutions:
|
||||
clk_pin: GPIO2
|
||||
mosi_pin: GPIO3
|
||||
miso_pin: GPIO4
|
||||
cs_pin: GPIO5
|
||||
|
||||
<<: !include common.yaml
|
||||
15
tests/components/host/test.host.yaml
Normal file
15
tests/components/host/test.host.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
time:
|
||||
- platform: sntp
|
||||
id: esptime
|
||||
timezone: Australia/Sydney
|
||||
|
||||
logger:
|
||||
level: VERBOSE
|
||||
logs:
|
||||
lvgl: INFO
|
||||
display: DEBUG
|
||||
sensor: INFO
|
||||
vnc: DEBUG
|
||||
|
||||
host:
|
||||
mac_address: "62:23:45:AF:B3:DD"
|
||||
428
tests/components/mqtt/common.yaml
Normal file
428
tests/components/mqtt/common.yaml
Normal file
@@ -0,0 +1,428 @@
|
||||
wifi:
|
||||
ssid: MySSID
|
||||
password: password1
|
||||
|
||||
time:
|
||||
- platform: sntp
|
||||
|
||||
mqtt:
|
||||
broker: "192.168.178.84"
|
||||
port: 1883
|
||||
username: debug
|
||||
password: debug
|
||||
client_id: someclient
|
||||
use_abbreviations: false
|
||||
discovery: true
|
||||
discovery_retain: false
|
||||
discovery_prefix: discovery
|
||||
discovery_unique_id_generator: legacy
|
||||
topic_prefix: helloworld
|
||||
log_topic:
|
||||
topic: helloworld/hi
|
||||
level: INFO
|
||||
birth_message:
|
||||
will_message:
|
||||
shutdown_message:
|
||||
topic: topic/to/send/to
|
||||
payload: hi
|
||||
qos: 2
|
||||
retain: true
|
||||
keepalive: 60s
|
||||
reboot_timeout: 60s
|
||||
on_message:
|
||||
- topic: my/custom/topic
|
||||
qos: 0
|
||||
then:
|
||||
- lambda: >-
|
||||
ESP_LOGD("main", "Got message %s", x.c_str());
|
||||
- topic: bedroom/ota_mode
|
||||
then:
|
||||
- logger.log: Got bedroom/ota_mode
|
||||
- topic: livingroom/ota_mode
|
||||
then:
|
||||
- logger.log: Got livingroom/ota_mode
|
||||
on_json_message:
|
||||
topic: the/topic
|
||||
then:
|
||||
- if:
|
||||
condition:
|
||||
- wifi.connected:
|
||||
- mqtt.connected:
|
||||
then:
|
||||
- logger.log: on_json_message
|
||||
on_connect:
|
||||
- mqtt.publish:
|
||||
topic: some/topic
|
||||
payload: Hello
|
||||
on_disconnect:
|
||||
- mqtt.publish:
|
||||
topic: some/topic
|
||||
payload: Good-bye
|
||||
|
||||
binary_sensor:
|
||||
- platform: template
|
||||
id: some_binary_sensor
|
||||
name: Garage Door Open
|
||||
state_topic: some/topic/binary_sensor
|
||||
qos: 2
|
||||
lambda: |-
|
||||
if (id(template_sens).state > 30) {
|
||||
// Garage Door is open.
|
||||
return true;
|
||||
} else {
|
||||
// Garage Door is closed.
|
||||
return false;
|
||||
}
|
||||
on_state:
|
||||
- mqtt.publish:
|
||||
topic: some/topic/binary_sensor
|
||||
payload: Hello
|
||||
qos: 2
|
||||
retain: true
|
||||
|
||||
button:
|
||||
- platform: template
|
||||
name: "Template Button"
|
||||
state_topic: some/topic/button
|
||||
qos: 2
|
||||
on_press:
|
||||
- mqtt.publish:
|
||||
topic: some/topic/button
|
||||
payload: Hello
|
||||
qos: 2
|
||||
retain: true
|
||||
|
||||
climate:
|
||||
- platform: thermostat
|
||||
name: Test Thermostat
|
||||
sensor: template_sens
|
||||
humidity_sensor: template_sens
|
||||
action_state_topic: some/topicaction_state
|
||||
current_temperature_state_topic: some/topiccurrent_temperature_state
|
||||
current_humidity_state_topic: some/topiccurrent_humidity_state
|
||||
fan_mode_state_topic: some/topicfan_mode_state
|
||||
fan_mode_command_topic: some/topicfan_mode_command
|
||||
mode_state_topic: some/topicmode_state
|
||||
mode_command_topic: some/topicmode_command
|
||||
preset_state_topic: some/topicpreset_state
|
||||
preset_command_topic: some/topicpreset_command
|
||||
swing_mode_state_topic: some/topicswing_mode_state
|
||||
swing_mode_command_topic: some/topicswing_mode_command
|
||||
target_temperature_state_topic: some/topictarget_temperature_state
|
||||
target_temperature_command_topic: some/topictarget_temperature_command
|
||||
target_temperature_high_state_topic: some/topictarget_temperature_high_state
|
||||
target_temperature_high_command_topic: some/topictarget_temperature_high_command
|
||||
target_temperature_low_state_topic: some/topictarget_temperature_low_state
|
||||
target_temperature_low_command_topic: some/topictarget_temperature_low_command
|
||||
target_humidity_state_topic: some/topictarget_humidity_state
|
||||
target_humidity_command_topic: some/topictarget_humidity_command
|
||||
preset:
|
||||
- name: Default Preset
|
||||
default_target_temperature_low: 18°C
|
||||
default_target_temperature_high: 24°C
|
||||
- name: Away
|
||||
default_target_temperature_low: 16°C
|
||||
default_target_temperature_high: 20°C
|
||||
idle_action:
|
||||
- logger.log: idle_action
|
||||
cool_action:
|
||||
- logger.log: cool_action
|
||||
supplemental_cooling_action:
|
||||
- logger.log: supplemental_cooling_action
|
||||
heat_action:
|
||||
- logger.log: heat_action
|
||||
supplemental_heating_action:
|
||||
- logger.log: supplemental_heating_action
|
||||
dry_action:
|
||||
- logger.log: dry_action
|
||||
fan_only_action:
|
||||
- logger.log: fan_only_action
|
||||
auto_mode:
|
||||
- logger.log: auto_mode
|
||||
off_mode:
|
||||
- logger.log: off_mode
|
||||
heat_mode:
|
||||
- logger.log: heat_mode
|
||||
cool_mode:
|
||||
- logger.log: cool_mode
|
||||
dry_mode:
|
||||
- logger.log: dry_mode
|
||||
fan_only_mode:
|
||||
- logger.log: fan_only_mode
|
||||
fan_mode_auto_action:
|
||||
- logger.log: fan_mode_auto_action
|
||||
fan_mode_on_action:
|
||||
- logger.log: fan_mode_on_action
|
||||
fan_mode_off_action:
|
||||
- logger.log: fan_mode_off_action
|
||||
fan_mode_low_action:
|
||||
- logger.log: fan_mode_low_action
|
||||
fan_mode_medium_action:
|
||||
- logger.log: fan_mode_medium_action
|
||||
fan_mode_high_action:
|
||||
- logger.log: fan_mode_high_action
|
||||
fan_mode_middle_action:
|
||||
- logger.log: fan_mode_middle_action
|
||||
fan_mode_focus_action:
|
||||
- logger.log: fan_mode_focus_action
|
||||
fan_mode_diffuse_action:
|
||||
- logger.log: fan_mode_diffuse_action
|
||||
fan_mode_quiet_action:
|
||||
- logger.log: fan_mode_quiet_action
|
||||
swing_off_action:
|
||||
- logger.log: swing_off_action
|
||||
swing_horizontal_action:
|
||||
- logger.log: swing_horizontal_action
|
||||
swing_vertical_action:
|
||||
- logger.log: swing_vertical_action
|
||||
swing_both_action:
|
||||
- logger.log: swing_both_action
|
||||
startup_delay: true
|
||||
supplemental_cooling_delta: 2.0
|
||||
cool_deadband: 0.5
|
||||
cool_overrun: 0.5
|
||||
min_cooling_off_time: 300s
|
||||
min_cooling_run_time: 300s
|
||||
max_cooling_run_time: 600s
|
||||
supplemental_heating_delta: 2.0
|
||||
heat_deadband: 0.5
|
||||
heat_overrun: 0.5
|
||||
min_heating_off_time: 300s
|
||||
min_heating_run_time: 300s
|
||||
max_heating_run_time: 600s
|
||||
min_fanning_off_time: 30s
|
||||
min_fanning_run_time: 30s
|
||||
min_fan_mode_switching_time: 15s
|
||||
min_idle_time: 30s
|
||||
set_point_minimum_differential: 0.5
|
||||
fan_only_action_uses_fan_mode_timer: true
|
||||
fan_only_cooling: true
|
||||
fan_with_cooling: true
|
||||
fan_with_heating: true
|
||||
|
||||
cover:
|
||||
- platform: template
|
||||
name: Template Cover
|
||||
state_topic: some/topic/cover
|
||||
qos: 2
|
||||
lambda: |-
|
||||
if (id(some_binary_sensor).state) {
|
||||
return COVER_OPEN;
|
||||
} else {
|
||||
return COVER_CLOSED;
|
||||
}
|
||||
open_action:
|
||||
- logger.log: open_action
|
||||
close_action:
|
||||
- logger.log: close_action
|
||||
stop_action:
|
||||
- logger.log: stop_action
|
||||
optimistic: true
|
||||
|
||||
datetime:
|
||||
- platform: template
|
||||
name: Date
|
||||
id: test_date
|
||||
type: date
|
||||
state_topic: some/topic/date
|
||||
qos: 2
|
||||
set_action:
|
||||
- logger.log: "set_value"
|
||||
on_value:
|
||||
- logger.log:
|
||||
format: "Date: %04d-%02d-%02d"
|
||||
args:
|
||||
- x.year
|
||||
- x.month
|
||||
- x.day_of_month
|
||||
- platform: template
|
||||
name: Time
|
||||
id: test_time
|
||||
type: time
|
||||
state_topic: some/topic/time
|
||||
qos: 2
|
||||
set_action:
|
||||
- logger.log: "set_value"
|
||||
on_value:
|
||||
- logger.log:
|
||||
format: "Time: %02d:%02d:%02d"
|
||||
args:
|
||||
- x.hour
|
||||
- x.minute
|
||||
- x.second
|
||||
- platform: template
|
||||
name: DateTime
|
||||
id: test_datetime
|
||||
type: datetime
|
||||
state_topic: some/topic/datetime
|
||||
qos: 2
|
||||
set_action:
|
||||
- logger.log: set_value
|
||||
on_value:
|
||||
- logger.log:
|
||||
format: "DateTime: %04d-%02d-%02d %02d:%02d:%02d"
|
||||
args:
|
||||
- x.year
|
||||
- x.month
|
||||
- x.day_of_month
|
||||
- x.hour
|
||||
- x.minute
|
||||
- x.second
|
||||
|
||||
event:
|
||||
- platform: template
|
||||
name: Template Event
|
||||
state_topic: some/topic/event
|
||||
qos: 2
|
||||
event_types:
|
||||
- "custom_event_1"
|
||||
- "custom_event_2"
|
||||
|
||||
fan:
|
||||
- platform: template
|
||||
name: Template Fan
|
||||
state_topic: some/topic/fan
|
||||
qos: 2
|
||||
on_state:
|
||||
- logger.log: on_state
|
||||
on_speed_set:
|
||||
- logger.log: on_speed_set
|
||||
|
||||
light:
|
||||
- platform: binary
|
||||
name: Desk Lamp
|
||||
output: light_output
|
||||
state_topic: some/topic/light
|
||||
qos: 2
|
||||
|
||||
output:
|
||||
- id: light_output
|
||||
platform: gpio
|
||||
pin: 0
|
||||
|
||||
lock:
|
||||
- platform: template
|
||||
name: "Template Lock"
|
||||
state_topic: some/topic/lock
|
||||
qos: 2
|
||||
lambda: |-
|
||||
if (id(some_binary_sensor).state) {
|
||||
return LOCK_STATE_LOCKED;
|
||||
} else {
|
||||
return LOCK_STATE_UNLOCKED;
|
||||
}
|
||||
lock_action:
|
||||
- logger.log: lock_action
|
||||
unlock_action:
|
||||
- logger.log: unlock_action
|
||||
open_action:
|
||||
- logger.log: open_action
|
||||
|
||||
number:
|
||||
- platform: template
|
||||
name: "Template number"
|
||||
state_topic: some/topic/number
|
||||
qos: 2
|
||||
optimistic: true
|
||||
min_value: 0
|
||||
max_value: 100
|
||||
step: 1
|
||||
|
||||
select:
|
||||
- platform: template
|
||||
name: "Template select"
|
||||
state_topic: some/topic/select
|
||||
qos: 2
|
||||
optimistic: true
|
||||
options:
|
||||
- one
|
||||
- two
|
||||
- three
|
||||
initial_option: two
|
||||
|
||||
sensor:
|
||||
- platform: template
|
||||
name: Template Sensor
|
||||
id: template_sens
|
||||
lambda: |-
|
||||
if (id(some_binary_sensor).state) {
|
||||
return 42.0;
|
||||
} else {
|
||||
return 0.0;
|
||||
}
|
||||
update_interval: 60s
|
||||
on_value:
|
||||
- mqtt.publish:
|
||||
topic: some/topic/sensor
|
||||
payload: Hello
|
||||
qos: 2
|
||||
retain: true
|
||||
- platform: mqtt_subscribe
|
||||
name: MQTT Subscribe Sensor
|
||||
topic: mqtt/topic
|
||||
id: the_sensor
|
||||
qos: 2
|
||||
on_value:
|
||||
- mqtt.publish_json:
|
||||
topic: the/topic
|
||||
payload: |-
|
||||
root["key"] = id(template_sens).state;
|
||||
root["greeting"] = "Hello World";
|
||||
|
||||
switch:
|
||||
- platform: template
|
||||
name: Template Switch
|
||||
state_topic: some/topic/switch
|
||||
qos: 2
|
||||
lambda: |-
|
||||
if (id(some_binary_sensor).state) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
turn_on_action:
|
||||
- logger.log: turn_on_action
|
||||
turn_off_action:
|
||||
- logger.log: turn_off_action
|
||||
|
||||
text_sensor:
|
||||
- platform: template
|
||||
name: Template Text Sensor
|
||||
id: tts_text
|
||||
state_topic: some/topic/text_sensor
|
||||
qos: 2
|
||||
- platform: mqtt_subscribe
|
||||
name: MQTT Subscribe Text
|
||||
topic: some/topic/text_sensor
|
||||
qos: 2
|
||||
on_value:
|
||||
- text_sensor.template.publish:
|
||||
id: tts_text
|
||||
state: Hello World
|
||||
- text_sensor.template.publish:
|
||||
id: tts_text
|
||||
state: |-
|
||||
return "Hello World2";
|
||||
|
||||
text:
|
||||
- platform: template
|
||||
name: Template Text
|
||||
optimistic: true
|
||||
min_length: 0
|
||||
max_length: 100
|
||||
mode: text
|
||||
state_topic: some/topic/text
|
||||
qos: 2
|
||||
|
||||
valve:
|
||||
- platform: template
|
||||
name: Template Valve
|
||||
state_topic: some/topic/valve
|
||||
qos: 2
|
||||
optimistic: true
|
||||
lambda: |-
|
||||
if (id(some_binary_sensor).state) {
|
||||
return VALVE_OPEN;
|
||||
} else {
|
||||
return VALVE_CLOSED;
|
||||
}
|
||||
2
tests/components/mqtt/test.bk72xx.yaml
Normal file
2
tests/components/mqtt/test.bk72xx.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
packages:
|
||||
common: !include common.yaml
|
||||
@@ -1,16 +1,2 @@
|
||||
wifi:
|
||||
ssid: MySSID
|
||||
password: password1
|
||||
|
||||
mqtt:
|
||||
broker: test.mosquitto.org
|
||||
port: 1883
|
||||
discovery: true
|
||||
discovery_prefix: homeassistant
|
||||
idf_send_async: false
|
||||
log_topic:
|
||||
on_message:
|
||||
topic: testing/sensor/testing_sensor/state
|
||||
qos: 0
|
||||
then:
|
||||
- logger.log: Mqtt Test
|
||||
packages:
|
||||
common: !include common.yaml
|
||||
|
||||
@@ -1,15 +1,2 @@
|
||||
wifi:
|
||||
ssid: MySSID
|
||||
password: password1
|
||||
|
||||
mqtt:
|
||||
broker: test.mosquitto.org
|
||||
port: 1883
|
||||
discovery: true
|
||||
discovery_prefix: homeassistant
|
||||
log_topic:
|
||||
on_message:
|
||||
topic: testing/sensor/testing_sensor/state
|
||||
qos: 0
|
||||
then:
|
||||
- logger.log: Mqtt Test
|
||||
packages:
|
||||
common: !include common.yaml
|
||||
|
||||
@@ -1,16 +1,2 @@
|
||||
wifi:
|
||||
ssid: MySSID
|
||||
password: password1
|
||||
|
||||
mqtt:
|
||||
broker: test.mosquitto.org
|
||||
port: 1883
|
||||
discovery: true
|
||||
discovery_prefix: homeassistant
|
||||
idf_send_async: false
|
||||
log_topic:
|
||||
on_message:
|
||||
topic: testing/sensor/testing_sensor/state
|
||||
qos: 0
|
||||
then:
|
||||
- logger.log: Mqtt Test
|
||||
packages:
|
||||
common: !include common.yaml
|
||||
|
||||
@@ -1,15 +1,2 @@
|
||||
wifi:
|
||||
ssid: MySSID
|
||||
password: password1
|
||||
|
||||
mqtt:
|
||||
broker: test.mosquitto.org
|
||||
port: 1883
|
||||
discovery: true
|
||||
discovery_prefix: homeassistant
|
||||
log_topic:
|
||||
on_message:
|
||||
topic: testing/sensor/testing_sensor/state
|
||||
qos: 0
|
||||
then:
|
||||
- logger.log: Mqtt Test
|
||||
packages:
|
||||
common: !include common.yaml
|
||||
|
||||
@@ -1,15 +1,2 @@
|
||||
wifi:
|
||||
ssid: MySSID
|
||||
password: password1
|
||||
|
||||
mqtt:
|
||||
broker: test.mosquitto.org
|
||||
port: 1883
|
||||
discovery: true
|
||||
discovery_prefix: homeassistant
|
||||
log_topic:
|
||||
on_message:
|
||||
topic: testing/sensor/testing_sensor/state
|
||||
qos: 0
|
||||
then:
|
||||
- logger.log: Mqtt Test
|
||||
packages:
|
||||
common: !include common.yaml
|
||||
|
||||
55
tests/components/script/common.yaml
Normal file
55
tests/components/script/common.yaml
Normal file
@@ -0,0 +1,55 @@
|
||||
esphome:
|
||||
on_boot:
|
||||
then:
|
||||
- script.execute: my_script
|
||||
- script.execute:
|
||||
id: my_script_with_params
|
||||
prefix: "Test"
|
||||
param2: 0
|
||||
param3: true
|
||||
- script.wait: my_script
|
||||
- script.stop: my_script
|
||||
- if:
|
||||
condition:
|
||||
- script.is_running: my_script
|
||||
then:
|
||||
- logger.log: my_script is running
|
||||
|
||||
script:
|
||||
- id: my_script
|
||||
mode: single
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", "Hello World!");'
|
||||
- id: my_script_queued
|
||||
mode: queued
|
||||
max_runs: 2
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", "Hello World!");'
|
||||
- id: my_script_parallel
|
||||
mode: parallel
|
||||
max_runs: 2
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", "Hello World!");'
|
||||
- id: my_script_restart
|
||||
mode: restart
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", "Hello World!");'
|
||||
- id: my_script_with_params
|
||||
parameters:
|
||||
prefix: string
|
||||
param2: uint8_t
|
||||
param3: bool
|
||||
then:
|
||||
- lambda: 'ESP_LOGD(prefix.c_str(), "Hello World! %u %u", param2, param3);'
|
||||
- if:
|
||||
condition:
|
||||
for:
|
||||
time: !lambda "return param2;"
|
||||
condition:
|
||||
script.is_running: my_script
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", "API has stayed connected for at least %u minutes", param2);'
|
||||
- repeat:
|
||||
count: 5
|
||||
then:
|
||||
- logger.log: looping!
|
||||
1
tests/components/script/test.bk72xx.yaml
Normal file
1
tests/components/script/test.bk72xx.yaml
Normal file
@@ -0,0 +1 @@
|
||||
<<: !include common.yaml
|
||||
@@ -1,26 +1 @@
|
||||
script:
|
||||
- id: my_script
|
||||
mode: single
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", "Hello World!");'
|
||||
- id: my_script_queued
|
||||
mode: queued
|
||||
max_runs: 2
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", "Hello World!");'
|
||||
- id: my_script_parallel
|
||||
mode: parallel
|
||||
max_runs: 2
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", "Hello World!");'
|
||||
- id: my_script_restart
|
||||
mode: restart
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", "Hello World!");'
|
||||
- id: my_script_with_params
|
||||
parameters:
|
||||
prefix: string
|
||||
param2: int
|
||||
param3: bool
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", (prefix + " Hello World!" + to_string(param2) + " " + to_string(param3)).c_str());'
|
||||
<<: !include common.yaml
|
||||
|
||||
@@ -1,26 +1 @@
|
||||
script:
|
||||
- id: my_script
|
||||
mode: single
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", "Hello World!");'
|
||||
- id: my_script_queued
|
||||
mode: queued
|
||||
max_runs: 2
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", "Hello World!");'
|
||||
- id: my_script_parallel
|
||||
mode: parallel
|
||||
max_runs: 2
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", "Hello World!");'
|
||||
- id: my_script_restart
|
||||
mode: restart
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", "Hello World!");'
|
||||
- id: my_script_with_params
|
||||
parameters:
|
||||
prefix: string
|
||||
param2: int
|
||||
param3: bool
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", (prefix + " Hello World!" + to_string(param2) + " " + to_string(param3)).c_str());'
|
||||
<<: !include common.yaml
|
||||
|
||||
@@ -1,26 +1 @@
|
||||
script:
|
||||
- id: my_script
|
||||
mode: single
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", "Hello World!");'
|
||||
- id: my_script_queued
|
||||
mode: queued
|
||||
max_runs: 2
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", "Hello World!");'
|
||||
- id: my_script_parallel
|
||||
mode: parallel
|
||||
max_runs: 2
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", "Hello World!");'
|
||||
- id: my_script_restart
|
||||
mode: restart
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", "Hello World!");'
|
||||
- id: my_script_with_params
|
||||
parameters:
|
||||
prefix: string
|
||||
param2: int
|
||||
param3: bool
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", (prefix + " Hello World!" + to_string(param2) + " " + to_string(param3)).c_str());'
|
||||
<<: !include common.yaml
|
||||
|
||||
@@ -1,26 +1 @@
|
||||
script:
|
||||
- id: my_script
|
||||
mode: single
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", "Hello World!");'
|
||||
- id: my_script_queued
|
||||
mode: queued
|
||||
max_runs: 2
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", "Hello World!");'
|
||||
- id: my_script_parallel
|
||||
mode: parallel
|
||||
max_runs: 2
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", "Hello World!");'
|
||||
- id: my_script_restart
|
||||
mode: restart
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", "Hello World!");'
|
||||
- id: my_script_with_params
|
||||
parameters:
|
||||
prefix: string
|
||||
param2: int
|
||||
param3: bool
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", (prefix + " Hello World!" + to_string(param2) + " " + to_string(param3)).c_str());'
|
||||
<<: !include common.yaml
|
||||
|
||||
@@ -1,26 +1 @@
|
||||
script:
|
||||
- id: my_script
|
||||
mode: single
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", "Hello World!");'
|
||||
- id: my_script_queued
|
||||
mode: queued
|
||||
max_runs: 2
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", "Hello World!");'
|
||||
- id: my_script_parallel
|
||||
mode: parallel
|
||||
max_runs: 2
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", "Hello World!");'
|
||||
- id: my_script_restart
|
||||
mode: restart
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", "Hello World!");'
|
||||
- id: my_script_with_params
|
||||
parameters:
|
||||
prefix: string
|
||||
param2: int
|
||||
param3: bool
|
||||
then:
|
||||
- lambda: 'ESP_LOGD(prefix.c_str(), "Hello World! %i %i", param2, param3);'
|
||||
<<: !include common.yaml
|
||||
|
||||
@@ -1,26 +1 @@
|
||||
script:
|
||||
- id: my_script
|
||||
mode: single
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", "Hello World!");'
|
||||
- id: my_script_queued
|
||||
mode: queued
|
||||
max_runs: 2
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", "Hello World!");'
|
||||
- id: my_script_parallel
|
||||
mode: parallel
|
||||
max_runs: 2
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", "Hello World!");'
|
||||
- id: my_script_restart
|
||||
mode: restart
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", "Hello World!");'
|
||||
- id: my_script_with_params
|
||||
parameters:
|
||||
prefix: string
|
||||
param2: int
|
||||
param3: bool
|
||||
then:
|
||||
- lambda: 'ESP_LOGD("main", (prefix + " Hello World!" + to_string(param2) + " " + to_string(param3)).c_str());'
|
||||
<<: !include common.yaml
|
||||
|
||||
@@ -149,6 +149,17 @@ text:
|
||||
min_length: 0
|
||||
max_length: 100
|
||||
mode: text
|
||||
- platform: template
|
||||
name: "Template text lambda"
|
||||
mode: text
|
||||
update_interval: 1s
|
||||
lambda: |
|
||||
return std::string{"Hello!"};
|
||||
set_action:
|
||||
then:
|
||||
- logger.log:
|
||||
format: Template Text set to %s
|
||||
args: ["x.c_str()"]
|
||||
|
||||
alarm_control_panel:
|
||||
- platform: template
|
||||
|
||||
@@ -83,6 +83,24 @@ display:
|
||||
full_update_every: 30
|
||||
lambda: |-
|
||||
it.rectangle(0, 0, it.get_width(), it.get_height());
|
||||
- platform: waveshare_epaper
|
||||
model: 2.90in-dke
|
||||
spi_id: spi_id_1
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO25
|
||||
dc_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO26
|
||||
busy_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO27
|
||||
reset_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO32
|
||||
full_update_every: 1
|
||||
lambda: |-
|
||||
it.rectangle(0, 0, it.get_width(), it.get_height());
|
||||
- platform: waveshare_epaper
|
||||
model: 2.70in-b
|
||||
spi_id: spi_id_1
|
||||
|
||||
@@ -498,15 +498,6 @@ sensor:
|
||||
co2:
|
||||
name: CO2 Sensor
|
||||
|
||||
- platform: bmp3xx
|
||||
temperature:
|
||||
name: BMP Temperature
|
||||
oversampling: 16x
|
||||
pressure:
|
||||
name: BMP Pressure
|
||||
address: 0x77
|
||||
iir_filter: 2X
|
||||
|
||||
- platform: sen5x
|
||||
id: sen54
|
||||
temperature:
|
||||
|
||||
@@ -474,15 +474,6 @@ sensor:
|
||||
co2:
|
||||
name: CO2 Sensor
|
||||
|
||||
- platform: bmp3xx
|
||||
temperature:
|
||||
name: BMP Temperature
|
||||
oversampling: 16x
|
||||
pressure:
|
||||
name: BMP Pressure
|
||||
address: 0x77
|
||||
iir_filter: 2X
|
||||
|
||||
- platform: ms8607
|
||||
temperature:
|
||||
name: Temperature
|
||||
|
||||
@@ -12,8 +12,4 @@ packages:
|
||||
component_under_test: !include
|
||||
file: $component_test_file
|
||||
vars:
|
||||
component_name: $component_name
|
||||
test_name: $test_name
|
||||
target_platform: $target_platform
|
||||
component_test_file: $component_test_file
|
||||
component_dir: "../../components/$component_name"
|
||||
|
||||
@@ -14,8 +14,4 @@ packages:
|
||||
component_under_test: !include
|
||||
file: $component_test_file
|
||||
vars:
|
||||
component_name: $component_name
|
||||
test_name: $test_name
|
||||
target_platform: $target_platform
|
||||
component_test_file: $component_test_file
|
||||
component_dir: "../../components/$component_name"
|
||||
|
||||
@@ -14,8 +14,4 @@ packages:
|
||||
component_under_test: !include
|
||||
file: $component_test_file
|
||||
vars:
|
||||
component_name: $component_name
|
||||
test_name: $test_name
|
||||
target_platform: $target_platform
|
||||
component_test_file: $component_test_file
|
||||
component_dir: "../../components/$component_name"
|
||||
|
||||
@@ -14,8 +14,4 @@ packages:
|
||||
component_under_test: !include
|
||||
file: $component_test_file
|
||||
vars:
|
||||
component_name: $component_name
|
||||
test_name: $test_name
|
||||
target_platform: $target_platform
|
||||
component_test_file: $component_test_file
|
||||
component_dir: "../../components/$component_name"
|
||||
|
||||
@@ -14,8 +14,4 @@ packages:
|
||||
component_under_test: !include
|
||||
file: $component_test_file
|
||||
vars:
|
||||
component_name: $component_name
|
||||
test_name: $test_name
|
||||
target_platform: $target_platform
|
||||
component_test_file: $component_test_file
|
||||
component_dir: "../../components/$component_name"
|
||||
|
||||
@@ -15,8 +15,4 @@ packages:
|
||||
component_under_test: !include
|
||||
file: $component_test_file
|
||||
vars:
|
||||
component_name: $component_name
|
||||
test_name: $test_name
|
||||
target_platform: $target_platform
|
||||
component_test_file: $component_test_file
|
||||
component_dir: "../../components/$component_name"
|
||||
|
||||
@@ -15,8 +15,4 @@ packages:
|
||||
component_under_test: !include
|
||||
file: $component_test_file
|
||||
vars:
|
||||
component_name: $component_name
|
||||
test_name: $test_name
|
||||
target_platform: $target_platform
|
||||
component_test_file: $component_test_file
|
||||
component_dir: "../../components/$component_name"
|
||||
|
||||
@@ -15,8 +15,4 @@ packages:
|
||||
component_under_test: !include
|
||||
file: $component_test_file
|
||||
vars:
|
||||
component_name: $component_name
|
||||
test_name: $test_name
|
||||
target_platform: $target_platform
|
||||
component_test_file: $component_test_file
|
||||
component_dir: "../../components/$component_name"
|
||||
|
||||
@@ -15,8 +15,4 @@ packages:
|
||||
component_under_test: !include
|
||||
file: $component_test_file
|
||||
vars:
|
||||
component_name: $component_name
|
||||
test_name: $test_name
|
||||
target_platform: $target_platform
|
||||
component_test_file: $component_test_file
|
||||
component_dir: "../../components/$component_name"
|
||||
|
||||
@@ -12,8 +12,4 @@ packages:
|
||||
component_under_test: !include
|
||||
file: $component_test_file
|
||||
vars:
|
||||
component_name: $component_name
|
||||
test_name: $test_name
|
||||
target_platform: $target_platform
|
||||
component_test_file: $component_test_file
|
||||
component_dir: "../../components/$component_name"
|
||||
|
||||
@@ -12,8 +12,4 @@ packages:
|
||||
component_under_test: !include
|
||||
file: $component_test_file
|
||||
vars:
|
||||
component_name: $component_name
|
||||
test_name: $test_name
|
||||
target_platform: $target_platform
|
||||
component_test_file: $component_test_file
|
||||
component_dir: "../../components/$component_name"
|
||||
|
||||
@@ -15,8 +15,4 @@ packages:
|
||||
component_under_test: !include
|
||||
file: $component_test_file
|
||||
vars:
|
||||
component_name: $component_name
|
||||
test_name: $test_name
|
||||
target_platform: $target_platform
|
||||
component_test_file: $component_test_file
|
||||
component_dir: "../../components/$component_name"
|
||||
|
||||
Reference in New Issue
Block a user