Page 5 of 184

Re: RE: Re: RE: Re: New Dashboard Design

Posted: Saturday 18 March 2017 19:24
by stlaha2007
clubeddie wrote: I know want to change 'Woonkamer' on the frontpage to show the actual energy produced. But i cannot seems to find where i can change this field.
hope someone can help.
You have to look for a Temperature sensor as (Hardware)Type in main.js

It's located just above the Smartmeter parts...
Don't have the listing aside now. But i changed it to reflect my Hardware RFXcom thry LAN and DeviceType to Thermostat to show the Thermostats sensed temperature.

Re: New Dashboard Design

Posted: Saturday 18 March 2017 19:27
by clubeddie
This is how it looks in that area of code

Code: Select all

function getDevices(){
	
	if(!sliding){
		if(typeof(req)!=='undefined') req.abort();
		req = $.ajax({
			url: _HOST_DOMOTICZ+'/json.htm?type=devices&filter=all&used=true&order=Name&jsoncallback=?',
			type: 'GET',async: true,contentType: "application/json",dataType: 'jsonp',
			success: function(data) {
				if(!sliding){
					$('#switches').html('');
					$('#groups').html('');
					$('#sliders').html('');
					for(r in data.result){
						
						if(data.result[r]['HardwareType']=='P1 Smart Meter USB'){
						if(data.result[r]['Type']=='P1 Smart Meter' && data.result[r]['SubType']=='Energy'){
							$('.energy').html(data.result[r]['Usage']);
							$('.energytoday').html(data.result[r]['CounterToday']);
							$('.energytoday').parents('.hideinit').show();
							$('.energy').parents('.hideinit').show();
							}
						if(data.result[r]['Type']=='P1 Smart Meter' && data.result[r]['SubType']=='Gas'){
							$('.gas').html(number_format(data.result[r]['CounterToday'],2,',','.')+' m3');
							$('.gas').parents('.hideinit').show();
							}
I searched for temp, but there is no such entry.

Re: New Dashboard Design

Posted: Saturday 18 March 2017 20:22
by stlaha2007
The code for Woonkamer is located below (sorry, my bad). The part including the changes i have made are these:

Code: Select all

//               if(data.result[r]['Type']=='Temp'){
                 if(data.result[r]['Type']=='Temp' && data.result[r]['HardwareName']=='RFX_Pi_Living'){
//               if(data.result[r]['Type']=='Temp' && data.result[r]['HardwareType']=='RFXCOM - RFXtrx shared over LAN interface'){
                          $('.tempinside').html(data.result[r]['Temp']+'°C');
                          $('.tempinside').parents('.hideinit').show();
                }
//              }
So, dive deeper ;-)

It's there for sure.

And to create extra devices... You need to copy blocks like Energy and Energytoday from smartmeter and rename them eg. ReturnEnergy and ReturnToday.... And Also copy the according lines within index.html

I recommand to backup the files first.... Or use remarks like // within java or <!-- and --> within html-code

Sent from my K00C using Tapatalk

Re: New Dashboard Design

Posted: Saturday 18 March 2017 20:23
by stlaha2007
Perhaps the original file had another Type.... Its just below Energy and Gas !!

A screenshot of it expanded with more energy and Woonkamer:
Image

Re: New Dashboard Design

Posted: Sunday 19 March 2017 15:25
by robgeerts
EdKo66 wrote:Hope I can post this here.

Would like to see this added:

Code: Select all

     "AddjMulti" : 1.0,
         "AddjMulti2" : 1.0,
         "AddjValue" : 0.0,
         "AddjValue2" : 0.0,
         "BatteryLevel" : 255,
         "CustomImage" : 0,
         "Data" : "8.7 C",
         "Description" : "",
         "Favorite" : 1,
         "HardwareID" : 21,
         "HardwareName" : "Buienradar",
         "HardwareType" : "Buienradar.nl (Weather lookup)",
         "HardwareTypeVal" : 94,
         "HaveTimeout" : false,
         "ID" : "00150001",
         "LastUpdate" : "2017-03-17 10:17:59",
         "Name" : "Buienradar - Temperature",
         "Notifications" : "false",
         "PlanID" : "0",
         "PlanIDs" : [ 0 ],
         "Protected" : false,
         "ShowNotifications" : true,
         "SignalLevel" : "-",
         "SubType" : "LaCrosse TX3",
         "Temp" : 8.6999999999999993,
         "Timers" : "false",
         "Type" : "Temp",
         "TypeImg" : "temperature",
         "Unit" : 1,
         "Used" : 1,
         "XOffset" : "0",
         "YOffset" : "0",
         "idx" : "95"
      },
      {
         "AddjMulti" : 1.0,
         "AddjMulti2" : 1.0,
         "AddjValue" : 0.0,
         "AddjValue2" : 0.0,
         "BatteryLevel" : 255,
         "CustomImage" : 0,
         "Data" : "Humidity 70 %",
         "Description" : "",
         "Favorite" : 1,
         "HardwareID" : 21,
         "HardwareName" : "Buienradar",
         "HardwareType" : "Buienradar.nl (Weather lookup)",
         "HardwareTypeVal" : 94,
         "HaveTimeout" : false,
         "Humidity" : 70,
         "HumidityStatus" : "Wet",
         "ID" : "00150002",
         "LastUpdate" : "2017-03-17 10:17:59",
         "Name" : "Buienradar - Humidity",
         "Notifications" : "false",
         "PlanID" : "0",
         "PlanIDs" : [ 0 ],
         "Protected" : false,
         "ShowNotifications" : true,
         "SignalLevel" : "-",
         "SubType" : "LaCrosse TX3",
         "Timers" : "false",
         "Type" : "Humidity",
         "TypeImg" : "temperature",
         "Unit" : 2,
         "Used" : 1,
         "XOffset" : "0",
         "YOffset" : "0",
         "idx" : "96"
      },
      {
         "AddjMulti" : 1.0,
         "AddjMulti2" : 1.0,
         "AddjValue" : 0.0,
         "AddjValue2" : 0.0,
         "Barometer" : 1017.5,
         "BatteryLevel" : 255,
         "CustomImage" : 0,
         "Data" : "1017.5 hPa",
         "Description" : "",
         "Favorite" : 1,
         "Forecast" : 0,
         "ForecastStr" : "Stable",
         "HardwareID" : 21,
         "HardwareName" : "Buienradar",
         "HardwareType" : "Buienradar.nl (Weather lookup)",
         "HardwareTypeVal" : 94,
         "HaveTimeout" : false,
         "ID" : "00150004",
         "LastUpdate" : "2017-03-17 10:17:59",
         "Name" : "Buienradar - Barometer",
         "Notifications" : "false",
         "PlanID" : "0",
         "PlanIDs" : [ 0 ],
         "Protected" : false,
         "ShowNotifications" : true,
         "SignalLevel" : "-",
         "SubType" : "Barometer",
         "Timers" : "false",
         "Type" : "General",
         "TypeImg" : "gauge",
         "Unit" : 4,
         "Used" : 1,
         "XOffset" : "0",
         "YOffset" : "0",
         "idx" : "97"
      },
      {
         "AddjMulti" : 1.0,
         "AddjMulti2" : 1.0,
         "AddjValue" : 0.0,
         "AddjValue2" : 0.0,
         "BatteryLevel" : 255,
         "Chill" : 5.5,
         "CustomImage" : 0,
         "Data" : "288.0;WNW;63;98;8.7;5.5",
         "Description" : "",
         "Direction" : 288.0,
         "DirectionStr" : "WNW",
         "Favorite" : 1,
         "Gust" : "5",
         "HardwareID" : 21,
         "HardwareName" : "Buienradar",
         "HardwareType" : "Buienradar.nl (Weather lookup)",
         "HardwareTypeVal" : 94,
         "HaveTimeout" : false,
         "ID" : "00150006",
         "LastUpdate" : "2017-03-17 10:17:59",
         "Name" : "Buienradar - Wind",
         "Notifications" : "false",
         "PlanID" : "0",
         "PlanIDs" : [ 0 ],
         "Protected" : false,
         "ShowNotifications" : true,
         "SignalLevel" : "-",
         "Speed" : "4",
         "SubType" : "TFA",
         "Temp" : 8.6999999999999993,
         "Timers" : "false",
         "Type" : "Wind",
         "TypeImg" : "wind",
         "Unit" : 6,
         "Used" : 1,
         "XOffset" : "0",
         "YOffset" : "0",
         "idx" : "98"
      }
I've just updated main.js (https://gitlab.com/robgeerts/dashboard/tree/master) to handle these types!

Re: New Dashboard Design

Posted: Sunday 19 March 2017 19:08
by EdwinK
Thanks. Great how this works. :)

And this is how the new blocks look like

Imageimage upload no limit

Re: New Dashboard Design

Posted: Monday 20 March 2017 10:00
by stlaha2007
@robgeerts... It really looks nice.
Clear and readable code.

I've adjusted it to my needs. Made it 2 colums, removed the weatherforecast etcetera...

While working on it i have 2 questions...
1) in index.html config.js and main.js are called with ?v=1, why? As i can't find it referenced there.
2) would it be handy to call CONFIG.js within index.html, and call the other files from there? So you can easily enable/disable/implement other scripts when used/not used?

Just curiousity, i'm not a native coder. But can write code in other languages.

Grtz.

Re: New Dashboard Design

Posted: Monday 20 March 2017 10:20
by jaha
Looks very nice, will domoticz alarm panel work with this?

Re: RE: Re: New Dashboard Design

Posted: Monday 20 March 2017 11:51
by stlaha2007
jaha wrote:Looks very nice, will domoticz alarm panel work with this?
Depends... As robgeerts has build it to replace a Toon device, i haven't seen code for the AlarmPanel yet.

But when your handy enough with coding javascript you can implement it yourself or embed it in the index.html if you want it....

I'm rewriting most of it (including the index.html), because of missing devices (and yes, i know, rob's working on it) and roomplan functionality.

Re: New Dashboard Design

Posted: Monday 20 March 2017 12:02
by Xroads
HI
Really love this design, but I'm strugling to get my own location for the weather (Denmark, Aarhus), where do I change it.

Thanks.

Re: New Dashboard Design

Posted: Monday 20 March 2017 12:31
by robgeerts
stlaha2007 wrote:
jaha wrote:Looks very nice, will domoticz alarm panel work with this?
I'm rewriting most of it (including the index.html), because of missing devices (and yes, i know, rob's working on it) and roomplan functionality.
Maybe you can share the code when it is finished?

Xroads wrote:HI
Really love this design, but I'm strugling to get my own location for the weather (Denmark, Aarhus), where do I change it.

Thanks.
It always searched for the entered city (in config.js) in the Netherlands, I've just added a country-variable.
Download the latest version from gitlab!

Make sure you have the country-variable in config.js after you've updated!

Example:

Code: Select all

var _WEATHER_CITY 			= 'Aarhus';
var _WEATHER_COUNTRY 		= 'DK';

Re: New Dashboard Design

Posted: Monday 20 March 2017 13:18
by stlaha2007
Ofcourse i will ;)
By the way, do you happen to have answers to my questions?

