Page 17 of 66

Re: NEW frontpage.html - request comments

Posted: Thursday 05 February 2015 14:33
by thorbj
jan_nl wrote:oops, I think I pointed you in the wrong direction.
You need to compare the Status value in PageArray.
In the array the word Humidity or Temp can be found, in this way you can determine what is in which cell.

Sorry for the confusion.
Jan
Ah, thank you, now I've got it :)

The following works like a charm:

Code: Select all

if(item.idx == '35' && vdata > -100 && vtype == 'Temp'){			// Adds the Celsius sign after the temperature
vdata=new String(vdata).replace( vdata,vdata + "℃");
}
if(item.idx == '35' && vdata > -100 && vtype == 'Humidity'){			// Adds the Percentage sign after the humidity
vdata=new String(vdata).replace( vdata,vdata + "%");
}

Re: NEW frontpage.html - request comments

Posted: Thursday 05 February 2015 15:32
by mvveelen
I've made some small changes:

- Button up, the icon that is, wasn't OK (thanks for pointing that one out for me, ThinkPad)
- The % is now shown on a similar button

Downloadlink: LINK


Edit:


jan_nl, can you help me out :

I would like to use 2 separate images for every forecast. For example: when it's partly cloudy, I now have a sun with clouds in front of it. But when it's after sunset I'd like to have the moon with the clouds in front of it. I already made the images (and as you can see, they are in the uploaded package), but what code should I use?
Could you give me a nudge in the right direction?

The code I now have is this:

Code: Select all

	if (vdata == 'Partly Cloudy' ) {
	vdata=new String(vdata).replace( "Partly Cloudy","<img src=icons/04day-partlycloudy.png width=204 height=204>");
	}

Re: NEW frontpage.html - request comments

Posted: Thursday 05 February 2015 18:45
by thorbj
@mvveelen, maybe you could put the icons in day/night folders and somehow alter the path depending on the IsDonker switch, or sunset/sunrise? Just a thought.

Re: NEW frontpage.html - request comments

Posted: Thursday 05 February 2015 19:13
by mvveelen
thorbj wrote:@mvveelen, maybe you could put the icons in day/night folders and somehow alter the path depending on the IsDonker switch, or sunset/sunrise? Just a thought.
Thanks, but that gives me the same problem: I somehow have to figure out how I could fix this. Tried some things, but haven't succeeded yet.

Oh, and if there are people who want this button.....?

Image

Re: NEW frontpage.html - request comments

Posted: Thursday 05 February 2015 19:36
by BobbyNL
When i set ['11','Direction', 'cell6', 'Windrichting','0','0'],
the output is Wind bearing, but i wan't the Direction. What goes wrong?

Already fixed it by using 'DirectionStr'

Re: NEW frontpage.html - request comments

Posted: Thursday 05 February 2015 23:54
by ThinkPad
thorbj wrote:
jan_nl wrote:oops, I think I pointed you in the wrong direction.
You need to compare the Status value in PageArray.
In the array the word Humidity or Temp can be found, in this way you can determine what is in which cell.

Sorry for the confusion.
Jan
Ah, thank you, now I've got it :)

The following works like a charm:

Code: Select all

if(item.idx == '35' && vdata > -100 && vtype == 'Temp'){			// Adds the Celsius sign after the temperature
vdata=new String(vdata).replace( vdata,vdata + "&#8451;");
}
if(item.idx == '35' && vdata > -100 && vtype == 'Humidity'){			// Adds the Percentage sign after the humidity
vdata=new String(vdata).replace( vdata,vdata + "&#37;");
}
I think you don't even need the

Code: Select all

&& vdata > -100
part. If it is a temperature, you want to add the Celsius sign :)
Same with Humidity

Or is the -100 some kind of error message (no value received from sensor) ?

Re: NEW frontpage.html - request comments

Posted: Friday 06 February 2015 5:57
by mvveelen
ThinkPad wrote:
thorbj wrote:
jan_nl wrote:oops, I think I pointed you in the wrong direction.
You need to compare the Status value in PageArray.
In the array the word Humidity or Temp can be found, in this way you can determine what is in which cell.

Sorry for the confusion.
Jan
Ah, thank you, now I've got it :)

The following works like a charm:

Code: Select all

if(item.idx == '35' && vdata > -100 && vtype == 'Temp'){			// Adds the Celsius sign after the temperature
vdata=new String(vdata).replace( vdata,vdata + "&#8451;");
}
if(item.idx == '35' && vdata > -100 && vtype == 'Humidity'){			// Adds the Percentage sign after the humidity
vdata=new String(vdata).replace( vdata,vdata + "&#37;");
}
I think you don't even need the

Code: Select all

&& vdata > -100
part. If it is a temperature, you want to add the Celsius sign :)
Same with Humidity

Or is the -100 some kind of error message (no value received from sensor) ?
I've put that part in to prevent the Celsius sign from appearing after the WeatherForecast-images.....I don't know another way to prevent that.

Re: NEW frontpage.html - request comments

Posted: Friday 06 February 2015 9:49
by maluko
excelent work guys

i wonder kwow if its possible to add a cell with volume botton, like dimmer, i have two virtual switch one to plus and other to minus, and good will be integrade this two switch on one cell with json http.
am wrong?

thanks

