Hi all,
I just set up the config below. One of the values it reports is the current speed of my fan. But MQTT not sending the right fan speed using the pulse counter. The pulse counter always seems to send 0.0, even when I see the fans in action.
Below is the MQTT-output. You can see that the fan speed is set to 0.219 (calculated from the difference between TempIn and TempOut). The Fans do speed up, but the MQTT pulse count is still 0.0.
Of course the fans are connected using a 4-pin connector. Fans used are Artic F9 PWM. I had this setup running in the past, but it more or less just stopped working
Any help is much appreciated.
MQTT-sniffing:
dbebartlinks/debug [D][dallas.sensor:148]: 'DBE Bart Links Temp Out': Got Temperature=19.9°C
dbebartlinks/debug [D][sensor:092]: 'DBE Bart Links Temp Out': Sending state 19.87500 °C with 1 decimals of accuracy
dbebartlinks/debug [D][main:326]: Fan speed: 0.219 delta_temp: 0.625
dbebartlinks/sensor/dbe_bart_links_temp_out/state 19.9
dbebartlinks/debug [D][pulse_counter:159]: 'DBE Bart Links Fan Speed': Retrieved counter: 0.00 pulses/min
dbebartlinks/debug [D][sensor:092]: 'DBE Bart Links Fan Speed': Sending state 0.00000 RPM with 2 decimals of accuracy
dbebartlinks/sensor/dbe_bart_links_fan_speed/state 0.00
ESPhome config:
esphome:
name: dbebartlinks
platform: ESP32
board: esp32dev
wifi:
ssid: "secret"
password: "secret"
domain: ".secret"
fast_connect: on
power_save_mode: light
globals:
- id: fanspeed
type: float
restore_value: no
initial_value: '1'
- id: delta_temp
type: float
restore_value: no
initial_value: '1'
# Enable logging
logger:
# level: INFO
ota:
dallas:
- pin: 18
id: dallas_1
update_interval: 30s
- pin: 23
id: dallas_2
update_interval: 30s
sensor:
# Sensor for outgoing water
- platform: dallas
address: 0x989F16D71964FF28
name: "DBE Bart Links Temp Out"
id: temp_out
dallas_id: dallas_1
accuracy_decimals: 1
unit_of_measurement: "°C"
on_value:
then:
# Do not start the fans when tempdifference is below 2 degrees. Also prevents negative values
# Else start. Multiply by 0.03. 30 degrees is the maximum difference between tempIn and TempOut.
# Fanspeed must be a value between 0 and 1
- lambda: |-
id(delta_temp) = id(temp_in).state - id(temp_out).state;
if (id(delta_temp) < 0.5) {
id(fanspeed) = 0;
} else {
id(fanspeed) = (0.35 * id(delta_temp));
}
- logger.log:
format: " Fan speed: %.3f delta_temp: %.3f"
args: [ 'id(fanspeed)', 'id(delta_temp)' ]
- output.set_level:
id: gpio_21
level: !lambda "return id(fanspeed);"
- platform: dallas
# Sensor for incoming water
address: 0x80E9DBD71964FF28
name: "DBE Bart Links Temp In"
id: temp_in
dallas_id: dallas_2
accuracy_decimals: 1
unit_of_measurement: "°C"
- platform: pulse_counter
pin: 22
name: "DBE Bart Links Fan Speed"
unit_of_measurement: 'RPM'
filters:
- multiply: 0.5
count_mode:
rising_edge: DISABLE
falling_edge: DISABLE
update_interval: 30s
output:
- platform: ledc
pin: 21
id: gpio_21
frequency: 25000
mqtt:
port: 1883
broker: 192.168.0.221
username: "secret"
password: secret
client_id: dbebartlinks