Displaying value frome remote api

Dear all,

I just started with configuring and now I have a very beginner question:

I have an external python script (whose function is maybe subject to be transferred into HomeAssistant later)
which has some Measurement values, e.g. a Temperature.

Now I want to use the remote api to transfer the Temperature into Home Assistant and Display it there.
Maybe I just have to use remote.set_state(api, ‘sensor.temperature’, new_state=123)

But I don’t know which kind of object in home assistant I have to create, in order to just display a value.
I played around with the some sensors, especially the platform template, but had no success so far.

Can somebody give me a short hint in the right direction?

br
Arne

You might want to try command line sensor and set the command to a python script adapted to give the temp you have.

Do you mean a sensor reading a remote api value?

Then you’ll probably want a sensor something like this as a section in your sensors.yaml file:

  - platform: command_line
    name: redpi_temp
    command: curl -s http://192.168.178.30:5000/pi/api/v1.0/temp
    payload: '{ "temp" }'
    unit_of_measurement: "°c"

I meant it vice versa,

so from an existing, different python script into home assistant.
This script controls some hardware and has it’s own timing.
In this particular case, I want homeassistant as slave.

What I am searching for is an Item which can be displayed (like a sensor) and whose value I can set via the remote api.

With the command_line I could probably go over a file, but that’s not what I would prefer.

br.
Arne

I tried a little bit further,
Actually I just called:
remote.set_state(api, ‘sensor.office_temperature’, new_state=temp)
from my outside script, and a new Item is appearing in Home assistant, showing my Temperature.

So, can I maybe just create a Dummy Sensor?