first off I hope I opened this topic in the correct category. If not, please let me know.
I started tinkering with home assistant about a week ago and love it so far. Everything is very intuitive and easy to manage.
But there’s one thing I can’t get to work: a REST sensor.
I don’t get any error, the log just gets flooded with WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform rest is taking over 10 seconds.
every 3 minutes or so.
The sensors do not show up as entities.
What’s strange is that in my firewall I don’t see any traffic from my home assistant docker to this device. When I wget the URL from my home assistant docker I see traffic.
Yep. The restful sensor converts XML to JSON automatically and puts an @ symbol in front of every attribute.
This is a worry though:
Oh, also you can’t use the key value in your template unless you use square bracket format as it has a special meaning in the rest value template. You have to do this:
@Hellis81 it does look very similiar, yes.
Unfortunately the issue has been resolved by updating to 0.107
I will check the debug logs later today, that sound’s like a viable strategy
@tom_l : when I edit the value like you suggested I get an error when checking the configuration:
Invalid config for [sensor.rest]:
invalid template (TemplateSyntaxError: expected name or number) for dictionary value @ data['value_template'].
Got '{{ value_json.eta.["value"]["@strValue"] | replace(",", ".") | float }}'. (See ?, line ?).
He’s reading the accepted answer of the thread I linked to.
That is obviously not what I was suggesting, but to actually look at the config posted in the thread…
I don’t think the issue you linked @Hellis81 is the same I have.
I had a look at the debug logs and the only thing regarding homeassistant.components.rest.dataI can find is the following:
2021-08-23 16:23:40 DEBUG (MainThread) [homeassistant.components.rest.data] Updating from http://192.168.110.1:8080/user/var//120/10601/0/0/12197
In the other thread an Erroneous JSON was quoted, which would make sense. But here it seems to be doing absolutely nothing?
I tried your suggestion @tom_l
I am not sure if that’s new or if I just didn’t see it earlier, but now I see a “setting up sensor rest” from time to time in the debug logs.
2021-08-23 17:00:46 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.rest
2021-08-23 17:00:46 DEBUG (MainThread) [homeassistant.components.rest.data] Updating from http://192.168.110.1:8080/user/var//120/10601/0/0/12197
2021-08-23 17:00:46 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.rest
2021-08-23 17:00:46 DEBUG (MainThread) [homeassistant.components.rest.data] Updating from http://192.168.110.1:8080/user/var//120/10601/0/0/12197
I am 100% sure there was no redirect to https. I can call the API without any issues via curl.
Just a quick update:
The initial value_template was correct.
I’ve just looked at what xmltodict should output and threw that into the template dev tool.
This outputs result type: string value_template: '15.2'
I am starting to suspect either a network issue or somehow the api does not get called at all.
Even if the value template was wrong I should get an entity, even if the values are off, right?
Is it somehow possible to reinstall the api client?