Dashboard UI suitable for tablets

Hi guys,

at the moment i write all my temperature and humidity dates into a mysql database. Now i want to show this stats with a chart widget in dashing.
There are good chart widgets like rickshaw, but i have no idea how to translate this informations back to dashing.
Has anybody setup something like this?

This a great UI and Iā€™ve been trying to learn and configure it. But I cannot get the Weather to show up on the dashboard. I do have the weather binding set up correctly and I can see the current min and max temperate in OH. Yet the dashboard will not show it.

This is part of the items i have in a ā€˜weather.itemsā€™ files

Number   Weather_Temp_Min_0		"Temperature min [%.2f Ā°F]"   (All, Weather) {weather="locationId=home, forecast=0, type=temperature, property=min, unit=fahrenheit, scale=1"}
Number   Weather_Temp_Min_1		"Temperature min [%.2f Ā°F]"   (All, Weather) {weather="locationId=home, forecast=1, type=temperature, property=min, unit=fahrenheit, scale=1"}

Number   Weather_Temp_Max_0   "Temperature max [%.2f Ā°F]"   (All, Weather) {weather="locationId=home, forecast=0, type=temperature, property=max, unit=fahrenheit, scale=1"}
Number   Weather_Temp_Max_1		"Temperature max [%.2f Ā°F]"   (All, Weather) {weather="locationId=home, forecast=1, type=temperature, property=max, unit=fahrenheit, scale=1"}

And the remainder of all my items start with Weather and look pretty much identical to all the samples I have seen.

EDIT: I got the weather working and showing correctly now. I must have had a typo someplace and after recopying things are showing up, and also was able to figure out showing 2 foscam cameras.

Can anyone give some help in how to show Ohheating Widget Works? Do I need to set a item in OH to read either a thermostat or does this pull from a sensor? I have a Honeywell Wifi thermostat but I believe the binding for that is still being developed

Normally, the dashing widgets as currently set up for openHAB, only show the state of a single openHAB item. The Ohheating widget is something I put together to show the states from two items at the same time - the current room temperature as measured by my central heating controller and the target temperature that the controller is set for. These two pieces of data are sent from openHAB via the following rule:

rule "Central Heating Dashboard widget update"
when
	Item CH_Indoor_Temp received update or
	Item CH_Target_Temp received update
then
	//Need to ensure that the new status string is a valid json, as otherwise when dashing gets the state property directly, it will fail
	
	//logInfo("Dashboard","Updating heating status Dashboard widget")
	var String status = '{"temperature" : ' + CH_Indoor_Temp.state.toString + ', "target" : ' + CH_Target_Temp.state.toString  + '}'
	postUpdate(CH_Dashboard,status)
end

The items in openHAB, CH_Indoor_Temp and CH_Target_Temp are normal Number type items. They need to be populated by whatever binding or other mechanism you are using to get the data into openHAB (in my case, I have a British Gas Hive controller, which I poll via a shell script every 10 minutes). I am not familiar with the Honeywell system, but if it has some sort of API access, you could probably use a similar shell script approach.

Thanks for the help.

I went ahead and added the rule as well as two Number Items to test and experiment with but havenā€™t gotten anything to show in the ohheating widget.

This is the line in the default.erb file.

<li data-row="4" data-col="2" data-sizex="1" data-sizey="1">
      <div data-id="CH_Dashboard" data-view="Ohheating" data-title="Heating" data-device="CH_Dashboard" data-suffix="&deg;F"></div>
    </li> 

and these are two items in experimenting. Not real temps, but just a number to learn.

Number CH_Indoor_Temp   "[%.2f]"   (GF_Living, gDashboard)  {astro="planet=sun, type=position, property=azimuth"}
Number CH_Target_Temp   "[%.2f]"   (GF_Kitchen, gDashboard) {astro="planet=sun, type=position, property=azimuth"}

And I do get those numbers to show up in an normal OH sitemap Item=CH_Indoor_Temp, but not in the dashboard.

Think Iā€™m missed something? I do stop/start both OH and dashing each time as well.

@ptmuldoon Have you defined the item CH_Dashboard in your openHAB items? The way it is currently set up, Ohheating requires a 3rd openHAB item that is used to actually post the combined data from the two temperature items to the dashboard. That is what the rule in my previous post does - it combines the states of CH_Indoor_Temp and CH_Target_Temp into the string item CH_Dashboard.

The openHAB items definitions are thus:

