mirror of
https://github.com/esphome/esphome.git
synced 2026-02-28 09:54:19 -07:00
200 lines
4.1 KiB
YAML
200 lines
4.1 KiB
YAML
esphome:
|
|
name: device-id-state-test
|
|
# Define areas
|
|
areas:
|
|
- id: living_room
|
|
name: Living Room
|
|
- id: bedroom
|
|
name: Bedroom
|
|
# Define devices
|
|
devices:
|
|
- id: temperature_monitor
|
|
name: Temperature Monitor
|
|
area_id: living_room
|
|
- id: humidity_monitor
|
|
name: Humidity Monitor
|
|
area_id: bedroom
|
|
- id: motion_sensor
|
|
name: Motion Sensor
|
|
area_id: living_room
|
|
|
|
host:
|
|
api:
|
|
logger:
|
|
|
|
# Test different entity types with device assignments
|
|
sensor:
|
|
- platform: template
|
|
name: Temperature
|
|
device_id: temperature_monitor
|
|
lambda: return 25.5;
|
|
update_interval: 0.1s
|
|
unit_of_measurement: "°C"
|
|
|
|
- platform: template
|
|
name: Humidity
|
|
device_id: humidity_monitor
|
|
lambda: return 65.0;
|
|
update_interval: 0.1s
|
|
unit_of_measurement: "%"
|
|
|
|
# Test entity without device_id (should have device_id 0)
|
|
- platform: template
|
|
name: No Device Sensor
|
|
lambda: return 100.0;
|
|
update_interval: 0.1s
|
|
|
|
binary_sensor:
|
|
- platform: template
|
|
id: motion_detected
|
|
name: Motion Detected
|
|
device_id: motion_sensor
|
|
lambda: return true;
|
|
|
|
switch:
|
|
- platform: template
|
|
name: Temperature Monitor Power
|
|
device_id: temperature_monitor
|
|
lambda: return true;
|
|
turn_on_action:
|
|
- lambda: |-
|
|
ESP_LOGD("test", "Turning on");
|
|
turn_off_action:
|
|
- lambda: |-
|
|
ESP_LOGD("test", "Turning off");
|
|
|
|
text_sensor:
|
|
- platform: template
|
|
name: Temperature Status
|
|
device_id: temperature_monitor
|
|
lambda: return {"Normal"};
|
|
update_interval: 0.1s
|
|
|
|
light:
|
|
- platform: binary
|
|
name: Motion Light
|
|
device_id: motion_sensor
|
|
output: motion_light_output
|
|
|
|
output:
|
|
- platform: template
|
|
id: motion_light_output
|
|
type: binary
|
|
write_action:
|
|
- lambda: |-
|
|
ESP_LOGD("test", "Light output: %d", state);
|
|
|
|
cover:
|
|
- platform: template
|
|
name: Garage Door
|
|
device_id: motion_sensor
|
|
optimistic: true
|
|
|
|
fan:
|
|
- platform: template
|
|
name: Ceiling Fan
|
|
device_id: humidity_monitor
|
|
speed_count: 3
|
|
has_oscillating: false
|
|
has_direction: false
|
|
|
|
lock:
|
|
- platform: template
|
|
name: Front Door Lock
|
|
device_id: motion_sensor
|
|
optimistic: true
|
|
|
|
number:
|
|
- platform: template
|
|
name: Target Temperature
|
|
device_id: temperature_monitor
|
|
optimistic: true
|
|
min_value: 0
|
|
max_value: 100
|
|
step: 1
|
|
|
|
select:
|
|
- platform: template
|
|
name: Mode Select
|
|
device_id: humidity_monitor
|
|
optimistic: true
|
|
options:
|
|
- "Auto"
|
|
- "Manual"
|
|
|
|
text:
|
|
- platform: template
|
|
name: Device Label
|
|
device_id: temperature_monitor
|
|
optimistic: true
|
|
mode: text
|
|
|
|
valve:
|
|
- platform: template
|
|
name: Water Valve
|
|
device_id: humidity_monitor
|
|
optimistic: true
|
|
|
|
globals:
|
|
- id: global_away
|
|
type: bool
|
|
initial_value: "false"
|
|
- id: global_is_on
|
|
type: bool
|
|
initial_value: "true"
|
|
|
|
water_heater:
|
|
- platform: template
|
|
name: Test Boiler
|
|
device_id: temperature_monitor
|
|
optimistic: true
|
|
current_temperature: !lambda "return 45.0f;"
|
|
target_temperature: !lambda "return 60.0f;"
|
|
away: !lambda "return id(global_away);"
|
|
is_on: !lambda "return id(global_is_on);"
|
|
supported_modes:
|
|
- "off"
|
|
- electric
|
|
visual:
|
|
min_temperature: 30.0
|
|
max_temperature: 85.0
|
|
target_temperature_step: 0.5
|
|
set_action:
|
|
- lambda: |-
|
|
ESP_LOGD("test", "Water heater set");
|
|
|
|
alarm_control_panel:
|
|
- platform: template
|
|
name: House Alarm
|
|
device_id: motion_sensor
|
|
codes:
|
|
- "1234"
|
|
restore_mode: ALWAYS_DISARMED
|
|
binary_sensors:
|
|
- input: motion_detected
|
|
|
|
datetime:
|
|
- platform: template
|
|
name: Schedule Date
|
|
device_id: temperature_monitor
|
|
type: date
|
|
optimistic: true
|
|
- platform: template
|
|
name: Schedule Time
|
|
device_id: humidity_monitor
|
|
type: time
|
|
optimistic: true
|
|
- platform: template
|
|
name: Schedule DateTime
|
|
device_id: motion_sensor
|
|
type: datetime
|
|
optimistic: true
|
|
|
|
event:
|
|
- platform: template
|
|
name: Doorbell
|
|
device_id: motion_sensor
|
|
event_types:
|
|
- "press"
|
|
- "double_press"
|