Dashboard UI suitable for tablets

Your scene item is defined as a Number, but the command being sent from dashing is ON. Try changing the item type to Switch and see if that helps.

The scene command IS working in the original openhab GUI and in GreeNT.

And if I set it as a Swirch it won’t work in the Openhab GUI or GreeNT.
The log says:

21:56:24.551 INFO o.o.model.script.Dashboard[:53] - Item Scene_Gooodnight has changed state from 0 to: OFF
21:56:24.551 INFO o.o.model.script.Dashboard[:53] - POSTING: {“auth_token” : “openH4b”, “state” : “OFF”}
21:56:24.551 INFO o.o.model.script.Dashboard[:53] - URI: http://localhost:3030/widgets/Scene_Gooodnight; JSON = {“auth_tok
en” : “openH4b”, “state” : “OFF”}

I think I must have a different Widget that can send the actual number on the KNX network

You can create a switch item that the dashboard ui can toggle on and off, no binding needed. Then create a rule that monitors that switch and sends the appropriate command to the knx binding item

OK yhat was a good idea. And then have the rule to toggle it of again .
I’ll try that

I can now confirm that it worked.
Just a Dummy switch item and a rule that act on the Dummy switch action

Thanks for the help

For anyone that is using the dashing solution with Android tablets and does not need to create custom widgets, I would recommend that you look at @igor’s solution - Different take on client UI (Android for now).

Installation is just an Android app and nothing extra is required on the server side. The user interface itself feels very slick.

How did you do the trick with foscam cameras? Which widget did you used? I suppose you did it with foscsm cameras set to mjpeg streaming mode?

@zacofany

Hey Zac. My HOA project has been in transition lately and haven’t looked at this piece of it and Dashing in quite a while. If your not in to much of a hurry, I can look later tonight when i"m back home.

I also have older foscam camera’s of the FI8918 models and not their newer one’s and seem to have lost lost connectivity to one of them.

If I have my ‘systems’ right, I think one of the key’s to getting this to work was ensuring you had the correct folders and permissions set up. I think this was not really a live feed either, but taking snapshots and updating every 5 seconds?

@zacofany

Zac, If your still having trouble, below is the setup for one of my foscam camera in the cameras.rb file

@camera1Host = "192.168.xx.xx"  ## CHANGE
@camera1Port = "xxxx"  ## CHANGE
@camera1Username = 'myusername' ## CHANGE
@camera1Password = 'mypassword' ## CHANGE
@camera1URL = "/snapshot.cgi?user=myusername&pwd=mypassword"
@newFile1 = "assets/images/cameras/snapshot1_new.jpeg"
@oldFile1 = "assets/images/cameras/snapshot1_old.jpeg"

Change the xx’s where needed as well as the username and password for your camera.
But note, you must disable/comment out any unused camera down at the bottom of the file in the scheduler area. I believe the widget will only work as long as their is an actual camera for each one.

@ptmuldoon thank you for help. I’ve done it already, however it’s kind of hmm… silly to tak snapshots from camera instead of providing full stream. I have FI9821v2 cameras and they can stream FJPEG stream, which is easy to implement even in classic OpenHAB UI. So I’d like to have widget which would allow me direct use this stream in dashboard.
Anyway, currently the only solution I have is to combine dashboard with Foscam’s http://foscam.us/forum/free-generic-browser-interface-for-foscam-fi9821w-cameras-t4341.html#p20338.
I added redirections from Dashboard to Camera website and back from Camera to dashboard by adding additional button. This works, however I’d love solution where foscam stream would be just embedded in dashboard.

I’m also having this same issue.

I have dashing running well with weather and configured to use my own lights.

I have motion running on a raspberry pi of my front door and installed the nph-mgrab on both my pi and my openhab server in the appropriate /usr/lib/cgi-bin…

Apache2 is installed on both (I wasn’t sure which one it should be installed on so for experimentation I tried both)

I also made sure that my directories are created
(in my case it’s /var/tmp/snapshot1_blahblah)
The make file for the npn-mjgrab on the Openhab server was set to point to the pi’s IP address.

In the cameras.rb file I tried pointing the camerahost, port etc to both the pi’s IP address and using a localhost address (127.0.0.1)

