Dashboard UI suitable for tablets

I think I’m just goint to do external only it’ll keep this alot simpler because I have other things such as the JSON I am doing and don’t wanna have to recode everything. Also since you forced it to 100% where can I change that? How can I set a dim state of each light in my living room to a variable when I hit my group off switch, so this way when I hit the switch on it will return both states. I placed this at the top of my file

var number dimstate1 = 0
var number dimstate2 = 0

Heres what I put in my rule.

/* Living Room Group On/Off Switch */
rule “Living Room On/Off”
when
Item Light_LivRoom_AllLights_Sw received command
then

  if(receivedCommand==OFF) {
  	if(Light_LivRoom_Steps_Dim.state instanceof PercentType) dimstate1 = Light_LivRoom_Steps_Dim.state as PercentType
  	if(Light_LivRoom_Candles_Dim.state instanceof PercentType) dimstate2 = Light_LivRoom_Candles_Dim.state as PercentType
  	sendCommand(Light_LivRoom_Steps_Sw, OFF)
  	sendCommand(Light_LivRoom_Candles_Sw, OFF)
  	postUpdate(Light_LivRoom_Steps_Sw, OFF)
  	postUpdate(Light_LivRoom_Candles_Sw, OFF)
  }
  if(receivedCommand==ON) {		
  	sendCommand(Light_LivRoom_Steps_Sw, dimstate1)
  	sendCommand(Light_LivRoom_Candles_Sw, dimstate2)
  	postUpdate(Light_LivRoom_Steps_Sw, dimstate1)
  	postUpdate(Light_LivRoom_Candles_Sw, dimstate2)
  }

end

Maybe I’m missing something but I thought this would set the variables once the off switch is hit.

This is my Dashboard :smile:

Why are the font sizes not equal?
UL_Speed, DL_Speed, Leistung (Power Consumption)
I tried to adjust the css, but that didn’t work.

Can i round those values in the Coffescript, or should it be done within OpenHAB?

Thanks

1 Like

What you using to pull the UL and DL Speeds? Thats pretty sweet. I’d do the round on OpenHAB when its setting the value. I like Looks clean!

speedtest-cli does the magic
(remove the .xml, place it in /scripts)
netstat.sh.xml (1.3 KB)

Is there a solution for the different Font sizes in Dashing?
Is it possible to “auto-update” the values (Switches and so on)?

1 Like

This is more of an OpenHAB help more than the dashboard I’ll ask in a new thread

The SCSS files should be where you are able to adjust the font size. Just make sure the .html file is matching to the class you are trying to edit.

@Robert_Burgess As @apatel mentioned some posts back, this is in the ohdimmer widget coffeescript in the toggleState function:

toggleState: ->
    newState = if @get('state') > 0  then '0' else '100'
    @set 'state', newState
    return newState

WRT your openHAB rule, without trying it out it is difficult to see what the problem is… One thing you have is a type difference - your global vars are defined as Numbers, but when you assign values they are typecast to PercentType. This shouldn’t cause a problem but maybe worth using logInfo to see what is happening.

Also, if you have a number of devices that you want to track the previous state for, you could use hashmaps - have a look at the dashboard rule file where we track the last state.

@3DJupp Normally individual widgets override their default font sizes in their respective scss file. I had a quick look at the ohmeter widget, but don’t really see anything in its scss file related to font sizes. I’m assuming you are using this widget as is, without any modifications? If it is because of the size of the string being returned from openHAB, then yes you may need to adjust the length of the string. You can easily round in the coffeescript. Have a look at the ohheating widget where the openHAB state value is converted to a float, and then set to a 1 decimal place:

get: -> if @_temperature then parseFloat(@_temperature).toFixed(1) else 0
  input.ohmeter {
    background-color: $ohmeter-background;
    color: #fff;
    font-size: 20px !important;
  }

the “!important;” parameter is “important” to override the font-size.

1 Like

@smar here is a link to the new thread I started since the question wasn’t dashboard related. I seen that spot in the rules and thought this was the case. But I wasn’t sure how to get it to use the last percentage

@Robert_Burgess, I had an issue getting Dashing to connect to OpenHAB when I initially set it up. I had to change my security from security:option=on to security:option=EXTERNAL. This is not ideal in my opinion but is better than having to turn it completely off.

Yea, I ended up just doing external as well. For me it’s fine and I can deal with it. Now I’m trying to think of what else I wanna have in my dashboard lol

@Robert_Burgess Could you resend the link as it doesn’t seem to be showing up in your post.

