I gather that if I am able to return the rest of the string after first scrapping the 'lblGoldAskAU", then I am able to obtain the actual dollar value in that string.
It is not working and HA said there is an error on device update. I am happy to print the log error here but could someone please tell me if my setting should be changed in the first place?
I am not ready to guide you through this but my recommendation is to install python and some addons which are necessary (beatifulsoup, resources)
and run the below code in order to be sure that it is working before you add the sensor in HA.
#!/usr/bin/python3
from bs4 import BeautifulSoup
import requests
# Change these 2 things
URL="http://stravon.gr/pinakas/meteostation/maroussi_m"
# This is the select line you will use in the config
SELECT=".pricetab > .price > h2"
# You may need to use a template after the fact...
INDEX=2
r = requests.get(URL)
data=r.text
soup = BeautifulSoup(data)
#print(soup)
val = soup.select(SELECT)
print("Output of SELECT: **************")
print(val)
print("**************")
value = val[INDEX].text
print(value)
I tried to install python3 + pip + bs4 + requests in an ubuntu in docker and while phyton runs fine, all those scripts when run generate errors such as etc etc
I am not too familiar with this so this looks very foreign to me unfortunately.
But given you have previously already scrape the correct value using the SELECT scrape parameter that I originally suggested, how do i get that output from home assistant’s value_template?
I just tried to test the sensor in my HA but id doesn’t work.
I think you should fine another site (more friendly to scrappers) to get the data you need.
I don’t know why this is happening. As you saw I am new to this also.
It happened to me the python scrapper to work ok but HA couldn’t.
But only in 1 sensor from 5-6 I tried