When I compile this code I get a "temp is not definded in this scope" error message.
What scope are they defined in?
If I define "temp" and "hum" as global variables the sketch then compiles and runs ok but I get 0 as values for temperature and humidity
Do you still have the local variables of the same name?
Why are you sending temperature and humidity as floats and then converting them to ints?