Page 2 of 5

Re: Import weather data other than Wunderground

Posted: Friday 05 October 2018 0:15
by Thuis
Ehm..... Beta? Not really, I did however tried somethings with files that were not older then a month and copied these over and did things where logic was very far to find, but okay. Thanks, probably be that i have no beta. I have however the latest version, because it keeps saying there is a new version, and that was not there wit hthe old version. Hmm, beta version any good, or lot of crashes ?

Logic coming back to this issue, I looked at the beta, and i see a weather_owm.js, maybe i can copy it to my js folder, i will just go try it out :lol:

Re: Import weather data other than Wunderground

Posted: Friday 05 October 2018 0:43
by Thuis
Ok, thank you, installed BETA, it works, yay!, back to the drawing table, all icons are white again, and as my other question: viewtopic.php?f=67&t=17242&start=420#p193371 still stands, it will be time consuming again. But fun, and very leerzaam.

Where would we be withoud notepad++ :P

Re: Import weather data other than Wunderground

Posted: Friday 05 October 2018 20:59
by EdwinK
Thuis wrote: Friday 05 October 2018 0:43
Where would we be without notepad++ :P
or Textwrangler (on mac) :)

Re: Import weather data other than Wunderground

Posted: Friday 05 October 2018 21:46
by heggink
Can I make a case for plain old vi?

Re: Import weather data other than Wunderground

Posted: Friday 05 October 2018 22:09
by EdwinK
Of course you can. On the Rasp, I use nano (via terminal)

Re: Import weather data other than Wunderground

Posted: Friday 05 October 2018 22:21
by heggink
btw, forecast.io seems to be really off in terms of data. Says it's 16C outside where it's probably 11C??? Like really off... :shock:

Re: Import weather data other than Wunderground

Posted: Tuesday 09 October 2018 15:03
by EdwinK
At the moment it's just 1C of for me. Displaying 18 on forecast.io and 17 on my Android. Can life with that

Re: Import weather data other than Wunderground

Posted: Thursday 11 October 2018 13:17
by dk78
When I use WeatherUnderground everythings works fine. When I switch to Open Weather Map, I do not see anything in Dashticz. I'm running the latest beta (2.4.0). Can't find what I'm doing wrong.

Weather Underground:

Code: Select all

config['wu_api'] = 'key';
config['wu_city'] = 'Veldhoven';
config['wu_name'] = '';
config['wu_country'] = 'NL';

columns[3] = {}
columns[3]['blocks'] = ['sunrise','currentweather_big','weather',buttons.buienradar]
columns[3]['width'] = 3;

Code: Select all

config['owm_api'] = 'key';
config['owm_city'] = 'Veldhoven';
config['owm_name'] = '';
config['owm_country'] = 'nl';
config['static_weathericons'] = 1;

columns[3] = {}
columns[3]['blocks'] = ['sunrise','currentweather_big_owm','weather_owm',buttons.buienradar]
columns[3]['width'] = 3;
Does anyone see something I miss?

Re: Import weather data other than Wunderground

Posted: Thursday 11 October 2018 15:09
by ArthurNL
dk78 wrote: Thursday 11 October 2018 13:17 Does anyone see something I miss?
Remove all the "wu_" config. The other stuff looks to be ok.

See also my post here: viewtopic.php?f=67&t=17242&start=440#p193496

Re: Import weather data other than Wunderground

Posted: Thursday 11 October 2018 16:34
by dk78
Strange. WU works, but OWM not. I tried everything, including deleting the 'wu'-config stuff, but it isn't displaying any information. OWM in Domoticz itself works, but I can't see it in Dashticz. Is there some logging available? I'm pretty new to Dashticz.

Re: Import weather data other than Wunderground

Posted: Thursday 11 October 2018 16:52
by ArthurNL
dk78 wrote: Thursday 11 October 2018 16:34 Strange. WU works, but OWM not. I tried everything, including deleting the 'wu'-config stuff, but it isn't displaying any information. OWM in Domoticz itself works, but I can't see it in Dashticz. Is there some logging available? I'm pretty new to Dashticz.
Post your complete config.js plz.

Re: Import weather data other than Wunderground

Posted: Thursday 11 October 2018 16:53
by heggink
Are you running the beta stream?

Re: Import weather data other than Wunderground