Because it does help rewriting it. I already started seperating devices from main into utility(gas/water/energy), temp-weather(temp/baro/humidity/UV), heating (OTGW/EvoHome) and other_devices

Re: New Dashboard Design

Posted: Monday 20 March 2017 13:24
by robgeerts
Wich questions?
As I can see, you only answer other people's questions in this topic?

Re: RE: Re: New Dashboard Design

Posted: Monday 20 March 2017 14:18
by stlaha2007
robgeerts wrote:Wich questions?
As I can see, you only answer other people's questions in this topic?
See: https://www.domoticz.com/forum/viewtopi ... 51#p124651

About ?v=1 and sourcing/calling multiple .js within index.html and move to config.js...

Re: New Dashboard Design

Posted: Monday 20 March 2017 14:29
by robgeerts
stlaha2007 wrote:@robgeerts... It really looks nice.
1) in index.html config.js and main.js are called with ?v=1, why? As i can't find it referenced there.
I had some caching issues, so the idea was to change ?v=1 with every new version (v=2,v=3 etc). So, when loaded, it doesnt get a cached (and older) version of the file.
stlaha2007 wrote:@robgeerts... It really looks nice.
2) would it be handy to call CONFIG.js within index.html, and call the other files from there? So you can easily enable/disable/implement other scripts when used/not used?
That's fine by me :)
In that case, people only have to update js-files :)

