Hey Dim - welcome to the forums and to balena!
It’s great to hear that balenaOS and this project is doing it’s job and keeping people connected during the pandemic.
The Pi4 will get warm, because it’s having to work pretty hard to decode the video stream from the call. This will be done in software, so the CPU will be earning it’s keep. Rest assured, though, the PI4 was designed to run hot, and will throttle itself to avoid damage. However adding a better case, and a fan, is a good idea nonetheless.
Now, onto your fan script.
The first thing that’s worth tell you, is that the services that run on a balena device (in this instance the ‘kiosk’ service that is running the browser window) are writeable, but only to their locally created filesystem layers, which only exist for the lifespan of the service. To put it another way, anything you change in the container whilst it’s running, will be reset when the container restarts. The container is recreated each time it starts up. So running the script you linked, even if it had worked, would only work until the service (or whole device) restarted. More details here.
In order to change one of the services permanently you actually need to change the dockerfile which creates it. If you’re up for some learning, this Dockerfile Masterclass would be a good read for you.
What you’ll then need to do is use the alternative method of deploying the code to the device (details here) which involves downloading the source code from Github and then using the balena CLI to push it to your balenaCloud application. And before you push it - you can make your changes. This is where you can add in a fan script - however there’s another issue:
Looking at the script you linked - it’s working in an odd way. Basically it is installing python, running Linux commands to write out some python code to the local filesystem and then setting it to run as a system service. This script isn’t going to work in a containerised application for a host of reasons.
What the python code is doing, if you were to get it installed, is set some pins on the Pi GPIO to control the fan. In order to do this yourself, you could add another service to the application starting with our Python-specific getting started guide and then look at what the script you linked is doing, and recreate the pertinent parts.
I appreciate you say you are a beginner, and that the above isn’t necessarily beginner level - but I’m afraid there isn’t an easy way to enable the fan on this case using balenaOS. Not yet.
Phil