Dashboard UI suitable for tablets

I absolutely love this interface. I don’t so much love needing to run a ruby daemon and add rules to push data from openHAB. I ended up ripping out all of the ruby code and using the new SSE functionality from openHAB 2.0 to push the updates directly to the client. Doing that allows me to serve the dashboard directly from openHAB. I don’t know if there’s much interest, but if anyone wants to check it out - you can see it here: https://github.com/beowulfe/openhab-dashboard/tree/oh2

Just run ‘mvn package’ to build the artifact, and drop it in your addons folder of an openHAB 2.0 install.

I only got the weather, switch, and heating widgets working so far, as that’s all I need. Moving other widgets over wouldn’t be hard though.

2 Likes

Thanks @beowulfe. I have actually just installed a skeleton OH2 on a test machine to look into using SSE. Your work will hopefully save me the effort :slightly_smiling:

I’ve just had a quick look at your code but haven’t had a chance to try out yet. Looking through it though, are the widgets (and also the html in the views folders) compiled in into the OH addon binary? If so, it might be better if we can keep the widgets outside of the binary so that they can be quickly modified by end users.

Yes, they’re compiled in. I build application.js at compile time instead of runtime - mostly because the only non-ruby sprockets implementations I found were node modules.

The HTML for the widgets could be kept separate, but if users need to edit the CSS/JS too, I see three paths forward:

  1. Move application.js out of the JAR, and users need to install node and compile it themselves.

  2. Create a Java implementation of Sprockets to build the file at runtime. I think this might not be that bad.

  3. Figure out if the node build can be executed in Nashorn instead.

@beowulfe Each of the three options sounds better than having them compiled into the jar, which many users will not be able to do. I’ll leave it in your capable hands as to which to go for (option 1 seems quickest but again more work for end users).

Do let me know if there’s anything I can help with. Once you have a solution, I will put a link to your repo in my Readme file for OH2 users.

Hi,
can anyone give me some pointers how to implement a background image for a dashboard site.

I would like to have one page similar to the default page without a background image and the second page should have an image as backgroung.

ok got it had much trouble to know where to put the image-files

<div class="gridster" style="background-image: url("/assets/image.jpg")>

image needs to be in assets or assets/images folder

Cause of the fact, that Im using a 15inch tablet I was looking for a way to implement a floorplan:

work in progress:

Changes made to get it working. I cant stress enough, that I dont really know what Im doing - have no programming skills and knowledge.

jquery.gridster.js:
change to max widget size (depends on the used grid see next point)
max_size_x: 6,

application.coffee :
change to get a grid for your resolution eg 1920x1080 in my case: 192 colums @ 10px width
Dashing.widget_margins ||= [0, 0]
Dashing.widget_base_dimensions ||= [10, 10]
Dashing.numColumns ||= 192

icons:
e.g. insert data-icon="lightbulb-o" @ Ohswitch in the .erb-file

Ohswitch2:
changed background to transparent !important to get icon only in erb file leave text empty(or not)

background
I put the background image (of my floorplan) into:
<div class="gridster" style="background-image:url(/assets/erdge.png);background-repeat:no-repeat;background-position:40px 40px;background-attachment:scroll;">
- not sure if there is a more elegant way to do that

In google chrome / developer tools you can change the html data-row/col and try out the positioining of the items - update your .erb file (somehow I had to sort by rows ascendending - otherwise I would get some items in completly different places then specified.)

big thanks to smar and the OH community for the dashboard

open issues:

  • background image isnt fading in/out when changing pages (somehow in cycleDashboards.coffee) or change position of background into a own div?
  • change the floorplan page to block having draggable widgets - how to?
  • hopefully in the near future there will be some homeautomation icons @ fontawesome
  • any idea how to get other icons used in the widget? eg https://github.com/OpenAutomationProject/knx-uf-iconset
1 Like

Looks great! I haven’t really looked into the issues you raise so can’t really help. However, there is a lot of information on the net on dashing in general. You may find something there or in some of the other projects that you can adapt.

most important for me, is how to change the icons from fontawesome to images.

Great idea - I have set this up on a Raspberry Pi, Dashing + Openhab. It looks and works like a charm.

HOWEVER: The only issue I am having is that dashing is not updating anything. If I hit refresh in the browser, all the values are updated but otherwise not.

In the openhab console + frontend I can see that all the time values are updated, in Dashing in the console I don’t see them coming in / getting there. As I said, only if I hit refresh in the browser - there are new values/readings.

Where do I start looking / What went wrong - any ideas?

Check if the openhab rule is triggering. If not, check that the items you are forwarding to dashing are in the gDashboard group.

Before I start digging around and trying to find out how to make this work maybe someone here has already went down this road. I would like a single Widget for the thermostat that includes temp and setpoint. Is there a way for a single widget to access multiple devices. I’ve used dashing with smartthings and they have a widget already but the thermostat is a single device in smartthings. Here is the widget if anybody is curious. https://github.com/FlorianZ/hadashboard/pull/31/files