Re: New Dashboard Design

Posted: Monday 20 March 2017 17:47
by Xroads

It always searched for the entered city (in config.js) in the Netherlands, I've just added a country-variable.
Download the latest version from gitlab!

Make sure you have the country-variable in config.js after you've updated!

Example:

Code: Select all

var _WEATHER_CITY 			= 'Aarhus';
var _WEATHER_COUNTRY 		= 'DK';
Thank you very much

Re: New Dashboard Design

Posted: Wednesday 22 March 2017 7:23
by gjaa
The following code in main.js (search for it as I have a newer version than you right now) fills the Woonkamer-block:

Code: Select all
if(data.result[r]['Type']=='Temp'){


If you know the IDX of the temperature-device, you could change this line to:

Code: Select all
if(data.result[r]['idx']==102){


(where 102 is the IDX-number)
I've changed the room temp with the idx number of te room temparature but woonkamer stays empty. It's one of my favorites so I can see its filled
screen.png
screen.png (295.51 KiB) Viewed 4728 times
What's going wrong??

Gerard

Re: New Dashboard Design

Posted: Wednesday 22 March 2017 7:42
by stlaha2007
Your missing the singlequotes.
As the data is textvalues and 102 is represented as text.

Re: New Dashboard Design

Posted: Wednesday 22 March 2017 16:33
by MarceldeJongNL
gjaa wrote:
The following code in main.js (search for it as I have a newer version than you right now) fills the Woonkamer-block:

Code: Select all
if(data.result[r]['Type']=='Temp'){


If you know the IDX of the temperature-device, you could change this line to:

Code: Select all
if(data.result[r]['idx']==102){


(where 102 is the IDX-number)
I've changed the room temp with the idx number of te room temparature but woonkamer stays empty. It's one of my favorites so I can see its filled
screen.png

What's going wrong??

Gerard



If you look at the code, it only applies to Toon Thermostat values.

I have commented that line out and it shows my temperature now:

Code: Select all

      
			//			if(data.result[r]['HardwareType']=='Toon Thermostat'){
							if(data.result[r]['Type']=='P1 Smart Meter' && data.result[r]['SubType']=='Energy'){
								$('.energy').html(data.result[r]['Usage']);
								$('.energytoday').html(data.result[r]['CounterToday']);
								$('.energytoday').parents('.hideinit').show();
								$('.energy').parents('.hideinit').show();
							}
							if(data.result[r]['Type']=='P1 Smart Meter' && data.result[r]['SubType']=='Gas'){
								$('.gas').html(number_format(data.result[r]['CounterToday'],2,',','.')+' m3');
								$('.gas').parents('.hideinit').show();
							}
							if(data.result[r]['Type']=='Temp' && data.result[r]['idx']=='19'){
								$('.tempinside').html(data.result[r]['Temp']+'°C');
								$('.tempinside').parents('.hideinit').show();
							}
						
// }


Re: New Dashboard Design

Posted: Wednesday 22 March 2017 17:14
by stlaha2007
Thats also a piece to look for...
However its already mentioned earlier.

I'm rewriting main.js into a few seperate .js files, which will filter on devicetype instead of hardware.

I'm almost finished, and can be maintained easier if theres a new devicetype...

@robgeerts, how do i get the code to you? As most of the code is based on version of March 12. PM the code, so you can post it on your github (still need to setup mine :-) )