In XML file I get response: (look picture - XML OUTPUT)
I need to read inp1 and ds2.
inp1 - need to be readed as is, so as full number 3301 or only 33, both options are good.
ds1 - need to be readed as 21.6, so before last number must be dot, because this is temperature °C.
My configuration file is: (look picture - CONFIGURATION)
I tried so many different ways that now I’m completly stuck.
In HA Log Details (ERROR) I got: (look picture - ERROR LOG)
How to solve this? How to make dot before last digit on temperature sensor?
I have never once used the scrape sensor, but the documentation states it is for HTML rendering, not strict XML. You may not be able to use the scrape sensor at all for what you intend. Assuming that the libraries it is using is not dependent on a root element, you could try:
select: "inp1"
value_template: '{{ Math.floor(value / 100) }}' # Returns first two digits {{ value }} will return raw number
select: "ds2"
value_template: '{{ value / 10 }}'
or
select: "response inp1"
value_template: '{{ Math.floor(value / 100) }}' # Returns first two digits {{ value }} will return raw number
select: "response ds2"
value_template: '{{ value / 10 }}'
If the libraries it uses needs an “html document,” this will not work no matter what. Also, start with just the select options and remove the value_template part. If you get numbers into home assistant, then start adding the value_template back in and playing with it.
Alternatively, in the past, when I needed XML parsing for sensors, I did something like the following: