Control a smartplug depend on the temperature of sensor

Hi,
I have a xbee gateway, smart plug and sensor.
How could I control I/O of the smart plug depending on the temperature of the sensor? and I tried to realize by DIA.

Here is the .yml

devices: 
  - name: xbee_device_manager
    driver: devices.xbee.xbee_device_manager.xbee_device_manager:XBeeDeviceManager

  - name: edp_upload0
    driver: devices.edp_upload:EDPUpload
    settings: 
        interval: 5
        sample_threshold: 20
        collection: "collection_name"
        filename: "file_name"

  - name: transform0
    driver: devices.transforms_device:TransformsDevice
    settings: 
      - name: "TempF"
        unit: "F"
        channels: 
          - "sensor0.temperature"
        expr: "(9/5)*c[0]+32"
      - name: "fan_on"
        unit: "boolean"
        channels: 
          - "sensor0.temperature"
        expr: "c[0] > 18"

  - name: sensor0
    driver: devices.xbee.xbee_devices.xbee_sensor:XBeeSensor
    settings: 
        xbee_device_manager: "xbee_device_manager"
        extended_address: "00:13:a2:00:40:ae:c2:5f!"
        sample_rate_ms: 1000

  - name: rpm0
    driver: devices.xbee.xbee_devices.xbee_rpm:XBeeRPM
    settings: 
        xbee_device_manager: "xbee_device_manager"
        extended_address: "00:13:a2:00:40:6e:3f:49!"
        power_on_source: "transform0.fan_on"

presentations: 
  - name: rci
    driver: presentations.rci.rci_handler:RCIHandler

  - name: console0
    driver: presentations.console.console:Console

  - name: web0
    driver: presentations.web.web:Web
    settings: 
        page: "dia.html"

tracing: 
    default_level: "debug"
    default_handlers: 
      - "stderr"

I want to realize that when the value of fan_on is True, the smart plug power on. Is it the problem of power_on_source?

THANK YOU!!!

Does this example help?
https://www.digi.com/wiki/developer/index.php/Python-based_SmartPlug_Sensor_Example

It shows how to read Temperature and hot to control switch so all you need to add is the condition.