Dashboard UI suitable for tablets

I’m running dashing smar000 solution for OpenHAB2. https://github.com/smar000/openhab-dashboard

Using the SSE client provided oh2dashing.rb with is fantastic. Managed to setup some widgets and learning day by day by reading all from you here.

I have a Sonos controller in-house and now I’m up to adding widgets for radiostations and also getting the openHAB2 item “Player” to work. So I edited the Ohswitch widget and changed ON to Play and OFF to Pause, this works great! It does the sendCommand to my “Player” item which is:

Player Controller (controllerGroup) {channel="sonos:CONNECTAMP:MY_UDN_ID:control"}

I then edited the widget Ohswitch again (know its a bit ugly) to make widget do sendCommand “my radio name” and this works great to, I will later on try to code it a bit better instead of hard-code every station name.

My problem is that every 4-5 time I try to change radiostation, even from the native Sonos controller application the status of my Player “switch” does not update and so presents the Sonos as paused. I watch the “ring” on my switch become “off” when my Sonos controller buffers the new station and then sometimes it relights to green but often don’t. I can’t figure out from tail of OpenHAB any differences taking place when it does work in comparison to when is does not work. Maybe the millisec between itemstatechanged ?

This is what tail of openhab tells me:

2016-11-10 13:29:46.374 [ItemCommandEvent          ] - Item 'Radio' received command P2
2016-11-10 13:29:46.405 [ItemStateChangedEvent     ] - sonos_CONNECTAMP_currenttitle changed from Rendezvous med Kristjan Saag to 
2016-11-10 13:29:46.442 [ItemStateChangedEvent     ] - sonos_CONNECTAMP_control changed from PLAY to PAUSE
2016-11-10 13:29:46.448 [ItemStateChangedEvent     ] - Controller changed from PLAY to PAUSE
2016-11-10 13:29:46.815 [ItemStateChangedEvent     ] -  sonos_CONNECTAMP_control changed from PAUSE to PLAY
2016-11-10 13:29:46.827 [ItemStateChangedEvent     ] - Controller changed from PAUSE to PLAY
2016-11-10 13:29:47.619 [ItemStateChangedEvent     ] -  sonos_CONNECTAMP_currenttitle changed from  to Rendezvous med Kristjan Saag

My feeling right now is that dashing (coffescript?) does not recognize a fast change, in this case a half second.

I don’t have a Sonos so can’t really help. However, you could look in your browser’s console to see if there are any errors there?

Hi @smar

Weather and clock widget works great however I have problem with other widgets refreshing data.
I configured item with http binding to connect to arduino to get data from temp sensor in openhab2. In oh2dashing.rb SSE Client logs from dashing site i can see this:

item: temperaturarduino, State: 22.00, Action: state
item: temperaturarduino, State: 22.00, Action: state
item: temperaturarduino, State: 23.00, Action: state
item: temperaturarduino, State: 24.00, Action: state
item: temperaturarduino, State: 23.50, Action: state

Widget don’t wan’t to refresh new data until I manualy refresh webpage.
I using Ohtemp widget to show this in dashing.

Hi @razer

It is difficult to say anything without further information. The dashboard is working for myself and other users, so most likely it is a problem with your installation/configuration, You may want to carefully look through the process and make sure you haven’t missed anything.

Problem solved with data refresh. I haven’t properly configured openhab.

I have another questions.

  1. How to format string in ohtext widget ? For example date time.
  2. There is possibilty to change ohswitch widget default button to a button with mappings like in openhab ?

The post in the link you gave above was deleted!!
Can you give me a specific detail how to setup this project on Raspberry Pi 3?
Thanks for your help

I have not looked into the code in sometime, so cannot recall off-hand what the framework itself supports. However, as the dashboard itself is HTML/coffeescript based, you can simply create new widgets that support whatever formatting and/or mappings you need.

Hi @All,

My Problem:
The Dashboard gets the Info from OpenHab but the Widget dont change…

192.168.178.199 - - [18/Jan/2017 09:00:37] "GET /views/ohheating.html HTTP/1.1" 200 225 0.0014
{"type":"NumberItem","name":"Heating_Schlafzimmer","state":"16.60000000000000142108547152020037174224853515625","link":"http://192.168.178.103:8080/rest/items/Heating_Schlafzimmer"}
192.168.178.199 - - [18/Jan/2017 09:00:37] "GET /openhab/dispatch?widgetId=Heating_Schlafzimmer&deviceId=Heating_Schlafzimmer&deviceType=temperature HTTP/1.1" 200 181 0.1702

any ideas?

I’ve been using this on two wall-mounted tablets for a while and wanted a way to blank them when I’m not home or asleep to reduce burn-in and save a bit of power. I couldn’t find a way to blank the dashboard but it’s fairly easy to blank widgets so I wrote a script to do this and linked it to an item which I can call via the exec binding.