Re: NEW frontpage.html - request comments

Posted: Friday 06 February 2015 11:13
by jannl
For the day/night weather icons I implemented an additional variable (Isnight) which is set to 1 or 0 depending on day or night. Isnight is set at the same location the background is altered for day and night.

In the location where the weather icons are set, I added an additional if statement the set the day or night icon.

I did not post it here because I am not completely satisfied with the I implemented this, allthough it seems to work correctly.

I will post it here later anyway, because it works.

Re: NEW frontpage.html - request comments

Posted: Friday 06 February 2015 12:33
by mvveelen
Can't you use the virtual switch 'IsDark' for that? And what is the second 'if' statement? I'm very curious and this might be one of the last additions I want to have in my frontpage.html (although the Skycons are still on my list :oops: ).

Re: NEW frontpage.html - request comments

Posted: Friday 06 February 2015 12:46
by jannl
Something like (very, very simplified):

if (cloudy)
if (Isnight)
Show night-cloud icon
else
Show day-cloud icon
end
end

Isdark can not be used, because it not set globally.
But now I think of it, that could also be set globally and be used in stead of an extra Isnight,

Thanks for the tip

Re: NEW frontpage.html - request comments

Posted: Friday 06 February 2015 12:48
by mvveelen
'Samen komen we er wel' :)

If you have some pieces of code I could use, I'd be glad to test / use / try it :D

Re: NEW frontpage.html - request comments

Posted: Friday 06 February 2015 13:20
by jannl
I will try to post the code tonight.

Got another weekend with a lot of carnaval ahead.... :D

Re: NEW frontpage.html - request comments

Posted: Friday 06 February 2015 15:42
by mvveelen
I managed to get it to work with the 'IsNight'.

I've put the

var Isnight = 'yes'; in the frontpage_settings.js

And in the frontpage.js I added something like:

Code: Select all

   if (vdata == 'Partly Cloudy' & IsNight == 'No') {
   vdata=new String(vdata).replace( "Partly Cloudy","<img src=icons/04day-partlycloudy.png width=204 height=204>");
   }

etc.
The IsNight is set in the part where I let the .css be chosen, based on the IsDonker var :)

Code: Select all

	if(item.idx == idx_IsDonker && vdata == 'Off'){
	document.getElementById('dark-styles').disabled  = true;				// day
	IsNight = 'No';
	}

	if(item.idx == idx_IsDonker && vdata == 'On'){
	document.getElementById('dark-styles').disabled  = false;				// night
	IsNight = 'Yes';
	}

So far so good. Now, lets see what the forecast image does when the sun sets :)

Edit: OK, maybe it's not the way it should / could be coded, but hey.....it works. If someone could rewrite this, be my guest :)

Re: NEW frontpage.html - request comments

Posted: Friday 06 February 2015 16:43
by bbqkees
floris74 wrote:It's SetPoint, yes.
I see that you have a solution for the thermostat, but i don't know how to implement it in Jan_nl his version.
Floris
So normal CamelCase then.

Because Jan followed a different approach in respect to the dimming function, my solution is pretty incompatible at this moment.
Maybe Jan can modify his function to incorporate your SetPoint change, or you need to exchange the function alltogether.

Re: NEW frontpage.html - request comments

Posted: Friday 06 February 2015 19:31
by jannl
mvveelen wrote:
Edit: OK, maybe it's not the way it should / could be coded, but hey.....it works. If someone could rewrite this, be my guest :)
Should work like this.
Basically the same I did. IsDark can not be used, I my case IsDark contains an idx value.

Re: NEW frontpage.html - request comments

Posted: Friday 06 February 2015 20:15
by mvveelen
It does work like this, but I meant that the code could be rewritten somehow.

It's after sunset, and this is the way the forecast is now:

Re: NEW frontpage.html - request comments

Posted: Friday 06 February 2015 21:25
by floris74
bbqkees wrote:
floris74 wrote:It's SetPoint, yes.
I see that you have a solution for the thermostat, but i don't know how to implement it in Jan_nl his version.
Floris
So normal CamelCase then.

Because Jan followed a different approach in respect to the dimming function, my solution is pretty incompatible at this moment.
Maybe Jan can modify his function to incorporate your SetPoint change, or you need to exchange the function alltogether.
Thanks for the info, bbqkees. How is your working in process withe front page.html?

@jan_nl, can you implement the SetPoint? Maybe between the carnaval days? :)

floris

Re: NEW frontpage.html - request comments

Posted: Saturday 07 February 2015 17:08
by Slayer007
Does anyone know how to convert the json timestamp for example (2015-01-24 13:14:38) to a normal date in html?

Re: NEW frontpage.html - request comments

Posted: Saturday 07 February 2015 21:00
by mvveelen
Just made some layout-tweaks:

- The sun / moon are now displayed on a similar button as all the others
- The % (text) for the dimmer isn't displayed anymore. instead there is a blue circle that becomes smaller or bigger when you dim the light.

I only have one problem with this last one: I can't use the button to switch the dimmed lights off. I made the numbers (%) 0% so it isn't displayed, that's why I can't use it to click on. When I use opacity to let the text to be transparent (and let it be big enough to make it clickable), both up and down buttons will be transparent too and that's not what we want do we :) ?

If anyone has a quick fix for this....??