Close!
https://www.crummy.com/software/BeautifulSoup/bs4/doc/#css-selectors
You can pick your favorite amongst the css-selectors there. But keep in mind, it will, by default, only search for top-level tags. You’ll have to specify that it’s a nested element by doing the following
select: '.s-login .u-when-large .c-login-version div'
This should follow the tree and get only the one you want (assuming there is only one on the page). I’m not 100% sure if you need to put body before .s-login or not.
value_template is not needed if you want everything inside of the tag. In this case, I’m assuming you want the entire contents of that
.
The easiest way to debug this honestly would be to use python and BeautifulSoup yourself.
Doing so, I found that the site you linked redirets to a different site. The html of the site has essentally nothing. You’ll need to use the redirected url of https://throwaway-test-site.oak.com/Account/Login#/
On windows, install python, then do pip install bs4. Then you can try to parse the html using only the select field (it’s what we get in Home Assistant).
ACTUALLY:
In doing this, I noticed the entire webpage is actually <script></script> tags…which the beautifulSoup select thing can’t seem to dive into. We need the dang script to execute to generate the html…
I might be wrong about the top level tags thing. It could just be because of all the script tags and no actual HTML.
2 options. Use AppDaemon and convert your new python app you just now wrote and tested and use that to extract the values. You can use way more features other than .select().
Or, it looks like the version id is in the script. So we’ll just get the entire script as text, and use value_template to extract the value.
select: '#RootComponentTemplate'
value_template: >-
{% set a = value.find("c-login-version\">") %}
{% set b = value.find("<", a) %}
{{ value[a:b].split(">")[1] }}
This might work. Just using python string manipulations to extract the value from the dumb select output.
Man, that took way longer than I thought it would…