(html) changing checkbox state depending on variable boolean

Have you checked out the Arduino IOT framework?
https://create.arduino.cc/projecthub/products/arduino-iot-cloud
What you are trying to do is very easy using that framework... and you don't have to write all the HTML yourself.