How to get or set sensor values from custom components

Hi everyone,

i’m new on Home Assistant and i’ve a little problem with access to values from other sensors.

Is there a way to get value from a RESTful sensor in a custom component?

As example I have a Sensor configured in configuration.yaml:

sensor:
  - platform: rest
    name: TCR-Port-4
    resource: http://192.168.10.3/status.xml
    method: GET
    value_template: "{{ value_json.response.led4 }}"
    scan_interval: 1

And I would like to use this value as state parameter in a custom component:

  async def pulse(self, id, impulse="00:00:01", state="on"):
        command = "normal" if state == "on" else "reset"
        url = self.server_url('/impl.cgi?ausg' + str(id) + impulse + command)
        await self.post(url)

greetings from Berlin and sorry for my poor english