Passing sensor name and value to ESPhome through service call

HI!

I’m using ESPhome to control my Mitsubishi AC with this custom component.

It has the ability to pass a external temperature sensor as reference for the room temperature.
With the examples I am able to set it to my own sensor:

  - platform: homeassistant
    name: "Woonkamer temp"
    entity_id: sensor.temp_sensor_2_temperature
    on_value:
      then:
        - lambda: 'id(hp).set_remote_temperature(x);'

But the examples also list the ability for a service call to switch between the internal sensor and a remote sensor. However the example only shows a way to set a fixed value as remote sensor.
How can I use a service call to specify which external sensor (value) I want to use for my AC?

api:
  services:
    - service: set_remote_temperature
      variables:
        sensorid: string

      *'convert service input into sensor (value)'*

      on_value:
        then:
          - lambda: 'id(hp).set_remote_temperature(x);'

    - service: use_internal_temperature
      then:
        - lambda: 'id(hp).set_remote_temperature(0);'

Thank you! :slight_smile: