HTML layouts in OH2

It’s due to the difference in how openHAB2 delivers static content.

  1. First, edit weather.html (or example.html by default) so that all directories start with “static/” e.g.
<link rel="stylesheet" type="text/css" href="static/weather-data/layouts/example.css" />
  1. You need move dynamic html files to a place where openHAB can handle the webapp content:
  • If you’re using MANUAL Installation: Move your /weather-data/layouts/weather.html folders and file to /opt/openhab2/userdata/webapps
  • If you’re using AUTOMATIC Installation (e.g. apt-get): Move them to /var/lib/openhab2/webapps
  1. Change your sitemap to the following (You can change the values set for locationId=, layout=* and iconset=***):
Webview url="/weather?locationId=home-HAM&layout=weather&iconset=colorful" height=20
  1. Finally, make sure the static content (the /weather-data/ folder) is in your html folder:
  • If you’re using MANUAL Installation: /opt/openhab2/conf/html
  • If you’re using AUTOMATIC Installation (e.g. apt-get): /etc/openhab2/html
3 Likes