Can I use a block to go to the slide upon pressing?

Dashticz, alternative dashboard based on HTML, CSS, jQuery

Moderators: leecollings, htilburgs, robgeerts

Post Reply
Marque1968
Posts: 60
Joined: Tuesday 03 April 2018 18:41
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Can I use a block to go to the slide upon pressing?

Post by Marque1968 »

On my main screen I want to display the room temperature. However, upon pressing the button, I would like to go to a second screen where the temperature is shown again aswell as other temperatures in the house and the option to set the required temperatures.

Code: Select all

blocks['26_1'] = {} //Temperatuur
blocks['26_1']['title'] = 'Temp';
blocks['26_1']['hide_data']= false;
blocks['26_1']['width']= 12;
blocks['26_1']['switch'] = true;
blocks['26_1']['gotoslide'] = 2;
This however does not work, as it needs a change to activate the slide, thus pressing it shows a pop-up with the log.

And as it did this, it made my question even harder. As now I would like the block['26_1'] on 1st screen to go to the second slide with all temperature info, but on that 2nd screen I want block['26_1'] to display the log (as I am already on screen 2).

Oh, and this is just the first page I am thinking off. I want to repeat this functionality for the power use, where on screen 1 I show the current electric and gas use of the house, and on screen 3, the power use of the most devices displayed.
Marque1968
Posts: 60
Joined: Tuesday 03 April 2018 18:41
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Can I use a block to go to the slide upon pressing?

Post by Marque1968 »

(p.s. If this is not possible, is it otherwise possible to make a button and set the name to the value of block 26_1? Thus I don't display the 26_1 block, but have the value on a button in stead)
Lokonli
Posts: 2292
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Can I use a block to go to the slide upon pressing?

Post by Lokonli »

Marque1968 wrote: Tuesday 05 March 2019 9:43 (p.s. If this is not possible, is it otherwise possible to make a button and set the name to the value of block 26_1? Thus I don't display the 26_1 block, but have the value on a button in stead)
Yes, I think so :)

Define a button with a slide parameter and with a key parameter so it can be identified

Code: Select all

buttons.page1 = { width:12, key:'first', title:'page 1', slide:1};	
Then in custom/custom.js replace the function afterGetDevices with the following code:

Code: Select all

function afterGetDevices(){
	$('.buttons-first .state').html(alldevices["26"].Data);
}
Replace 'first' in .buttons-first with the key you used in the button definition.
Marque1968
Posts: 60
Joined: Tuesday 03 April 2018 18:41
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Can I use a block to go to the slide upon pressing?

Post by Marque1968 »

I am sorry, I haven been trying for over an hour and a half now, but to no avail. I have tried to search online how afterGetDevices() works, but to my surprise, the above is the only example google is aware of. All other references are to people showing their custom.js with the default empty function.

BUT I must add, to test general working of custom_2/custom.js I added a precense indicater I found online:
Spoiler: show

Code: Select all

function getBlock_148(device,idx){ //change 233 to the idx of your device!
   $('.block_'+idx).attr('onclick','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>';
   if(_SHOW_LASTUPDATE) html+='<br /><span class="lastupdate">'+moment(device['LastUpdate']).format(_LASTUPDATE_FORMAT)+'</span>';
   html+='</div>';
   return html;
But this one is not working for me either. So I am a bit at a loss here...
Lokonli
Posts: 2292
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Can I use a block to go to the slide upon pressing?

Post by Lokonli »

Marque1968 wrote: Sunday 10 March 2019 9:53 I am sorry, I haven been trying for over an hour and a half now, but to no avail. I have tried to search online how afterGetDevices() works, but to my surprise, the above is the only example google is aware of. All other references are to people showing their custom.js with the default empty function.

BUT I must add, to test general working of custom_2/custom.js I added a precense indicater I found online:
Spoiler: show

Code: Select all

function getBlock_148(device,idx){ //change 233 to the idx of your device!
   $('.block_'+idx).attr('onclick','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>';
   if(_SHOW_LASTUPDATE) html+='<br /><span class="lastupdate">'+moment(device['LastUpdate']).format(_LASTUPDATE_FORMAT)+'</span>';
   html+='</div>';
   return html;
But this one is not working for me either. So I am a bit at a loss here...
This is pretty old code, and indeed doesn't work anymore. We are preparing to update the user documentation. That will be a good moment to provide working examples again.
Marque1968
Posts: 60
Joined: Tuesday 03 April 2018 18:41
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Can I use a block to go to the slide upon pressing?

Post by Marque1968 »

p.s. Any idea when the updated documentation will be released?
User avatar
HansieNL
Posts: 969
Joined: Monday 28 September 2015 15:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Can I use a block to go to the slide upon pressing?

Post by HansieNL »

@Marque1968 : you can find work in progress here https://dashticz-v2.readthedocs.io/en/latest/index.html
Blah blah blah
Lokonli
Posts: 2292
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Can I use a block to go to the slide upon pressing?

Post by Lokonli »

HansieNL wrote: Monday 18 March 2019 13:26 @Marque1968 : you can find work in progress here https://dashticz-v2.readthedocs.io/en/latest/index.html
You are a bit early. Work in progress...
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest