Using Climate and Generic Thermostat for Humidity control

Hi,
I recently came across the climate component, whilst exposing my temp sensors to Google Assistant and thought it would be a simple way to control my bathroom extraction fan, here’s how I’ve set it up with the humidity sensor acting as a temp sensor ( had to output in celcius)

climate:

  • platform: generic_thermostat
    name: Bathroom
    heater: switch.bathroom_fan
    target_sensor: sensor.bathroom_humd
    ac_mode: true
    min_temp: 20
    max_temp: 99
    target_temp: 50
    target_temp_step: 1
    cold_tolerance: 0
    hot_tolerance: 40

So basically it turns on at 90% relative and off at 50%. I noticed in the Climate: writeup a service for setting humidity. Can anyone explain more? and can I substitute another sensor instead of a value for target_temp?

Thanks