-
Notifications
You must be signed in to change notification settings - Fork 20
/
plug06.yaml
executable file
·63 lines (51 loc) · 1.32 KB
/
plug06.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---
# Luntak brand Tuya Plug (plug06)
#
substitutions:
friendly_name: WirelessAP2 power cycler
id: wirelessap2_power_cycler
hostname: plug-wirelessap2
ip: 10.0.20.66
<<: !include common/substitutions/gpio/tuya_plug.yaml
esphome:
friendly_name: $friendly_name
name: $hostname
esp8266:
board: esp01_1m
framework:
version: recommended
<<: !include common/esphome/leds/status.yaml
<<: !include common/common.yaml
binary_sensor:
- !include common/binary_sensors/power_button_inverted.yaml
light:
- !include common/lights/status_led.yaml
output:
- !include common/outputs/status_led.yaml
switch:
- platform: gpio
#name: $friendly_name
id: relay
pin: $relay_gpio
internal: true
restore_mode: ALWAYS_ON # On at boot
# Restart after slight delay.
on_turn_off:
- delay: 15s
- switch.turn_on: relay
- !include common/switches/relay_status_led.yaml
text_sensor:
- platform: homeassistant
id: online_state
internal: true
entity_id: device_tracker.wirelessap2
on_value:
#- lambda: ESP_LOGD("online_state", "%s", id(online_state));
- if:
condition:
for:
time: 10min
condition:
- lambda: return id(online_state).state != "home";
then:
- switch.turn_off: relay