Hey guys!
So… i run HA on a Raspberry PI, and since i didn’t like that little fan sound, i figured out how to PWM control my fan using pyscript and pigpio, this was ~2-3 years ago, and i don’t remember where i found the codes i am using. The problem now is that since 2023.6, i dosen’t work anymore! And i figure this has something to do with Python 3.11. But since i don’t know anything about python, i am hoping someone here could help!
So - i have “Pyscript Python scripting” activated, with one script “rpi_cpu_fan_pwm.py”, and then i have pigpio installed, and then i have this lines in the config.yaml
This first line is to display the fan PWM in Home Assistant
- platform: template
sensors:
fan_pwd:
value_template: "20"
friendly_name: "Fan rpm"
unit_of_measurement: "% RPM"
And this line is to get the Raspberry CPU temperature, with the update i had to change “command_line” since that was “- platform: command_line” before.
command_line:
- sensor:
name: RSB CPU Temperature
command: "cat /sys/class/thermal/thermal_zone0/temp"
unit_of_measurement: "°C"
value_template: '{{ value | multiply(0.001) | round(1) }}'
scan_interval: 10
This is the .py file:
I really hope someone with more skills could take a look at this and help me figure it out…
Thank you!