Set sensor valu JSON only

Hi guys,

Is there any way to modify the attributes of a sensor using only JSON? I’m currently using a command_line sensor which looks at a file, but I prefer to send a curl command (from a python script) to update it.

So I need some kind of sensor that isn’t initialised at boot if that makes sense.


There’s a couple ways to do this, I think. You can use the states API. It accepts JSON

the body would be something like:
{“state”: “off”,“attributes”:"…"}

That assumes you want to set it from outside HASS. From inside HASS, you could make the sensor be RESTful binary sensor like:

Thanks for the response!

I’ve figured out how to manipulate a sensor with JSON, but I can’t figure out what kind of platform I should use. I tried using a rest sensor pointing to a dummy web page, but after I modify the value via JSON, the dummy value shows up again…

So what I want to achieve is create a sensor that gets populated externally, without any startup value (if that makes sense)