Number	CH_Target_Temp	"Central Heating Thermostat Setting [%.1f C]"	<heating>	(All,gDashboard,gHeating,CentralHeating_Chart)	
Number	CH_Indoor_Temp	"Central Heating Internal Temperature [%.1f C]"	<heating>	(All,gDashboard,gHeating,CentralHeating_Chart)	
String  CH_Dashboard    "Central heating dashboard widget data"                         (All, gDashboard,gHeating)

A dashboard layout entry for this combine item would then be something like:

  <li data-row="2" data-col="7" data-sizex="1" data-sizey="1">
      <div data-id="CH_Dashboard" data-view="Ohheating" data-title="Heating" data-device="CH_Dashboard" data-prefix="T: " data-suffix="&deg;C"></div>
  </li> 

Also you shouldnā€™t need to stop/start OH or dashing for these changes. The only time you need to restart dashing is if you make any changes to the job files.

@smar

Adding the CH_Dashboard item did the trick. And that all makes sense now how you need that item in your definitions and then how the Rule takes and combines the two items into the string.

Slowly making progress. Just wish i had some contacts and sensors to add to HA project. Currently its all just lights and some foscam cameras.

Hi! Thanks to all the contributors to this great interface. Iā€™m trying to get it up and running on an Rpi 2, but I now get the following:

bundler: command not found: thin
Install missing gem executables with bundle install

Iā€™ve followed the guide from both here and here - the 2 linked right at the thread start. Iā€™ve also run the command:

sudo apt-get install postgresql libpq-dev sqlite3 libsqlite3-dev

Can anyone help? Itā€™s Raspbian, Wheezy, the only thing Iā€™ve done is to resize the SD card and then follow these instructions. Iā€™ve also re-run the bundle install command and trying:

bundle exec thin -R config.ru start -p 3030

Results in the same error.

So I completely installed my Pi from scratch and refollowed all the instructions andā€¦I get further than before! But now Iā€™m faced with a blank dashboard, with the following in the log file

================================================================================
scheduler caught exception:
getaddrinfo: Name or service not known
/usr/lib/ruby/1.9.1/net/http.rb:762:in initialize' /usr/lib/ruby/1.9.1/net/http.rb:762:inopenā€™
/usr/lib/ruby/1.9.1/net/http.rb:762:in block in connect' /usr/lib/ruby/1.9.1/timeout.rb:54:intimeoutā€™
/usr/lib/ruby/1.9.1/timeout.rb:99:in timeout' /usr/lib/ruby/1.9.1/net/http.rb:762:inconnectā€™
/usr/lib/ruby/1.9.1/net/http.rb:755:in do_start' /usr/lib/ruby/1.9.1/net/http.rb:744:instartā€™
/usr/lib/ruby/1.9.1/net/http.rb:557:in start' /home/pi/dashboard/jobs/cameras.rb:50:infetch_imageā€™
/home/pi/dashboard/jobs/cameras.rb:68:in block in <top (required)>' /var/lib/gems/1.9.1/gems/rufus-scheduler-2.0.24/lib/rufus/sc/jobs.rb:230:incallā€™
/var/lib/gems/1.9.1/gems/rufus-scheduler-2.0.24/lib/rufus/sc/jobs.rb:230:in trigger_block' /var/lib/gems/1.9.1/gems/rufus-scheduler-2.0.24/lib/rufus/sc/jobs.rb:204:inblock in triggerā€™
ā€” !ruby/object:OHApp
temperature: 1
currentConditions: ''
humidity: 100
pressure: 0.0
precipitation: Uninitiali
windSpeed: 2
temperatureLow: 0
temperatureHigh: 0
weatherIcon: ''
weatherCode: ''
tomorrowTemperatureLow: 0
tomorrowTemperatureHigh: 0
tomorrowPrecipitation: 0
tomorrowWeatherIcon: ''
weatherObsTime:
windGust: 0
windDirection: 'ā€˜
sunrise:
sunset:
rm: cannot remove assets/images/cameras/snapshot1_old.jpeg': No such file or directory mv: cannot statassets/images/cameras/snapshot1_new.jpegā€™: No such file or directory

I check source of the page and it appears that there is something there, just nothing displayed

First of all i have to say at the beginning of my research, i had no idea of mysql query and ruby. So please be forgiving with my maybe bad ideas.

My goal is to feed informations from mysql database into the graph widget of Dashing.
Dashing uses ā€œjobsā€ to pull information. Like the openhab.rb from smar.
So i tried to find a way to use a job to pull the data from my sql db to the widget. Dashing has in its faqs a code snippet, how you can connect to a mysql database.

require 'mysql2'

