Here is all the code needed for running your own webserver that displays and updates data by using websockets.
Data pin of DHT11 is connected to GPIO8 and switch is connected to GPIO23.
Please change the IP addresses in all the files to your server's IP address. By default the server runs on port 80.
You can run the code by running sudo python hsmon.py