The widgets just need a small tweak to their .coffee file to add this:

  onData: (data) ->
    if @get('visible') == 'ON'
        $(@node).fadeIn()
    if @get('visible') == 'OFF'
        $(@node).fadeOut()

A simple shell script can then turn the widgets on or off:

for widget in $WIDGETS
do
    curl -d '{ "auth_token": "secret", "visible": "OFF"}' "$DASH_URL/$widget"
done

Add a rule to turn the tablet dashboards on/off when required.

You can use tasker and motion sensor apps on Android to turn the screen of completely. and then back on when you are in front of the tablet. There should be some notes on this in the Readme file on the github.

Hi, I’m trying to get data from Ruter.no using your example but I have trouble with JSONPATH. Is your config still working? Are you on OH2 with JSONPAT 2.0.0 transformation?

Hi Vegar. It worked well when I was using it under OH 1. But since that, I have upgraded my system to OH 2 and switched to using habpanel. To lessen myself of the painful exercise of implementing this all over again, I have gone for the next best thing which is an iframe wiith ruter.no real time widget on habpanel. This works very well, so I recommend you to check it out: https://ruter.no/iframe-realtime.html

Example: https://ruter.no/iframe-realtime.html#(3010515)Jakob%20kirke%20(Oslo)

Hi, thanks, nice tip and also a nice design as many web-page implementations in habpanel area not that nice. I’m working on some ruler to split the json return from ruter.no into multiple items to also be able to present it in basic UI and habDroid and will share it when/if solved.

Huge kudos @smar for sharing your original work that was forked from smartthings; its making it easier to get buy off from the wife to automate things!

I wanted to share what I have designed for my house, I can supply more info if someone is interested in adapting it to their needs.

The Living Room Roku is a simple http call, it will report which streaming service app is in use (Roku is the main home screen).
The two “home” panels I modified a Ohpresence widget that I found somewhere, what I like about it is that it won’t change the state like the Ohswitch widget does.
The final note I have for the Play/Pause Roku (its the same api keypress, blame Roku) it kicks off an OS script to send a curl post command to pause or unpause the Roku (useful for lunch/dinner) helps to know if its in an app or on the main screen; which is why the Living Room Roku widget is useful.

–> to be continued in the next post, new user and all and only allowed to post 1 screenshot.

2 Likes

First sub page is the Roku remote layout with shortcut channels, below is a snippet of how I setup the channel widgets:

<div data-id="RokuSyFy" data-view="Image" data-image="/86398.png" data-device="RokuSyFy"></div>

I named the png file to match the channel ID of the Roku app. All of these widgets are also virtual/dummy switches, for some reason OpenHab would double http post commands to the Roku (again a Roku problem as it doesn’t understand ON/OFF). I went through the pain of setting up individual rules for each widget/switch, will probably revisit on a rainy day to setup a smarter way to make the OS curl calls.

This sub page was meant to be more informational, the wife however brought to my attention she wanted buttons to change the hvac modes. So the 4 widgets on the left side are mapped to virtual/dummy switches for rules to watch and update the actual hvac_mode item.

Final sub page is still a work in progress and meant for overrides or scene enforcement. Override Away will force presence in OpenHab for a house sitter, and the morning lights are for nights where I might be have a coughing fit and sleep in the living room…nothing like waking up early due to OpenHab doing exactly what you conifugred it to do. :triumph:

Hi Smar, thanks for this wonderful post. I was trying to use the Smashing/Dashing dashboard with OpenHAB MQTT service. I have the OpenHAB running on a raspberry Pi and it is also working as an MQTT server. And I have few ESP8266 based wireless devices subscribes and publishes to topics with the MQTT server. So with this setup I am able to control the devices using the OpenHAB App from by phone. Now I was trying to use the nice dashboard (Dashing/Smashing) on my tablet and wanted to control the devices. I found your example in the below link which works with Dashing + OpenHAB + REST API. So I was wondering if there is a way to try MQTT combination instead of REST ? Really appreciate your help and suggestion. Kindly let me know if you need more details about what I am trying to do.

This was the GITHub page I was referring.

I haven’t looked at the dashing code in some time, but it should be possible to change to an mqtt based implementation. You will need to install ruby based mqtt gems, e.g. https://github.com/njh/ruby-mqtt and then update:

  1. the getState and sendCommand functions in the lib/ohapp.rb file

  2. the replace the SSE client (i.e. the oh2dashing.rb) with an mqtt based equivalent, that subscribes to changes on the mqtt thread and posts to dashing.

Hey Smar, that was a great suggestion . I got it to work from the dashing UI with Openhab running on the Pi. I am able to control the devices now. I had another question though. As I mentioned earlier I have the OpenHAB app already working on my smartphone, from which I can control the devices too. But the problem looks to be is when I change the device status from the App it is not getting updated in the Dashing Dashboard on the tablet. If I do a refresh again on the browser then it shows the updated status. So I was wondering if we can do an autorefresh whenever the device changes its status. Thanks for your help.