SCHEDULER.every '15m', :first_in => 0 do |job|

  # Myql connection
  db = Mysql2::Client.new(:host => "192.168.1.1", :username => "dashing", :password => "SECRET", :port => 3306, :database => "users" )

  # Mysql query
  sql = "SELECT acct AS account, COUNT( acct ) AS count FROM users ORDER BY COUNT(*) DESC LIMIT 0 , 5"

  # Execute the query
  results = db.query(sql)

  # Sending to List widget, so map to :label and :value
  acctitems = results.map do |row|
    row = {
      :label => row['account'],
      :value => row['count']
    }
  end

  # Update the List widget
  send_event('account_count', { items: acctitems } )

end

This is basically what i want. It pulls information via mysql2 and transform it so the list widget can use it.

Jason, the autor of Rickshaw writes, that rickshaw can display more than one graph.

series = [
    {
        name: "Temp_Wohnzimmer",
        data: [{x:1, y: 4}, {x:2, y:27}, {x:3, y:6}]
    },
    {
        name: "Heating_Wohnzimmer",
        data: [{x:1, y: 5}, {x:2, y:2}, {x:3, y:9}]
    }
]
send_event('Temp_Wohnzimmer', series: series)

It has to be possible to pull the information from the db and transform it into this form. My first try looks like this:

require 'mysql2'

SCHEDULER.every '15m', :first_in => 0 do |job|

  # Myql connection
  db = Mysql2::Client.new(:host => "127.0.0.1", :username => "openhab", :password => "*****", :port => 3306, :database => "openhab_temp" )

client.query("SELECT Time, Value FROM Item3, LIMIT 30").each do |row|

	puts row[0] : row[1];

end

print("points=["); 
i = 0;
while (i < 30)
{
  if (i > 0) print(", ")
  print("{x:" + x + ", y:" + y + "}");
  i++;
}
print("]");

send_event('convergence', points: points)

end

Maybe somebody with ruby knowledge can help me with this problem.

Make sure you have the folder assets/images/cameras if you are using the cctv camera widgets. If not, please remove the file jobs/cameras.rb

To confirm, where it says ā€œEdit the lib/ohapp.rb file, and make sure that your openhab server name and port are correctly specifiedā€ is this the IP address and port of the openhab device and webserver port i.e. in my case 192.168.1.110 and 8080 for the port?

Also, now getting this