Posted: Thursday 11 October 2018 18:54
by dk78
Dashticz V2.4.0
Domoticz version 4.10059
DzVents version: 2.4.7
Python version: None
Spoiler: show
var config = {}
config['language'] = 'nl_NL';
config['domoticz_ip'] = 'https://<IP>';
config['app_title'] = 'Dashticz';
config['domoticz_refresh'] = '15';
config['dashticz_refresh'] = '60';
config['timeformat'] = 'DD-MM-YY HH:mm';
config['calendarformat'] = 'dd DD.MM HH:mm';
config['calendarlanguage'] = 'nl_NL';
/*
OpenWeathermap config
*/
config['owm_api'] = '<API>';
config['owm_city'] = 'Veldhoven';
config['owm_name'] = '';
config['owm_country'] = 'nl';
config['static_weathericons'] = 1;
/*
WeatherUnderground config

config['wu_api'] = '<API>';
config['wu_city'] = 'Veldhoven';
config['wu_name'] = '';
config['wu_country'] = 'NL';
*/
config['garbage_company'] = 'veldhoven';
config['garbage_icalurl'] = 0;
config['garbage_zipcode'] = '<PC>';
config['garbage_street'] = '<straat>';
config['garbage_housenumber'] = '<#>';
config['garbage_maxitems'] = '8';
config['garbage_width'] = '12';
config['garbage_hideicon'] = 0;
config['garbage_use_names'] = true;
config['garbage_use_colors'] = true;
config['garbage_icon_use_colors'] = true;
config['garbage_use_cors_prefix'] = true;
config['garbage_use_names'] = false;
config['garbage_use_colors'] = false;
config['garbage_icon_use_colors'] = true;
config['garbage'] = {
gft: {kliko: 'green', code: '#375b23', name: 'GFT', icon: 'img/garbage/kliko_green.png'},
pmd: {kliko: 'orange', code: '#db5518', name: 'PMD', icon: 'img/garbage/kliko_orange.png'},
rest: {kliko: 'grey', code: '#5e5d5c', name: 'Restafval', icon: 'img/garbage/kliko_grey.png'},
papier: {kliko: 'blue', code: '#153477', name: 'Papier', icon: 'img/garbage/kliko_blue.png'},
kca: {kliko: 'red', code: '#b21807', name: 'Chemisch afval', icon: 'img/garbage/kliko_red.png'},
brown: {kliko: 'brown', code: '#7c3607', name: 'Bruin', icon: 'img/garbage/kliko_brown.png'},
black: {kliko: 'black', code: '#000000', name: 'Zwart', icon: 'img/garbage/kliko_black.png'},
milieu: {kliko: 'yellow', code: '#f9e231', name: 'Geel', icon: 'img/garbage/kliko_yellow.png'},
kerstboom: {kliko: 'green', code: '#375b23', name: 'Kerstboom', icon: 'img/garbage/tree.png'},
};

var calendars = {}
calendars.verjaardagen = { maxitems: 5, icalurl: '<URL>' }
calendars.me = { maxitems: 5, icalurl: '<URL>' }

var buttons = {}
buttons.buienradar = {width:12, isimage:true, refreshimage:60000, image: 'http://api.buienradar.nl/image/1.0/Rada ... =285&h=256', url: 'http://www.weer.nl/verwachting/nederlan ... en/189162/'}

var blocks = {}
blocks['blocktitle_1'] = {}
blocks['blocktitle_1']['key'] = 'blocktitle_1';
blocks['blocktitle_1']['type'] = 'blocktitle';
blocks['blocktitle_1']['title'] = 'Kalenders';
blocks['blocktitle_2'] = {}
blocks['blocktitle_2']['key'] = 'blocktitle_2';
blocks['blocktitle_2']['type'] = 'blocktitle';
blocks['blocktitle_2']['title'] = 'Woonkamer';

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

columns[1] = {}
columns[1]['blocks'] = ['blocktitle_1','garbage',calendars.verjaardagen,calendars.me]
columns[1]['width'] = 3;

columns[2] = {}
columns[2]['blocks'] = ['blocktitle_2']
columns[2]['width'] = 6;

columns[3] = {}
columns[3]['blocks'] = ['sunrise','currentweather_big_owm','weather_owm',buttons.buienradar]
columns[3]['width'] = 3;

