Need help with a rule speed controll

i have a pwm fan controlled by mqtt fan (thanks to @TAustin ) speed being 100- 1000 ,and a ds18b20 conected to my pi showing in smartthings via a mqtt temperature sensor .
i want to controll the temperature of my 3d printer enclosure ,
i want to maintain a temperature of about 28.5C
i want a rule to automatically turn the fan on 28.5 @ 100
and if it goes above 28.5C i want the fan speed to increase upto the full 1000 at the top temperature of 30C.
the only rules i have so far are copied and pasted as they are beyond me
so any help would be much apreciated.
thanks
martin

Do you mean Rules API rule?

Is it more easy to make Python program to RPi
and control the fan speed directly from RPi using MQTT?

2 Likes

yes rules api rule ,
the pi controlling the fan speed via mqtt would that be easier?

thanks
martin

I think it would be easier.

Every time RPi received a new temperature measurement value, it could send speed control to the fan.

doesnt sound easier to me lol,
how would i go about doing that.
thanks
martin

Do you use a Python program to send measurements to the MQTT broker?

We can use DM if you like.

i use node red to read the gpio and send it via mosquitto.
whats DM

Ok
I haven’t used node red.

i found this but it reads cpu temp not from sensor
FanProportional.py

tried it on a spare pi zero w and it works well but only from cpu temperature

I DM to you example Python program to read 1-wire sensor (18B20)

I installed Node-RED to my RPi.

You can use temperature to fan speed scaling Node-RED range function.

Node-RED_range_1

1 Like

thanks works great , im new at node red as you can tell.
martin

1 Like