dastrix80
(Kris K)
November 9, 2018, 2:35am
61
I did.
I think the crux of the issue is my XML file is wrong…How did you find the right one for you? Im just after Sydney
urlBase = 'http://192.168.1.1:8080/basicui/CMD?'
url = 'ftp://ftp.bom.gov.au/anon/gen/fwo/IDN10064.xml'
def setFWOItem(BOMName,OpenHABName,day,nodeType):
try:
value = tree.xpath("//forecast/area[@aac='NSW_PT131']/forecast-period[@index='" + day + "']/" + nodeType + "[@type='" + BOMName + "']/text()")[0]
OpenHABName = OpenHABName + "_" + day
value = value.rstrip('.')
print(" " + OpenHABName + "=" + value)
value = urllib.parse.quote_plus(value, safe='', encoding=None, errors=None)
rawPage = urllib.request.urlopen(urlBase + OpenHABName + '=' + value)
except IndexError:
print(" Error with " + BOMName + "::" + nodeType + "::" + day)
def setFWODateItem(BOMName,OpenHABName,day):
try:
value = tree.xpath("//forecast/area[@aac='NSW_PT131']/forecast-period[@index='" + day + "']/@" + BOMName)[0]
OpenHABName = OpenHABName + "_" + day
print(" date? " + OpenHABName + "=" + value)
value = urllib.parse.quote_plus(value, safe='', encoding=None, errors=None)
rawPage = urllib.request.urlopen(urlBase + OpenHABName + '=' + value)
except:
print(" Error with " + BOMName + "::" + day)
dastrix80
(Kris K)
November 9, 2018, 2:37am
63
EDIT: Found my issue, urlBase was wrong.
Its updating most things now.
Awesome.
Most of the remaining in that widget are from my weather station and other bindings (UV, Air Quality etc).
Glad you got it going!
dastrix80
(Kris K)
November 9, 2018, 2:39am
65
yep, i can see the WSXXX items, Ill have to tweak that and work out why my icons dont load
I created the folders under HTML with the icons, im trying to use ‘colourful’
mine are in a subfolder so make sure you’ve got the uri correct:
<div ng-init="ServerPath='//192.168.1.148:8081/static'; IconSet='underground'">
<img width="100" src="{{ServerPath}}/images/{{IconSet}}/{{itemValue('CommonId').replace(' ','-') | lowercase }}.png"/>
dastrix80
(Kris K)
November 9, 2018, 2:43am
67
I have this:
kris@openhab2:/etc/openhab2/html/images/colorful$ ls
blowing-snow.png freezing-drizzle.png partly-cloudy-day.png scattered-thunder.png snow-showers.png wind.png
clear-night.png freezing-rain.png partly-cloudy-night.png scattered-thundershowers.png storm.png
cloudy.png hot.png rain-and-sleet.png sleet.png sunny.png
dust.png light-snow.png rain-and-snow.png snow-and-sleet.png thunder.png
few-showers.png mostly-cloudy-day.png rain.png snow-flurries.png thundershower.png
fog.png mostly-cloudy-night.png scattered-showers.png snow.png unknown.png
kris@openhab2:/etc/openhab2/html/images/colorful$ pwd
/etc/openhab2/html/images/colorful
kris@openhab2:/etc/openhab2/html/images/colorful$
<div ng-init="ServerPath='//192.168.0.3:8080/static'; IconSet=colorful'">
<link rel="stylesheet" type="text/css" href="{{ServerPath}}/layouts/example.css" />
</div>
Have you put the /images/ somewhere in the code?
That folder needs to be either in the ServerPath or the code for each image…
dastrix80
(Kris K)
November 9, 2018, 2:45am
69
Im using your code, its exactly the same. The images above you can see are under my openhab2 directory…
EDIT: Do you have the same icon names?
I mean that my code has /images/ in the img src. Have you still got that as well?
<img width=“100” src="{{ServerPath}}/images/{{IconSet}}/{{itemValue(‘CommonId’).replace(’ ‘,’-’) | lowercase }}.png"/>
dastrix80
(Kris K)
November 9, 2018, 2:48am
71
I need images.
Heres my path
/etc/openhab2/html/images/colorful
add it in the ServerPath and you should be right:
<div ng-init="ServerPath='//192.168.0.3:8080/static/images'; IconSet=colorful'">
edit - these are my images:
chanceflurries.png cloudy.png mostly-cloudy-day.png sleet.png
chancesleet.png few-showers.png mostly-sunny.png snow.png
chancesnow.png flurries.png partly-cloudy-day.png sunny.png
chancetstorms.png fog.png partly-sunny-day.png tstorms.png
clear.png hazy.png rain.png unknown.png
dastrix80
(Kris K)
November 9, 2018, 2:54am
73
Yep, basically the same as mine. Its my path thats wrong!
Can you show me your server directory? using pwd or linux or dir on windows?
<div ng-init="ServerPath='//192.168.0.3:8080/static/images'; IconSet=colorful'">
dastrix80
(Kris K)
November 9, 2018, 2:55am
75
Ive got exactly that, still the same issue.
Are you logging in locally or via myopenhab?
dastrix80
(Kris K)
November 9, 2018, 2:59am
77
Locally…Do you have your images under openhab2/html/images ?
My openhab running on a synology server, so folder structure a little different…
But mine are in /openhab/static/images/underground/
dastrix80
(Kris K)
November 9, 2018, 3:02am
79
Edit: was missing a ’
Now at least I see broken icons getting there…
I can see its referencing: http://192.168.0.3:8080/static/images/colorful/n/a.png
So, the issue relates to the Condition0, ive no idea where this is coming from given there are no items in your file or it. You must have more items not shown?
I think ‘Condition’ is coming from the Weather binding and weather underground data.
I haven’t got around to transitioning that one to BOM data… You could just change the python script to assign something from the xml file to that item.