Import data from home assistant API

Hi, in a Esphome device I want to retrieve data from a sensor in HA (power sensor) but only when/if i want: so in this code:

sensor:
 - platform: homeassistant
     id: power
     entity_id: sensor.power

how could I insert a number component or binary sensor to “enable” that import or p.e. select another one? I think about using copy component but how filter using lambda? or better use an on_value automation to modify a variable with IF condition? THANKS

sensor:
 - platform: homeassistant
     id: power
     entity_id: sensor.power
  - platform: copy
    id: copied
    source_id: power
    name: "Copy only if i want"
    filters: ........#pass data only if enabled is true#
switch:
 - platform: homeassistant
     id: enabled
     entity_id: switch.enable