Script to output a signal starting at a certain value


First of all, my english isn't the best. If you have any questions, please feel free to ask.

I've connected a DHT22 to a Raspberry. This passes the humidity and temperature on to Apple Home. Now I would like to use this data to send a signal when the temperature or humidity is exceeded, which then deactivates my Alexa socket or reactivates it when the temperature falls below it. Unfortunately I am still a beginner and don't know much about it.