Have a look at the Ohheating widget. It does exactly that. However, it requires a rule to combine the data from the two items into a single json string, which is then sent to the dashboard. This rule is also in the dashboard.rules file.

Hello,

I’ve got some trouble with Ohweather.

My wigdet doesn’t update value from Openhab.

Here is my configuration :

default.erb

<li data-row="1" data-col="3" data-sizex="2" data-sizey="2">
  <div data-id="weather" data-view="Ohweather"></div>
</li> 

openhab.rb

require ‘json’

host_uri = ENV[“DASHING_URI”] || ‘http://localhost:3030

app = OHApp.new()

get ‘/openhab/dispatch’ do
app.getState(params[‘deviceId’], params)
end

post ‘/openhab/dispatch’ do
app.sendCommand(params[‘deviceId’], params[“command”],params)
end

SCHEDULER.every ‘5m’, :first_in => 0 do |job|
app.refreshWeather()

if app.currentConditions.length >0
send_event(‘weather’, {
now_temp: app.temperature,
humidity: app.humidity,
temp_low: app.temperatureLow,
temp_high: app.temperatureHigh,
precip: app.precipitation,
humidity: app.humidity,
icon: app.weatherIcon,
tomorrow_temp_low: app.tomorrowTemperatureLow,
tomorrow_temp_high: app.tomorrowTemperatureHigh,
tomorrow_icon: app.tomorrowWeatherIcon,
tomorrow_precip: app.tomorrowPrecipitation,
wind_speed: app.windSpeed,
wind_speed_gust: app.windGust,
wind_dir: app.windDirection})
end
end

thin.log

Writing PID to tmp/pids/thin.pid
Thin web server (v1.6.2 codename Doc Brown)
Maximum connections set to 1024
Listening on 0.0.0.0:3030, CTRL+C to stop
— !ruby/object:OHApp
temperature: 16
currentConditions: ‘’
humidity: 34
pressure: 0.0
precipitation: 0
windSpeed: 0
temperatureLow: 0.0
temperatureHigh: 0.0
weatherIcon: ‘’
weatherCode: ‘’
tomorrowTemperatureLow: 0.0
tomorrowTemperatureHigh: 0.0
tomorrowPrecipitation: 0
tomorrowWeatherIcon: ‘’
weatherObsTime:
windGust: 0
windDirection: ‘’
sunrise:
sunset:
192.168.1.204 - - [19/Mar/2016 17:03:15] “GET /events?lastEventId=&r=7277954920024854 HTTP/1.1” 200 - 44.8684
192.168.1.204 - - [19/Mar/2016 17:03:15] “GET /events?lastEventId=&r=1357259997864237 HTTP/1.1” 200 - 44.8338
192.168.1.204 - - [19/Mar/2016 17:03:15] “GET /events?lastEventId=&r=8759421512366101 HTTP/1.1” 200 - 44.8378
192.168.1.204 - - [19/Mar/2016 17:03:54] “GET /events?lastEventId=&r=8694336783915784 HTTP/1.1” 200 - 30.1782
192.168.1.204 - - [19/Mar/2016 17:03:54] “GET /events?lastEventId=&r=7625383899745213 HTTP/1.1” 200 - 30.1586

Any ideas ?

How have you defined your weather items in OH?

Hello,

Like this :

/* Weather */
Number Weather_Temperature “Température extérieure [%.1f °C]” (Weather) { http=“<[http://weather.yahooapis.com/forecastrss?w=629280&u=c:60000:XSLT(yahoo_weather_temperature.xsl)]” }
Number Weather_Humidity “Humidité extérieure [%d%%]” (Weather) { http=“<[http://weather.yahooapis.com/forecastrss?w=629280&u=c:60000:XSLT(yahoo_weather_humidity.xsl)]” }

You need to add the rest of the weather items, especially the condition code one, as this is used to determine whether or not to post weather updates to the dashboard.

1 Like

Ok thanks u, It’s possible to get every infos with yahoo_weather__command_.xsl or i need to use yahoo API with openhab.cfg ?

Possibly, but I haven’t looked into it. You may find it easier just to use the weather binding Weather Binding · openhab/openhab1-addons Wiki · GitHub.

hi all,

haven’t been working on my dashboard for a while (because everything works :wink:
now i realize i still miss something --> being able to look at my openhab rrd4j-charts.
i know dashing can render stylish charts but i guess making this work together with rrd4j surely is a though task.

however it’s easy to generate a chart (.png) in openhab with e.g. “http://localhost:8080/chart?items=temperatur&period=W”.

has anyone tried to display such chart in dashing? how would i get the .png into my dashboard, as it isn’t saved anywhere but generated when opening the url?

thanks for your help/ideas,
stefan