Sonar, temperature & humidity sensor

Is this homework?

I meant to include a link to the state change detection method tutorial.