var columns_standby = {}
columns_standby[1] = {}
columns_standby[1]['blocks'] = ['clock','weather']
columns_standby[1]['width'] = 12;

var screens = {}
screens[1] = {}
screens[1]['background'] = 'bg2.jpg';
screens[1]['columns'] = [1,2,3]
The popup on buienradar (weer.nl) is also empty when I click on the picture. Also if I use any other url. I tried to see if my firewall is blocking something, but can't see anything there that's causing this. It's strange that buienradar and Weatherunderground works, but somethings don't

Re: Import weather data other than Wunderground

Posted: Thursday 11 October 2018 20:12
by HansieNL
Just tried OWM with default config and no problem. Maybe you can try a default config with only OWM?

Re: Import weather data other than Wunderground

Posted: Friday 12 October 2018 10:14
by ArthurNL
dk78 wrote: Thursday 11 October 2018 18:54 Dashticz V2.4.0
Domoticz version 4.10059
DzVents version: 2.4.7
Python version: None

The popup on buienradar (weer.nl) is also empty when I click on the picture. Also if I use any other url. I tried to see if my firewall is blocking something, but can't see anything there that's causing this. It's strange that buienradar and Weatherunderground works, but somethings don't
Your OWM config works fine here; I've copied your config.js and used that in my Domoticz setup. Is your api-key correct? Check that in your https://openweathermap.org profile.

Couldn't get your buienradar working though, so that seems to be a different problem.

Are you sure you are running the beta version of Dashticz (we are not talking about Domoticz itself here).

This branch: https://github.com/Dashticz/dashticz_v2/tree/beta

Re: Import weather data other than Wunderground

Posted: Monday 15 October 2018 22:04
by pablo79
heggink wrote: Wednesday 03 October 2018 20:15

Code: Select all

