Dashticz - Custom JS

Dashticz, alternative dashboard based on HTML, CSS, jQuery

Moderators: robgeerts, htilburgs

User avatar
robgeerts
Posts: 1239
Joined: Saturday 24 January 2015 23:12
Target OS: NAS (Synology & others)
Domoticz version: 3.7067
Location: NL
Contact:

Re: Dashticz - Custom JS

Post by robgeerts » Tuesday 06 February 2018 22:13

_SHOW_LASTUPDATE is an old variable, this is the working code:

Code: Select all

function getBlock_150(device,idx){       //idx 150 - iPhone Harm
   $('.block_'+idx).attr('switchDevice(this)');
   var html='';
   html+='<div class="col-xs-4 col-icon">';
      if(device['Status']=='Off') html+=iconORimage(idx,'fa-toggle-off','','off icon');
      else html+=iconORimage(idx,'fa-toggle-on','','on icon');
   html+='</div>';
   html+='<div class="col-xs-8 col-data">';
   html+='<strong class="title">'+device['Name']+'</strong><br />';
   if(device['Status']=='Off') html+='<span class="state">AFWEZIG</span>';
   else html+='<span class="state">AANWEZIG</span>';
 
   // check if device has show_last_update=true
   if((settings['last_update'] && (typeof(blocks[idx])=='undefined' || typeof(blocks[idx]['hide_lastupdate'])=='undefined' || blocks[idx]['hide_lastupdate']===false)) ||        (!settings['last_update'] && (typeof(blocks[idx])!=='undefined' && typeof(blocks[idx]['show_lastupdate'])!=='undefined' && blocks[idx]['show_lastupdate']==true))  )
   {
   html+='<br /><span class="lastupdate">'+moment(device['LastUpdate']).format(settings['timeformat'])+'</span>';
   }
   
   html+='</div>';
   return html;
}
Creator of Dashticz
Do you appreciate my work and want to buy me a beer?
Send:
- XVG to D8fwNbyV6YxJk1aSiXftWTtdaPipsKn2Fa
- ANY ERC20-TOKEN to 0x9b8ee84329d77765a28bca188218c6c793875a8a

or donate via PayPal: https://www.paypal.me/robgeerts

User avatar
htilburgs
Posts: 509
Joined: Tuesday 03 November 2015 12:01
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Dashticz - Custom JS

Post by htilburgs » Tuesday 06 February 2018 23:11

robgeerts wrote:
Tuesday 06 February 2018 22:13
_SHOW_LASTUPDATE is an old variable, this is the working code:
YES! It works again. Thnx!
Hardware:
RPi3 - Aeon Labs Z-Stick GEN5 - Fibaro Dimmer 2 - Fibaro Roller Shutter 2 - Fibaro Smoke Sensor - Yeelight RGBW Led bulb - Yeelight Smart LED Light Strip - Neo Coolcam PIR Motion Sensor - Neo Coolcam PowerPlug - Nest Thermostat v3

User avatar
EdwinK
Posts: 1317
Joined: Sunday 22 January 2017 22:46
Target OS: Raspberry Pi
Domoticz version: Stable
Location: Rhoon
Contact:

Re: Dashticz - Custom JS

Post by EdwinK » Monday 17 September 2018 23:22

And now I see a toggle-icon instead of the male figure I once had. did FontAwesome change things? Or did I screw up (as usually)
Screen Shot 2018-09-17 at 23.27.28.png
Screen Shot 2018-09-17 at 23.27.28.png (31.46 KiB) Viewed 204 times
Running latest BETASTABLE on a Pi-3 | Toon Thermostat (rooted) | RFxcom | Dashticz V2 |
Back to stable for now, as beta ***** over my installation

SwordFish
Posts: 273
Joined: Sunday 14 December 2014 13:28
Target OS: Raspberry Pi
Domoticz version: V4.9934
Location: Helmond, netherlands
Contact:

Re: Dashticz - Custom JS

Post by SwordFish » Saturday 06 October 2018 14:14

screen.PNG
screen.PNG (5.53 KiB) Viewed 122 times
Its a long time since i post something here but now i have a question.
How can i reverse the icons for de blinds, when its closed i want the open icon and when its open i want the closed icon.
Also how can i reverse the text, i want the lux value under and the "lux buiten" on top?
Last one how do get the show last update false for some switches? When i set show last update to 1 i get all last updates and the show last update = false seems not working?

ArthurNL
Posts: 13
Joined: Friday 05 October 2018 14:36
Target OS: Windows
Domoticz version: 4.9700
Location: The Netherlands
Contact:

Re: Dashticz - Custom JS

Post by ArthurNL » Saturday 06 October 2018 15:51

SwordFish wrote:
Saturday 06 October 2018 14:14
screen.PNGIts a long time since i post something here but now i have a question.
How can i reverse the icons for de blinds, when its closed i want the open icon and when its open i want the closed icon.
Also how can i reverse the text, i want the lux value under and the "lux buiten" on top?
Last one how do get the show last update false for some switches? When i set show last update to 1 i get all last updates and the show last update = false seems not working?
Can't answer all the questions;
- reversing, use this code in the config.js:
blocks['1_1']['switch'] = true;
- last update;
On the top of config.js, below var config = {} I have the next item: config['last_update'] = false; // true this will disable all 'updates' everywhere. Now you can enable it for a particular item with blocks['1_1']['last_update'] = true;

My Config.js
Spoiler: show
var config = {}

config['language'] = 'en_US';
config['domoticz_ip'] = 'http://ipthingy:8080';
config['app_title'] = 'Dashticz';
config['domoticz_refresh'] = '60';
config['dashticz_refresh'] = '60';
config['standard_graph'] = 'hours'; // or 'hours' or 'day'
config['last_update'] = false; // true

