Yes, I asked a few months ago and got a lot of assistance, and the solution from another forum user.
I can blink an LED full-time now.
However, my question.
I have a Dallas DS8b20 sensor and I want to blink an LED if the temperature goes above a set point. Here is my YAML code:
# Simple thermometer. A DS18b20 sensor and an SSD1306 128x64 OLED display
#
substitutions:
device_name: thermometer
esphome:
name: ${device_name}
esp8266:
board: d1_mini
logger:
level: VERBOSE
api:
ota:
safe_mode: True
packages:
wifi: !include common/wifi.yaml
output:
platform: slow_pwm
pin: D5
id: my_slow_pwm
period: 500ms
inverted: false
min_power: 0.01
max_power: 1.00
sensor:
- platform: dallas
address: 0xd00217924557a228
name: ${device_name} Temperature
id: temperature
resolution: 9
on_value_range:
- above: 27.0
then:
- output.turn_on: my_slow_pwm
- below: 26.0
then:
- output.turn_off: my_slow_pwm
dallas:
- pin: D4
update_interval: 5.0s
i2c:
sda: D2
scl: D1
frequency: 800kHz
font:
- file: 'arial.ttf'
id: font1
size: 12
- file: 'arialbd.ttf'
id: font2
size: 16
display:
- platform: ssd1306_i2c
model: "SSD1306 128x64"
address: 0x3C
lambda: |-
it.print(0, 0, id(font1), "Temperature");
if (id(temperature).has_state()) {
it.printf(0, 15, id(font2), TextAlign::TOP_LEFT, "%.1f°C", id(temperature).state);
}
Here’s the problem I need help with.
The LED on D5 (GPIO14) blinks randomly then the sensor temperature is outside of the on_value_range, and when in range it is on solid. No blink.
Any tips would be appreciated. (I picked the setpoint temperatures because I could raise the sensor temperature by pinching it between my fingers. In real use it will be monitoring my freezer temperature and alarming if the temperature goes above 0°C.)