frames.weather = {...&text-color=#fff",...}
First time the font is white but on refresh, it turns grey.

Any idea why that is and how to resolve?

H
Hey i have the same problem - just change to -> &text-color=#ffffff

Best regards
pablo79

Re: Import weather data other than Wunderground

Posted: Monday 31 December 2018 0:20
by jake
In (last minute) preparation of the switch off of WU, I did another test with weather underground.

I have the 'weather' block in my dashboard, showing the weather forecast for the next couple days.
When I change to 'weather_owm', it shows me 4 elements for the next 12 hours instead.

I would appreciate my 4 day forecast back, while using OWM. Is that possible?

Possibly the Dashticz wiki is not made up to date with the OWN options. I come across the config variable owm_cnt. Google finds me 1 hit, giving me the idea that it stands for 'column count'. I wonder if there are more options to tune the visual representation of OWM in Dashticz

Re: Import weather data other than Wunderground

Posted: Sunday 13 January 2019 15:59
by toro
I made a modification to show forecast for the next days with OWM.

It works great, but there's a little downside, I modified weather_own.js for this.
So when you update to a new version, the file will probably be overwritten.
Maybe it is possible for the developer(s) to implement this in the beta??

To use this, overwrite the content of weather_own.js with the code below (make a backup of the file first)
Spoiler: show

Code: Select all

function loadWeather(location, country) {
    var html = '';
    if (typeof(settings['owm_api']) !== 'undefined' && settings['owm_api'] !== '' && settings['owm_api'] !== 0) {
		var site = 'http://api.openweathermap.org/data/2.5/weather?q=' + settings['owm_city'] + ',' + settings['owm_country'] + '&appid=' + settings['owm_api'];

        if (settings['use_fahrenheit'] === 1) {
            site += '&units=imperial';
        }
        else {
            site += '&units=metric';
        }

        $.getJSON(site, function (weather) {
            $('.containsweather').each(function () {
                var curfull = $(this);
                if (typeof(weather.main) === 'undefined') {
                    curfull.remove();
                    currentweather = false;
                    curfull.find('.weather').html('<p style="font-size:10px; width:100px;">Location ERROR</p>');
                } else {
                    currentweather = weather.weather[0];
                    var wiclass = getIcon(weather.weather[0].icon);
                    var temp = weather.main.temp;

                    weatherIcon = '<i class="wi ' + wiclass + '"></i>';
                    if (settings['static_weathericons'] === 0) {
                        weatherIcon = getSkycon(weather.weather[0].icon, 'skycon');
                    }
                    html += '<h2><span>' + Math.round(temp) + _TEMP_SYMBOL + '</span> ' + weatherIcon + '</h2>';
                    curfull.find('.weather').html(weatherIcon);
                    curfull.find('.weatherdegrees').html('<strong>' + Math.round(temp) + _TEMP_SYMBOL + '</strong><span class="rainrate"></span>');

                    if (settings['owm_name'] !== '' && settings['owm_name'] !== 0 && settings.hasOwnProperty('owm_name')) curfull.find('.weatherloc').html(settings['owm_name']);
                    else curfull.find('.weatherloc').html(location);
                }
            });
        });
    }
}

function loadWeatherFull(location, country) {
    if (typeof(settings['owm_api']) !== 'undefined' && settings['owm_api'] !== '' && settings['owm_api'] !== 0) {
        var containsweatherfull = '<div class="col-xs-3 transbg"></div>'.repeat(settings['owm_cnt']);
        $('div.containsweatherfull').html('<div class="weatherfull">' + containsweatherfull + '</div>');
		var site = 'http://api.openweathermap.org/data/2.5/forecast?q=' + settings['owm_city'] + ',' + settings['owm_country'] + '&appid=' + settings['owm_api'] + '&lang=' + settings['owm_lang'];

        if (settings['use_fahrenheit'] === 1) {
            site += '&units=imperial';
        }
        else {
            site += '&units=metric';
        }

		var html = '';
        $.getJSON(site, function (currentforecast) {
            $('.containsweatherfull').each(function () {
                var curfull = $(this);
                if (typeof(currentforecast.list) === 'undefined') {
                    curfull.remove();
                }
                else {
                    curfull.find(".weatherfull .col-xs-3").html('');
                    var start = 0;

					if(typeof(settings['owm_days']) == 'undefined' || settings['owm_days'] == '' || settings['owm_days'] == 0) {
						for (var i = start; i < (start + settings['owm_cnt']); i++) {
							curfor = currentforecast.list[i];
							var date = moment.unix(curfor.dt).locale(settings['calendarlanguage']);
							var wiclass = getIcon(curfor.weather[0].icon);
							var temp = curfor.main.temp;

							var rain = 0;
							if(typeof(curfor.rain) !== 'undefined'){
								if(typeof(curfor.rain['3h']) !== 'undefined' ){
									rain = curfor.rain['3h'];
								}
							}
							html = '<div class="day">' + date.format('HH')+':' +date.format('mm') + '<br />' + date.format(settings['weekday']) + '</div>';
							if (settings['static_weathericons'] === 1) html += '<div class="icon"><i class="wi ' + wiclass + '"></i></div>';
							else html += getSkycon(curfor.weather[0].icon, 'skycon');
							html += '<div class="temp"><span class="av_temp">' + Math.round(temp) + _TEMP_SYMBOL + '</span><span class="rain">' + (Math.round(rain*100)/100) + " mm" + '</span></div>';

							curfull.find('.weatherfull').each(function () {
							   $(this).find('.col-xs-3:eq(' + i + ')').html(html);
							});
						}
					}
					else {
						var i = 0;
						while (start < 41){
							curfor = currentforecast.list[start];
							var date = moment.unix(curfor.dt).locale(settings['calendarlanguage']);
							if (date.format('HH') == '13' || date.format('HH') == '14' || date.format('HH') == '15'){
								var wiclass = getIcon(curfor.weather[0].icon);
								var temp = curfor.main.temp;
								var Wdescription = curfor.weather[0].description;
								//Wdescription = 'Test';

								var rain = 0;
								if(typeof(curfor.rain) !== 'undefined'){
									if(typeof(curfor.rain['3h']) !== 'undefined' ){
										rain = curfor.rain['3h'];
									}
								}
								html = '<div class="day">' + date.format(settings['weekday']) + '</div>';
								if (settings['static_weathericons'] === 1) html += '<div class="icon"><i class="wi ' + wiclass + '"></i></div>';
								else html += getSkycon(curfor.weather[0].icon, 'skycon');
								html += '<div class="day">' + Wdescription + '</div><div class="temp"><span class="av_temp">' + Math.round(temp) + _TEMP_SYMBOL + '</div>';

								curfull.find('.weatherfull').each(function () {
								   $(this).find('.col-xs-3:eq(' + i + ')').html(html);
								});
								i++;
							}
							start++;
						}
					}
                }
            });
        });
    }
}

function getSkycon(code, classname) {
    var random = getRandomInt(1, 100000);

    var icon = 'PARTLY_CLOUDY_DAY';
    var icons = {
		'01d': 'CLEAR_DAY',
		'01n': 'CLEAR_NIGHT',
		'02d': 'PARTLY_CLOUDY_DAY',
		'02n': 'PARTLY_CLOUDY_NIGHT',
		'03d': 'CLOUDY',
		'03n': 'CLOUDY',
		'04d': 'CLOUDY',
		'04n': 'CLOUDY',
		'09d': 'RAIN',
		'09n': 'RAIN',
		'10d': 'RAIN',
		'10n': 'RAIN',
		'11d': 'WIND',
		'11n': 'WIND',
		'13d': 'SNOW',
		'13n': 'SNOW',
		'50d': 'FOG',
		'50n': 'FOG',
    };
    if (icons.hasOwnProperty(code)) {
        icon = icons[code];
    }

    var skycon = '<script>';
    skycon += 'var skycons = new Skycons({"color": "white"});';
    skycon += 'skycons.add("icon' + random + '", Skycons.' + icon + ');';
    skycon += 'skycons.play();';
    skycon += '</script>';
    skycon += '<canvas class="' + classname + '" data-icon="' + icon + '" id="icon' + random + '"></canvas>';
    return skycon;
}

function getIcon(code) {
    var wiclass = 'wi-cloudy';

    var icons = {
		'01d': 'wi-day-sunny',
		'01n': 'wi-night-clear',
		'02d': 'wi-day-cloudy',
		'02n': 'wi-night-cloudy',
		'03d': 'wi-cloud',
		'03n': 'wi-cloud',
		'04d': 'wi-cloudy',
		'04n': 'wi-cloudy',
		'09d': 'wi-showers',
		'09n': 'wi-showers',
		'10d': 'wi-day-rain',
		'10n': 'wi-night-rain',
		'11d': 'wi-day-thunderstorm',
		'11n': 'wi-night-thunderstorm',
		'13d': 'wi-snow',
		'13n': 'wi-snow',
		'50d': 'wi-day-fog',
		'50n': 'wi-night-fog',
    };
    if (icons.hasOwnProperty(code)) {
        wiclass = icons[code];
    }
    return wiclass;
}
I introduced two new options, owm_days and owm_lang:

Code: Select all

config['owm_api'] = 'xxxxxxx'; 		// Your OWM API key
config['owm_city'] = 'Amsterdam';	// Your city or nearby city to use in OWM
config['owm_name'] = '';		// If your city is not available with OWM, you have to use a nearby city. You can type the name of your own city here to show it in Dashticz
config['owm_country'] = 'nl';		// Your country to use in OWM
config['owm_cnt'] = 4;			// Number of columns to show. If showing days, max is 5
config['owm_days'] = 1;			// Enter 1 for showing forecast in days, 0 for the OWM default 3 hour forecast
config['owm_lang'] = 'nl';		// Set language for de description of the forecast (rain, cloudy, etc.). For available languages, see https://openweathermap.org/forecast5/#multi
config['static_weathericons'] = 0;	// Enter 1 for animated weather icons, 0 for static icons

Re: Import weather data other than Wunderground

Posted: Sunday 13 January 2019 19:28
by jake
@toro Nice, thank you very much! It works well. One weather question. I see for the coming 4 days 4 different temperatures, but the same weather forecast (light rain). Since I don't like the light rain every day, this might be a bug? ;-)

Re: Import weather data other than Wunderground

Posted: Sunday 13 January 2019 20:45
by toro
jake wrote: Sunday 13 January 2019 19:28 @toro Nice, thank you very much! It works well. One weather question. I see for the coming 4 days 4 different temperatures, but the same weather forecast (light rain). Since I don't like the light rain every day, this might be a bug? ;-)
You'r welcome. It's probably because there actualy is light rain for the next days. ;) You can check on openweathermaps.org if this is the case. There might be some difference, forecast for the days is on the specific day at 13:00h, 14:00h or 15:00h.