-
Notifications
You must be signed in to change notification settings - Fork 6
/
fanmaster.yaml
120 lines (102 loc) · 2.42 KB
/
fanmaster.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
substitutions:
device_name: fanmaster
device_description: FanMaster Fan controller
friendly_name: fanmaster
esphome:
name: ${device_name}
comment: ${device_description}
platform: ESP8266
board: nodemcuv2
on_boot:
- priority: 200.0
then:
- output.set_level:
id: pwmfan
level: 100%
wifi:
ssid: !secret ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: ${friendly_name}_AP
password: !secret wifi_password
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
password: !secret api_password
# Enable OTA
ota:
password: !secret api_password
switch:
- platform: restart
name: ${friendly_name} Restart
binary_sensor:
# Reports if this device is Connected or not
- platform: status
name: ${friendly_name} Status
sensor:
# Reports the WiFi signal strength
- platform: wifi_signal
name: ${friendly_name} Signal
update_interval: 60s
# Reports RPM by pulse_counter
- platform: pulse_counter
pin: D7
name: ${friendly_name} Fan Speed
unit_of_measurement: 'RPM'
filters:
- multiply: 0.5
- lambda: |-
if (x <= 1500) return x;
else return {};
count_mode:
rising_edge: INCREMENT
falling_edge: DISABLE
update_interval: 30s
# Reports how long the device has been powered (in minutes)
- platform: uptime
name: ${friendly_name} Uptime
filters:
- lambda: return x / 60.0;
unit_of_measurement: minutes
text_sensor:
# Reports the ESPHome Version with compile date
- platform: version
name: ${friendly_name} ESPHome Version
# Reports WiFi name
- platform: wifi_info
ssid:
name: ${friendly_name} WiFi
# Reports IP
- platform: wifi_info
ip_address:
name: ${friendly_name} IP
status_led:
pin:
number: D0
inverted: False
output:
- platform: gpio
pin: D5
id: fan_supply
- platform: esp8266_pwm
pin: D6
frequency: 25000 Hz
id: pwmfan
fan:
- platform: speed
output: pwmfan
name: ${friendly_name} Fan
on_turn_on:
- output.turn_on: fan_supply
- logger.log: "Power of Fan turned ON"
on_turn_off:
- output.turn_off: fan_supply
- logger.log: "Power of Fan turned OFF"
- delay: 1s
- logger.log: "Write 100%% to output pwmfan"
- output.set_level:
id: pwmfan
level: 100%