Oddly enough if I try calling the script in a browser

for example: http://192.168.1.148:8080/cgi-bin/nph-mjgrab?1

I get an error showing

Problem accessing /cgi-bin/nph-mjgrab. Reason:

** ProxyServlet: /cgi-bin/nph-mjgrab

Anybody have any ideas?

So I actually answered my own question…

Turns out I had to run this command on a new apache installation

sudo a2enmod cgi
then
sudo service apache2 restart

and I was able to get it running.

Now I have a really weird issue…

When I call the image - it gets partially cut off

Honestly can’t think of what it might be…

Haha and I seemed to have solved my problem again…

I tried calling the mjpeggrab from within the cgi-bin on the openhab server pointing to the pi camera.
(instead of having it in the cgi-bin on the pi)
that seems to have rendered the whole image.

I’m guessing the pi may have been a little underpowered since there were two cameras on it.

Either way i’m good now :smiley:

Just in case someone is interested, I hacked together a small update-all-states-every-minute ruby function. Basically it polls OpenHab via REST and sends the state JSON value from OpenHab to the appropriately named Dashing widget with send_event. This assumes that your OpenHab name is the same as the widget ID, which should be how everyone has it set up anyway. Uncomment the if statement if you only want specific types, such as dimmable items, etc

First of all, for any widget that doesn’t already have it, you need to add a data update part. For example, for Ohdimmer, I added this to ohdimmer.coffee, which simply sets the state to the json state value

  onData: (data) ->
    #debugger
    #console.log("State is " + @get('state'))
    @set 'state', @get('state')

Then I created this in openhab.rb (you may want to change localhost to be something else, ip address or whatever)

# This will update the status from OpenHab for all Items
# (uncomment if-check to update only specific types)
SCHEDULER.every '1m', :first_in => 0 do |job|
  http = Net::HTTP.new("localhost", 8080)
  http.use_ssl = false
  response = http.request(Net::HTTP::Get.new("/rest/items?type=json"))
  data = JSON.parse(response.body())
  data['item'].each do |child|
    #if child['type'] == "DimmerItem"
      name = child['name']
      s = fetchStatus(name)
      send_event(name, s)
    #end
  end
end

def fetchStatus(id)
  #puts "Got here for " + id
  http = Net::HTTP.new("localhost", 8080)
  http.use_ssl = false
  response = http.request(Net::HTTP::Get.new("/rest/items/"+id+"?type=json"))
  data = JSON.parse(response.body())
  return data
end

Also ensure that the top of openhab.rb has these imports, or it won’t work:

require 'json'
require 'net/http'

The code is far from perfect, I’m not a Ruby programmer, but it should do the trick. Enjoy! Let me know if you improve it :slight_smile:

1 Like

I have Dashing set up and running on a Mac. Does anyone know how to get it running at boot? I have created a LaunchD plist file, but I think I might be calling the wrong actual ‘dashing’ file. Any ideas? My plist is below.

`<?xml version="1.0" encoding="UTF-8"?>

Label local.dashing WorkingDirectory /Users/xxx/Desktop/dashing ProgramArguments /bin/sh /Users/xxx/Desktop/dashing/dashing start RunAtLoad `

Hello everybody!
I’m configuring my dashboard.
I’d like to set a meter but i have 2 question:

  1. the value on openhab have 3 decimal, is possibile tu cut it?
  2. how i can set scale? (i.e. 0w to 3000w)
    Thanks in advance!

Edit:
for the second question, data-bind-data-min=“0” data-bind-data-max=“2500”.

But really don’t understand how to cut 3 decimal!

Did you load the launchD file with “launchctl load -w “plist-file.plist””?

Bye, Frido.

1 Like

You can get rid of the decimals by extracting the integer value of the state. Have a look at the ohdimmer.coffee file and you will see that parseInt(@get('state')) is used to ensure we have only integer values.

Thanks for help.
On the ohmeter widget i have this:

queryState: ->
$.get ‘/openhab/dispatch’,
widgetId: @get(‘id’),
deviceId: @get(‘device’),
deviceType: ‘power’
(data) =>
json = JSON.parse data
@set ‘state’, json.state

Don’t understand how to edit;
I should edit this:?
parseInt(@get(‘device’))