Having issue with REST sensor ( Update entity automation)

Well i created a working rest sensor, it updates everything normal when i press reload rest entities.

So the thing is, when i go in developer tools
and select Update entity service and select the entity whats connected to my code it does updated but throws an error that json can’t be formatted.

i use this to update homeassistant.update_entity

entity_id: sensor.op_test30001
data: {}
target:
entity_id: sensor.op_test30001

However if i press image
it does work with no error at all.
it will show up in the attributes of sensor.op_test30001
What am i doing wrong ?

here a bit of my code (it works normal)
as you can see the scan_interval is very high

rest:

   - authentication: basic
     resource: "http://10.10.11.11:8123/local/testpost.json"
     scan_interval: 80000
     sensor:
     - name: op_test30001
       unique_id: 8547290723890572352
       value_template: "{{ok }}"
       json_attributes:
         - "processed" 
     delay: 5

Please format your code correctly; and paste in the full error message.

It’d also help to see the JSON from that resource, if it’s not too sensitive.

Thanks for the reply, the json format is correct and does work.

However i found out that if i change the code in my yaml and run the update entity service it only runs the old data, and if the old data did not contain any data ofcourse it doesnt format the json.

I just wanted to test what happens if it doesn’t find the data… but i found out that it doesnt work like that,
so every time i press reload entities it saves my corrected url (rest configuration) and when i run the update entity service it just updates and when new data its available it will update when i press again…

So kinda my fault of thinking it would work straight away but no, so issue solved.

That may be so but Troon was talking about the way your post is formatted. Click the link they provided.

Better now?

I agree but
i could do it afterward, i exppected some help instead of telling me how to write a post…
as i was in a rush.

But i figured it out myself.

regards

Read the link. We can’t help you when you don’t format your pasted code correctly.

The whole FAQ is called “Help us help you” for a reason.

Thats fine and i understand.

but kinda strange that exactly today when i posted many times on this forum i needed to change the format.

but its ok i will do it instantly next time.
regards.

1 Like