Air Con Automation with Solar

Hi all I’m bit lost on this one

the idea is that i would like my Air con to turn on When my solar is exporting a certain amount and when temperature is at a certain temp

i am using a sensibo that is added to home assistant and i have a enphase envoy for export details


- platform: rest
    name: Net Consumption - Now
    resource: http://192.xxx.xxx.xxx/production.json
    value_template: '{{ "%.1f" | format(value_json.consumption[1].wNow) }}'
    method: GET
    unit_of_measurement: "W"


switch climate:
  - platform: template
    switches:
      ac:
        friendly_name: "AC"
        value_template: "{{ is_state('climate.ac', 'cool') or is_state('climate.ac', 'heat') or is_state('climate.ac', 'dry') or is_state('climate.ac', 'fan_only') }}"
        turn_on:
          service: climate.set_hvac_mode
          data:
            entity_id: climate.ac
            hvac_mode: cool
        turn_off:
          service: climate.set_hvac_mode
          data:
            entity_id: climate.ac
            hvac_mode: off