Advice needed: A beginner programmer wants to develop simple 220V relay on/off

ESP8266 module such as a D1 Mini Wemos using MQTT will do everything you want

Reading temperature every 2 seconds is unnecessary, the DH11 may not even be that fast. I don't know if I would trust livelihood and livestock on its results. You need to code it carefully to constrain wild readings.