/usr/lib/ruby/1.9.1/net/http.rb:744:in start' /usr/lib/ruby/1.9.1/net/http.rb:1284:inrequestā€™
/home/pi/dashboard/lib/ohapp.rb:61:in refreshWeather' /home/pi/dashboard/jobs/openhab.rb:18:inblock in <top (required)>ā€™
/var/lib/gems/1.9.1/gems/rufus-scheduler-2.0.24/lib/rufus/sc/jobs.rb:230:in call' /var/lib/gems/1.9.1/gems/rufus-scheduler-2.0.24/lib/rufus/sc/jobs.rb:230:intrigger_blockā€™
/var/lib/gems/1.9.1/gems/rufus-scheduler-2.0.24/lib/rufus/sc/jobs.rb:204:in block in trigger' /var/lib/gems/1.9.1/gems/rufus-scheduler-2.0.24/lib/rufus/sc/scheduler.rb:430:incallā€™
/var/lib/gems/1.9.1/gems/rufus-scheduler-2.0.24/lib/rufus/sc/scheduler.rb:430:in `block in trigger_jobā€™

192.168.1.52 - - [21/Jan/2016 22:59:33] ā€œGET /default HTTP/1.1ā€ 200 2213 0.0402

Yes, thatā€™s correct. However, your error log looks incomplete in that the actual error message is missing. Nevertheless, looking at the stack trace youā€™ve given, you seem to have a problem with the weather data. Have you defined the "Weather" group for all your weather items in openHab and have they been named as required? If you donā€™t want to use weather data, you can comment out/delete everything in the openhab.rb file after the line starting # Weather update

This is the full error log

Writing PID to /home/pi/dashboard/dashing.pid
Thin web server (v1.6.4 codename Gob Bluth)
Maximum connections set to 1024
Listening on 0.0.0.0:3030, CTRL+C to stop

scheduler caught exception:
Address family not supported by protocol - socket(2)
/usr/lib/ruby/1.9.1/net/http.rb:762:in initialize' /usr/lib/ruby/1.9.1/net/http.rb:762:inopenā€™
/usr/lib/ruby/1.9.1/net/http.rb:762:in block in connect' /usr/lib/ruby/1.9.1/timeout.rb:54:intimeoutā€™
/usr/lib/ruby/1.9.1/timeout.rb:99:in timeout' /usr/lib/ruby/1.9.1/net/http.rb:762:inconnectā€™
/usr/lib/ruby/1.9.1/net/http.rb:755:in do_start' /usr/lib/ruby/1.9.1/net/http.rb:744:instartā€™
/usr/lib/ruby/1.9.1/net/http.rb:1284:in request' /home/pi/dashboard/lib/ohapp.rb:61:inrefreshWeatherā€™
/home/pi/dashboard/jobs/openhab.rb:18:in block in <top (required)>' /var/lib/gems/1.9.1/gems/rufus-scheduler-2.0.24/lib/rufus/sc/jobs.rb:230:incallā€™
/var/lib/gems/1.9.1/gems/rufus-scheduler-2.0.24/lib/rufus/sc/jobs.rb:230:in trigger_block' /var/lib/gems/1.9.1/gems/rufus-scheduler-2.0.24/lib/rufus/sc/jobs.rb:204:inblock in triggerā€™
/var/lib/gems/1.9.1/gems/rufus-scheduler-2.0.24/lib/rufus/sc/scheduler.rb:430:in call' /var/lib/gems/1.9.1/gems/rufus-scheduler-2.0.24/lib/rufus/sc/scheduler.rb:430:inblock in trigger_jobā€™

This is my items file: http://pastebin.com/781mmGpL

Progress!

Now this in the thin.log file:

Writing PID to /home/pi/dashboard/dashing.pid
Thin web server (v1.6.4 codename Gob Bluth)
Maximum connections set to 1024
Listening on 0.0.0.0:3030, CTRL+C to stop
ā€” !ruby/object:OHApp
temperature: 8
currentConditions: ''
humidity: 86
pressure: 1020
precipitation: '20ā€™
windSpeed: 0
temperatureLow: 4
temperatureHigh: 10
weatherIcon: sunny
weatherCode: sunny
tomorrowTemperatureLow: 6
tomorrowTemperatureHigh: 11
tomorrowPrecipitation: 10
tomorrowWeatherIcon: mostlycloudy
weatherObsTime: '2016-01-22T21:57:24ā€™
windGust: 0
windDirection: NNE
sunrise:
sunset:
192.168.1.52 - - [22/Jan/2016 21:58:52] ā€œGET /default HTTP/1.1ā€ 200 1931 0.0389
192.168.1.52 - - [22/Jan/2016 21:58:57] ā€œGET /favicon.ico HTTP/1.1ā€ 200 1150 0.0041

From what I can see, that should be working, but Iā€™m still not seeing anything in the browser.

Ok, so I think itā€™s to do with the fact that my sunrise and sunset is not passing through, would this be a reason the dashboard doesnā€™t display?

@rsachoc Your log looks fine now, The sunrise/sunset items should not be required for widgets to show on the dashboard.

Have you made any changes to your widgets/dashboards? Iā€™ve found that even a single extra ā€˜spaceā€™ in the coffeescripts for the widgets can stop the whole dashboard from working. Maybe you should try putting a single widget in the dashboard and delete everything else. As the weather data looks to be coming through, try that to start with. Also have a look in Chromeā€™s console (under more tools/developer tools) and see if any errors are showing up there.

Thanks smar, for all your help, Iā€™m going to look into that now, Iā€™m pretty sure I didnā€™t change any of the widgets, but I have modified to default.erb to remove everything except the weather widget. Iā€™m going to relook at this.

One other question, in the instructions on github, it says:

Copy the rule file from the dashboard/openhab_rule folder into your openhabā€™s rule folder (e.g. /opt/openhab/configurations/rules). Edit the rule file and change the the auth_token here to whatever you set it in the previous step (or leave as is if you didnā€™t make any changes in the previous step).

I noticed in that same file (dashboard.rules) there is a reference to the dashing URI, Iā€™m running dashing on a seperate Rpi, do I need to change this from localhost? I have tried both with the same result (i.e. still not working), but I wanted to check what the correct one was. Also, I guess I have never mentioned this, but I am running Openhab and dashing on seperate Rpiā€™s, it should still work, right?

Here is the Chrome error console

I suspect the favicon one is not bad, but the other looks like it might be the issueā€¦going to Google and see

Working! That error appears to be something wrong with the way node.js was installed, so I removed it and following this guide to install it manually.

smar, thanks once again for the guidance and not giving up on me, much appreciated!

Can anyone give some little tips on how to change/customize the icons in the widgets? Iā€™m starting look at at some the css info and see references to the icon tye. For example, the ohSwitch shows ā€˜circle-thinā€™ in the ohswitch.coffee file.

But Iā€™m not sure what we need to change those to show a lightbulb. a door lock, etc.