I just changed from 1.8 to OH2 and I am trying to set up the weather html layout.
In OH2 apparently there is not webapp folder, so how is it done then? Where do we have to move our layout?
I read some other topic where someone say it is on conf/html/ but in I am not able to make it work, and if this is the right place, the structure inside keeps being the same? (images folder, and layouts folder).
In other words, how can we have an HTML view for our weather?
Using the layout file:
You must specify a locationId and a layout parameter, iconset is optional (default=colorful)
Either directly: http://HOST:PORT/weather?locationId=home&layout=example&iconset=colorful
or in a sitemap:
Webview url="/weather?locationId=home&layout=example&iconset=colorful" height=7
(This does not work for OpenHAB2 and this WIKI needs an update for how to use this on OH2)
I get the error about the layout file not being found:
HTTP ERROR 500
Problem accessing /weather. Reason:
Server Error
Caused by:
javax.servlet.ServletException: File with weather layout âexample.htmlâ does not exist, make sure it is in the layouts folder ./webapps/weather-data/layouts
at org.openhab.binding.weather.internal.gfx.WeatherServlet.doGet(WeatherServlet.java:114)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:70)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:271)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:499)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
at java.lang.Thread.run(Thread.java:745)
Powered by Jetty://
I run OH2 as a service with an installation via apt-get. So, my configurations live in â/etc/openhab2â, and the runtime is in âusr/share/openhab2â. Neither of those locations have a webapps folder, so I tried adding this to both locations with no success. As suggested, I also put the âweather-dataâ folder in âetc/openhab2/htmlâ, but the error stays. Any ideas on the correct locations and the correct webview url?
would be wonderful if you could take a look at how you set it up if you still have the system available. None one the suggestions you had solved the problem for me.
Right. How did you set up the folder structure under /html? In the wiki for the weather binding, there is a zip which has âweather-dataâ as the top folder with âimagesâ and âlayoutsâ as the subfolders. None of them have a âweather.htmlâ so that url is probably not going to work,
Fair call, I didnât use any css and just dumped the html file in the html folder. I donât use this in my sitemap at the moment so never spent any time making it pretty.
My map.html file works/ed fine for my mqtt owntracks setup in OH2. I just assumed the weather html worked too, but donât think I ever actually loaded it up, before deciding I wanted to start my weather items from scratch.
I believe I put this in the general openhab source issues. You are right, This might be more specifically addressed in the OH2 addons section. I guess the maintainers can move it accordingly.
I put html to /conf/html folder, and included it in sitemap as:
Webview url="/static/example.html"
As far as i can see, the content is just static HTML, it does not replace dynamic content.
I experimented with this tonight and found that placing a âwebappsâ directory containing the âweather-dataâ directory under userdata gets the right weather values populating. eg.
%openhabhome%/userdata/webapps/weather-data/
The images arenât being loaded, however. I guess that could be a proxy problem in OH2 ?
So, it turns out you can fix the image problems by dropping all the static content off in the conf/html directory and update the layout file with the correct paths:
It still dosnât work for me - html layout is shown on sitemap but without item value. Can you explain your method once again ? What is the trick to get item values ?