@naturalblaze I believe that openHAB uses basic http authentication (https://en.wikipedia.org/wiki/Basic_access_authentication) Did you try modifying the ohapp object to send your authentication information with the REST calls? Examples here: https://github.com/openhab/openhab/wiki/Samples-REST

Has anyone tried to make some nice looking graphs in Dashing? One solution would be to pull a static png created with the built-in charting (RRD) service. But this doesn’t qualify as nice looking.

There are various graph widgets floating around for Dashing, e.g.

The last one in the links above shows how to use highcharts (similar to the charting engine in Habmin).

It shouldn’t be too difficult to take some of the above and port for use with openHAB.

An Updated look at my dash board for the moment. I’ve pulled in Waze Traffic data thanks to a start from @apatel . I just tweaked to my liking. I think my next item is creating a full weather page. With full weather breakdown in different boxes. Granted this might not be needed but someone else might want it as well so I’ll give it a shot. When I get a chance to setup a nice webcam I’m going to try and place that image in the open section.

Looks good!

Helo @smar so I wanted to try and go back to what I was doing before. When I click the dimmer switch I turn off the lights. I want to save the previous state and than when I turn it on pull that previous state. in my rrd4j.persistance file I am saving the last state from when I’m rebooting and that works fine. I’m trying to free up some space on the screen to do more with it. I’d like to have my dimmers just be a 1x1 block with the on and off ability to it.

Also the weather widget I’m a little curious. How is it mapping the string from the condition. I can’t seem to see whats mapping that. The names dont seem to match up.

last thing, can make the weather widget pull up another page or not? I haven’t found a way so I’d thought I’d ask. As always thanks for the help. Few things i"m working on and I’m building a nice frame to walmount a nexus7 which I can’t wait to have running.

@Robert_Burgess - although you could probably use persistence to get the previous state, it may be simpler to just use the hashmap lastStateMap that is already there in the dashboard.rules file. This tracks the last state so that we don’t post to dashing unless there has been an actual change in state for a given item, as not every item in the gDashboard group is changed when the rule is triggered. You could then (a) modify the dashing dimmer widget to send ON instead of 100 when the on/off button is toggled and (b) in the openhab dashboard.rules, trap the ON command, look up the last state and post that back to the dashing widget.

Changing the size of the dimmer is done in the dashboard layout file (e.g. default.erb). The parameters data-sizex and data-sizey define the size in multiples of single blocks. Thus for a 1x1, you would have:

<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">

WRT the weather widget, I assume you mean the weather icon? This is taken from the weather condition code returned by the openHAB weather provider:

 when "Weather_Code"
          @weatherCode = value           
          @weatherIcon = (value.gsub "-","").gsub "day",""

The icon name is basically formed from the weather condition code (we strip out ‘-’ and the word ‘day’ from the code to correctly match the icon names).

Hope that helps.

@smar, thank you. The dimmer size I knew. The weather icon i was wondering about using a different icon I have instead of the font. I’ll have to look at the lastStateMap and how to trap that value.

I figured out how the datamapping was happing, I missed the one file at first but back to the question, could I substitute a icon file instead of the font? Should work the same way I suppose right.

mpff - after several re-installs and even working from blank Raspberry Pi i managed to get the standard framework for dashing up and running.
But when i then cloned the content of git to my maschine and tried using the start script provided its getting me the following error message:

Could not find addressable-2.3.6 in any of the sources

and requests:

Run `bundle install` to install missing gems.

doing this it ends up in the following error message:

Installing do_postgres 0.10.14 with native extensions

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 extconf.rb
checking for main() in -lpq... no
checking for main() in -llibpq... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/bin/ruby1.9.1
        --with-pgsql-server-dir
        --without-pgsql-server-dir
        --with-pgsql-server-include
        --without-pgsql-server-include=${pgsql-server-dir}/include
        --with-pgsql-server-lib
        --without-pgsql-server-lib=${pgsql-server-dir}/lib
        --with-pgsql-client-dir
        --without-pgsql-client-dir
        --with-pgsql-client-include
        --without-pgsql-client-include=${pgsql-client-dir}/include
        --with-pgsql-client-lib
        --without-pgsql-client-lib=${pgsql-client-dir}/lib
        --with-pqlib
        --without-pqlib
        --with-libpqlib
        --without-libpqlib
Could not find PostgreSQL build environment (libraries & headers): Makefile not created


Gem files will remain installed in /tmp/bundler20151005-4443-1ujuc2udo_postgres-0.10.14/gems/do_postgres-0.10.14 for inspection.
Results logged to /tmp/bundler20151005-4443-1ujuc2udo_postgres-0.10.14/gems/do_postgres-0.10.14/ext/do_postgres/gem_make.out
An error occurred while installing do_postgres (0.10.14), and Bundler cannot continue.
Make sure that `gem install do_postgres -v '0.10.14'` succeeds before bundling.

Any idea what this error message is about? more detailed errormessage was:

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions into the /var/lib/gems/1.9.1 directory.

i changed access permission to even 777 - so this should not be an issue accessing the directory.

Any help would be appreciated.

thx
Karsten