Ok. I got it working. I was missing some additional code plus I'm still learning Klipper syntax and how it all connects. This is what I got.
[temperature_sensor raspberry_pi]
sensor_type: temperature_host
min_temp:10
max_temp: 100
[duplicate_pin_override]
pins: PD12 # this is the pin number that controller_fan uses in my printer.cfg
[fan_generic cpu_fans]
pin: PD12
[delayed_gcode skirt_fan_boot]
initial_duration: 1.0
gcode:
{% if printer.print_stats.state|lower != "printing" %}
SET_FAN_SPEED FAN=cpu_fans SPEED=.5
{% else %}
SET_FAN_SPEED FAN=cpu_fans SPEED=0.75 #just so I can see if this is getting called
{% endif %}
UPDATE_DELAYED_GCODE ID=skirt_fan DURATION=5
# Pi temperature monitoring loop. Check temp every 5 minutes & turn on skirt fans if too hot. Turn off if cool.
[delayed_gcode skirt_fan]
gcode:
{% if printer.print_stats.state|lower != "printing" %}
{% if printer['temperature_sensor raspberry_pi'].temperature >= 50 %}
SET_FAN_SPEED FAN=cpu_fans SPEED=1
{% elif printer['temperature_sensor raspberry_pi'].temperature < 40 %}
SET_FAN_SPEED FAN=cpu_fans SPEED=0
{% endif %}
{% else %}
SET_FAN_SPEED FAN=cpu_fans SPEED=1
{% endif %}
UPDATE_DELAYED_GCODE ID=skirt_fan DURATION=300
You have to have the above defined in printer.cfg - [temperature_sensor raspberry_pi].
claudermilk calls it "pi_4_mcu". Use what ever name you defined it as - in my case raspberry_pi.
I could not get "controller_fan" to work although it was previously defined in my config file. I don't know why, I may still be missing something.
I had to create a [fan_generic] fan section. I called it cpu_fans to avoid any confusion with controller_fan. Lastly I had to add a [duplicate_pin_override] section for the controller fans otherwise Klipper didn't like having the pin# defined more than one section. I'm not sure if this a smart thing to do but it was the only way to get it to work. If I doing something wrong, let me know. I would still like to know why the controller_fan reference does not work.