This is my last ditch effort to cool down my attic PoE switch that runs my cameras.. of course I had to hook it all up to Home Assistant to monitor the temps and control the PWM fans!
The code for the ESP32:
text_sensor:
Send IP Address
- platform: wifi_info
ip_address:
name: Fanhub IP Address
Send Uptime in raw seconds
- platform: template
name: Fanhub Uptime
id: uptime_human
icon: mdi:clock-start
sensor:
- platform: wifi_signal
name: Fanhub WiFi Strength
update_interval: 30s
- platform: dht
pin: GPIO15
temperature:
name: "Temperature"
humidity:
name: "Humidity"
update_interval: 10s
- platform: pulse_counter
pin: GPIO13
name: Fanhub Fan Speed1
id: fan_pulse1
unit_of_measurement: 'RPM'
filters:
- multiply: 0.5
count_mode:
rising_edge: INCREMENT
falling_edge: DISABLE
update_interval: 3s
- platform: uptime
name: Fanhub Uptime
id: uptime_sensor
update_interval: 60s
on_raw_value:
then:
- text_sensor.template.publish:
id: uptime_human
Custom C++ code to generate the result
state: !lambda |-
int seconds = round(id(uptime_sensor).raw_state);
int days = seconds / (24 * 3600);
seconds = seconds % (24 * 3600);
int hours = seconds / 3600;
seconds = seconds % 3600;
int minutes = seconds / 60;
seconds = seconds % 60;
return (
(days ? to_string(days) + "d " : "") +
(hours ? to_string(hours) + "h " : "") +
(minutes ? to_string(minutes) + "m " : "") +
(to_string(seconds) + "s")
).c_str();
output:
- platform: ledc
pin: GPIO27
frequency: 10000 Hz
id: fanhub_pwm1
fan:
- platform: speed
output: fanhub_pwm1
name: "Fanhub Fan1"
🔥These links support my madness🔥
💲 NordVPN: www.bmbsucks.com
💲 Members-Only Punishment: bit.ly/bmbmembers
💯These are my other Socials💯
🔹Twitter: bit.ly/BMBTw
🔹Instagram: bit.ly/bmbinst...
🔹Tik-Tok: bit.ly/bmbtock
🔹Discord: bit.ly/BMBDISCORD
✉️P.O. Box for Mail✉️
Byte My Bits
P.O. Box 77
Haysville, KS 67060
2 окт 2024