/*
OpenWeathermap config
*/
config['owm_api'] = 'apikey';
config['owm_city'] = 'city';
config['owm_name'] = '';
config['owm_country'] = 'nl';
config['static_weathericons'] = 1;


var blocks = {}
blocks[1] = {} //
blocks[1]['width'] = 6;

blocks['1_1'] = {} // Electra verbruik
blocks['1_1']['title'] = 'Verbruik';
blocks['1_1']['switch'] = true;
blocks['1_1']['icon'] = 'fas fa-bolt';
blocks['1_1']['last_update'] = true;

blocks['1_3'] = {} // Electra gebruik
blocks['1_3']['title'] = 'Gebruik';
blocks['1_3']['switch'] = true;
blocks['1_3']['icon'] = 'fas fa-bolt';

blocks[4] = {} //
blocks[4]['width'] = 6;

blocks['4_1'] = {} // Gas verbruik
blocks['4_1']['title'] = 'Verbruik';
blocks['4_1']['switch'] = true;

blocks['4_3'] = {} // Gas gebruik
blocks['4_3']['title'] = 'Gebruik';
blocks['4_3']['switch'] = true;

blocks[5] = {} //
blocks[5]['width'] = 6;

blocks['5_1'] = {} // Sonoff
blocks['5_1']['title'] = 'Temperatuur';
blocks['5_1']['switch'] = true;

blocks['5_2'] = {} // Sonoff
blocks['5_2']['title'] = 'Vochtigheid';
blocks['5_2']['switch'] = true;

blocks[7] = {} //
blocks[7]['width'] = 6;

blocks['7_1'] = {} // Esp #1 Woonkamer
blocks['7_1']['title'] = 'Temperatuur';
blocks['7_1']['switch'] = true;

blocks['7_2'] = {} // Esp #1 Woonkamer
blocks['7_2']['title'] = 'Vochtigheid';
blocks['7_2']['switch'] = true;

blocks[8] = {} //
blocks[8]['width'] = 6;

blocks['8_1'] = {} // Esp #2 Werkkamer
blocks['8_1']['title'] = 'Temperatuur';
blocks['8_1']['switch'] = true;

blocks['8_2'] = {} // Esp #2 Werkkamer
blocks['8_2']['title'] = 'Vochtigheid';
blocks['8_2']['switch'] = true;


/*
blocks['blocktitle10'] = {}
blocks['blocktitle10']['type'] = 'blocktitle';
blocks['blocktitle10']['title'] = 'Sonff';
blocks['blocktitle20'] = {}
blocks['blocktitle20']['type'] = 'blocktitle';
blocks['blocktitle20']['title'] = 'Esp #1';
blocks['blocktitle30'] = {}
blocks['blocktitle30']['type'] = 'blocktitle';
blocks['blocktitle30']['title'] = 'Esp #2';
*/


var buttons = {}
buttons.webcam1 = {width:6, isimage:true, refresh:10000, image: 'http://cdn.knmi.nl/knmi/map/page/weer/a ... ratuur.png', url: 'http://www.knmi.nl'}
buttons.webcam2 = {width:6, isimage:true, refresh:10000, image: 'https://cdn.knmi.nl/knmi/map/page/weer/ ... kracht.png', url: 'http://www.knmi.nl'}


var columns = {}
columns['bar'] = {};
columns['bar']['blocks'] = ['sunrise','miniclock','settings'];

columns[10] = {} // Kolom 1
columns[10]['blocks'] = ['graph_8','8_1','8_2','graph_7','7_1','7_2','graph_5','5_1','5_2'];
columns[10]['width'] = 4;

columns[20] = {} // Kolom 2
columns[20]['blocks'] = ['graph_1','1_1','1_3','graph_4','4_1','4_3'];
columns[20]['width'] = 4;

columns[30] = {} // Kolom 3
columns[30]['blocks'] = ['currentweather_big_owm','weather_owm',buttons.webcam1,buttons.webcam2];
columns[30]['width'] = 4;


var screens = {}
screens[10] = {}
screens[10]['columns'] = [10,20,30];
Dashticz V2.4.0 Beta

User avatar
EdwinK
Posts: 1317
Joined: Sunday 22 January 2017 22:46
Target OS: Raspberry Pi
Domoticz version: Stable
Location: Rhoon
Contact:

Re: Dashticz - Custom JS

Post by EdwinK » Saturday 06 October 2018 22:04

if you want your text above the value of the date do blocks[IDX]['switch'] = true;

Put the IDX of your LUX on the correct place
Running latest BETASTABLE on a Pi-3 | Toon Thermostat (rooted) | RFxcom | Dashticz V2 |
Back to stable for now, as beta ***** over my installation

SwordFish
Posts: 273
Joined: Sunday 14 December 2014 13:28
Target OS: Raspberry Pi
Domoticz version: V4.9934
Location: Helmond, netherlands
Contact:

Re: Dashticz - Custom JS

Post by SwordFish » Sunday 07 October 2018 11:33

Thanks, that did the trick.

SwordFish
Posts: 273
Joined: Sunday 14 December 2014 13:28
Target OS: Raspberry Pi
Domoticz version: V4.9934
Location: Helmond, netherlands
Contact:

Re: Dashticz - Custom JS

Post by SwordFish » Saturday 13 October 2018 12:12

I have 2 pictures one for on.png and one for off.png in the image folder. How can I use these with Custom js for a lightswitch?

Update; solved, i had to read the wiki :oops:

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests