esphome: name: espfan platform: ESP8266 board: d1_mini # Enable logging logger: # Enable Home Assistant API api: password: "feelhome123" ota: password: "feelhome123" wifi: ssid: "lauIOT" password: "superiot1" domain: .home.cabestan.be # Enable fallback hotspot (captive portal) in case wifi connection fails ap: ssid: "EspFan Fallback Hotspot" password: "jTlMOFiFOzog" captive_portal: web_server: port: 80 time: - platform: sntp id: esptime timezone: "Europe/Brussels" on_time: # Every 5 minutes - seconds: /10 then: - lambda: |- ESP_LOGD("custom", "Test sensor is : %.1f [min: %.1f | max: %.1f] state: \n", id(tsensor).state, id(tmin).state, id(tmax).state ); if( id(tsensor).state < id(tmin).state ) { auto call = id(my_fan).turn_off(); call.perform(); ESP_LOGD("custom", "Temp is low, so turn off"); return; } auto call = id(my_fan).turn_on(); call.perform(); id(my_fan).speed = ( id(tsensor).state - id(tmin).state ) / ( id(tmax).state - id(tmin).state ) *100 ; ESP_LOGD("custom", "Threshold = %.1f % \n", ( id(tsensor).state - id(tmin).state ) / ( id(tmax).state - id(tmin).state ) *100 ); fan: - platform: speed output: output_fan name: "Fan" restore_mode: ALWAYS_ON id: my_fan dallas: - pin: GPIO4 update_interval: 5s number: - platform: template name: "Sensibilité" optimistic: true min_value: 0 max_value: 100 initial_value: 80 step: 1 id: sensivity - platform: template name: "T Max" optimistic: true min_value: 20 max_value: 60 initial_value: 35 step: 1 id: tmax - platform: template name: "T Min" optimistic: true min_value: 0 max_value: 20 initial_value: 20 step: 1 id: tmin sensor: - platform: dallas address: 0x5f0000041a8f8628 name: "Battery Charger Temp" id: tsensor # sensor: # - platform: pulse_counter # pin: # number: D2 # name: Fan Speed # id: fan_rpm # unit_of_measurement: 'RPM' # filters: # - multiply: 1 # update_interval: 3s # count_mode: # rising_edge: INCREMENT # falling_edge: DISABLE # Example output entry output: - platform: esp8266_pwm id: output_fan pin: D1 max_power: 100% frequency: 25000 Hz