Page 1 of 1

KNMI API in Dashticz

Posted: Wednesday 19 October 2022 15:25
by NilsNijenhuis
Hello,

Does anyone know a way to get a KNMI api working in dashticz instead of the Open Weather Map.
I like the layout of the Open Weather Map widget, but the Open Weather Map does give a lot of inaccurate weather forecast. if the sun is shining the widget says cloudy, etc.

and i know from a knmi app on my telefone that KNMI is a lot more accurate.
it's possible to get the API at https://weerlive.nl/delen.php
see the attachment for al the data fields the API gives.

regards Nils

Re: KNMI API in Dashticz

Posted: Tuesday 15 November 2022 21:08
by Lokonli
NilsNijenhuis wrote: Wednesday 19 October 2022 15:25 Hello,

Does anyone know a way to get a KNMI api working in dashticz instead of the Open Weather Map.
I like the layout of the Open Weather Map widget, but the Open Weather Map does give a lot of inaccurate weather forecast. if the sun is shining the widget says cloudy, etc.

and i know from a knmi app on my telefone that KNMI is a lot more accurate.
it's possible to get the API at https://weerlive.nl/delen.php
see the attachment for al the data fields the API gives.

regards Nils
In latest beta I've added KNMI as weather forecast provider.
Can you test?

Code: Select all

blocks['knmi4'] = {
    type: 'weather',
    provider: 'knmi',
    city:'amsterdam',
    apikey: 'xxx',
    layout: 4,
    width: 6,
    count: 3
}

Re: KNMI API in Dashticz

Posted: Tuesday 15 November 2022 21:35
by kiddigital
@lokonli , why not build a Domoticz module for KNMI and let Dashticz display it? Then the values can be used for other automation scenario’s as well

Re: KNMI API in Dashticz

Posted: Wednesday 16 November 2022 9:02
by Lokonli
kiddigital wrote: Tuesday 15 November 2022 21:35 @lokonli , why not build a Domoticz module for KNMI and let Dashticz display it? Then the values can be used for other automation scenario’s as well Image
Good suggestion.

Data collection is the easy part.
Rendering weather information from different sources (OWM, KNMI) in a consistent way while the weather data is not the same is more challenging.

The rendering part had to be made anyway.

Further,
For weather integration in Domoticz I have to create a Domoticz device for every information element. That will create a lot of additional devices. And then I've to find an easy way to transfer all applicable device info from Domoticz to Dashticz. Maybe in the future I'll have a look at this.

Re: KNMI API in Dashticz

Posted: Wednesday 16 November 2022 23:16
by EdwinK
just added the block
Naamloos.jpg
Naamloos.jpg (126.82 KiB) Viewed 2284 times
(looks like I need to fix the layout some more

Re: KNMI API in Dashticz

Posted: Saturday 24 December 2022 15:20
by NilsNijenhuis
Hello Lokonli, sorry for the late reaction. I have tested the block and it gives the following result.
The tekst part below 'Wisselvallig en zacht' is a little crowded but the rest looks nice

Re: KNMI API in Dashticz

Posted: Sunday 25 December 2022 14:13
by NilsNijenhuis
with al little styling it looks a little better.

Is it also possible to make a layout with only the 4 days forecast from knmi, like i use below the KNMI4 block?

Re: KNMI API in Dashticz

Posted: Sunday 25 December 2022 17:22
by Lokonli
Did you already try with layout:0 as block parameter?
knmi0.jpg
knmi0.jpg (12.6 KiB) Viewed 2166 times

Re: KNMI API in Dashticz

Posted: Sunday 25 December 2022 20:42
by NilsNijenhuis
I tought that lay-out 0 gave an error, but i will check it again

Re: KNMI API in Dashticz

Posted: Monday 26 December 2022 13:06
by jake
I also tested the knmi. It works fine. I found these differences with OWM, while having taken over all the same parameters:

Only 3 day forcast, including today. The forth day gives 0 numbers and a non existing image
The description is not available
Wind force is visible, but not wind direction.

Re: KNMI API in Dashticz

Posted: Monday 26 December 2022 16:36
by Sjonnie2017
I am struggling to get this to work. I have defined the KNMI weather blocks in two different ways. The way I am used to (i.e. create a declaration at the start) and the way which is used in this thread. Unfortunately both types of declaration do not work. I am having problems showing weather forecasts ever since the new Domoticz update. I can'tbelieve it has anything to do with it but there you have it ;) I changed to branch beta so that shouldn't be a problem.

Here is my config.js (in part):

Code: Select all

// --------------------------------------------------------------------------------------------
// Weer
// --------------------------------------------------------------------------------------------

//// Open Weather Maps actueel weer
//blocks['currentweather_big_owm'] = {}
//blocks['currentweather_big_owm']['width'] = 8;

// Open Weather Maps 5 daagse voorspelling
blocks['weather_owm'] = {}
blocks['weather_owm']['width'] = 12;

blocks['KNMI'] = {
  type: 'weather',
  provider: 'knmi',
  apikey: '12345678',
  city: 'amsterdam',
  layout: 4,
  width: 12,
  count: 3
}

// Made a declaration of block weer at the beginning of my js file. Looks like this (without the slashes
// var weer                       = 'weer'

blocks[weer] = {}
blocks[weer]['type'] = 'weather';
blocks[weer]['provider'] = 'knmi';
blocks[weer]['apikey'] = '12345678';
blocks[weer]['city'] = 'Amsterdam';
blocks[weer]['layout'] = 4;
blocks[weer]['width'] = 12;
blocks[weer]['count'] = 3;
Any tips?

Re: KNMI API in Dashticz

Posted: Monday 26 December 2022 19:01
by HansieNL
Can you try with a minimal config.js with just the following block and see if this works:

Code: Select all

blocks['KNMI'] = {
  type: 'weather',
  provider: 'knmi',
  apikey: '12345678',
  city: 'amsterdam',
  layout: 4,
  width: 12,
  count: 3
}

Re: KNMI API in Dashticz

Posted: Tuesday 27 December 2022 15:06
by Sjonnie2017
Tx for your reply. I created a new config file and only added the weather block(s) to it. Unfortunately I get the same results.

Image

The code I used:

Code: Select all

// --------------------------------------------------------------------------------------------
// Algemene configuratie
// --------------------------------------------------------------------------------------------

var config = {}

// Aanpassing om Weather icons op oude tablet te laten zien
config['use_cors'] = 1;
// einde aanpassing
config['domoticz_ip'] = 'http://111.222.333.444:2080'; ,-fake of course ;-)
config['login_timeout'] = '60';
config['user_name'] = '';
config['pass_word'] = '';
config['app_title'] = 'Home Control';

config['room_plan'] = '0';

config['domoticz_refresh'] = '5';
config['dashticz_refresh'] = '1440';

config['dashticz_php_path'] = './vendor/dashticz/';
config['standby_call_url'] = '0';
config['standby_call_url_on_end'] = '0';
config['theme'] = 'default';
config['background_image'] = 'bg14.jpg';
config['standby_after'] = '0';
config['start_page'] = '1';
config['enable_swiper'] = '2';
config['vertical_scroll'] = '2';
config['auto_swipe_back_to'] = '1';
config['auto_swipe_back_after'] = '0';
config['auto_slide_pages'] = '0';
config['slide_effect'] = 'slide';

config['standard_graph'] = 'month';
config['blink_color'] = '255, 255, 255, 1';

config['language'] = 'nl_NL';
config['timeformat'] = 'DD-MM-YY HH:mm';
config['calendarformat'] = 'dd DD.MM HH:mm';
config['calendarlanguage'] = 'nl_NL';
config['calendarurl'] = '0';

config['boss_stationclock'] = 'RedBoss';

config['gm_api'] = '0';
config['gm_zoomlevel'] = '0';
config['gm_latitude'] = '0';
config['gm_longitude'] = '0';

config['speak_lang'] = 'nl-NL';

config['switch_horizon'] = '0';

config['setpoint_min'] = '5';
config['setpoint_max'] = '40';
config['loginEnabled'] = 0;
config['disable_update_check'] = 0;

config['no_rgb'] = 0;
config['hide_off_button'] = 0;

config['auto_positioning'] = 1;
config['use_favorites'] = 0;

config['disable_googleanalytics'] = 1;

config['last_update'] = 1;
config['hide_topbar'] = 0;
config['security_button_icons'] = 1;
config['edit_mode'] = 0;

config['hide_seconds'] = 0;
config['hide_seconds_stationclock'] = 0;

config['hide_mediaplayer'] = 0;

// Graph settings
config['graph_zoom'] = 1;

// --------------------------------------------------------------------------------------------
// Scherm configuratie
// --------------------------------------------------------------------------------------------

var max_resolution_desktop    = 'default';
var max_resolution_tablet     = 'tablet';
var max_resolution_phone      = 'phone';

// --------------------------------------------------------------------------------------------
// Apparaat definities
// --------------------------------------------------------------------------------------------

// Weer block
var weer                       = 'weer'

// --------------------------------------------------------------------------------------------
// Buttons
// --------------------------------------------------------------------------------------------

var buttons = {}

// --------------------------------------------------------------------------------------------
// Blocks
// --------------------------------------------------------------------------------------------

var blocks = {}

// --------------------------------------------------------------------------------------------
// Weer
// --------------------------------------------------------------------------------------------

//// Open Weather Maps actueel weer
//blocks['currentweather_big_owm'] = {}
//blocks['currentweather_big_owm']['width'] = 8;

// Open Weather Maps 5 daagse voorspelling
blocks['weather_owm'] = {}
blocks['weather_owm']['width'] = 12;

blocks['KNMI'] = {
  type: 'weather',
  provider: 'knmi',
  apikey: '12345678',
  city: 'amsterdam',
  layout: 4,
  width: 12,
  count: 3
}

// Made a declaration of block weer at the beginning of my js file. Looks like this (without the slashes
// var weer                       = 'weer'

blocks[weer] = {}
blocks[weer]['type'] = 'weather';
blocks[weer]['provider'] = 'knmi';
blocks[weer]['apikey'] = '04281a95aa';
blocks[weer]['city'] = 'Amsterdam';
blocks[weer]['layout'] = 4;
blocks[weer]['width'] = 12;
blocks[weer]['count'] = 3;


// --------------------------------------------------------------------------------------------
// Columns
// --------------------------------------------------------------------------------------------
var columns = {}

// Aangepaste invulling voor de titelbalk

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

// Screen 1 voor tablet
columns[1] = {}
columns[1]['blocks'] = [weer, 'KNMI']
columns[1]['width'] = 8;

// --------------------------------------------------------------------------------------------
// Screens
// --------------------------------------------------------------------------------------------
var screens = {}

// Tablet

screens[max_resolution_tablet] = {}
screens[max_resolution_tablet]['maxwidth'] = 1280;
screens[max_resolution_tablet]['maxheight'] = 800;

screens[max_resolution_tablet][1] = {}
screens[max_resolution_tablet][1]['background'] = 'bg14.jpg';
screens[max_resolution_tablet][1]['columns'] = [1]
Additional info: using Dashticz latest beta, tested on tablet, desktop and different browsers.

If there is a problem in my config file, I just don't see it :|

EDIT: And just when you think you can't see it, you see it :mrgreen: I disabled

Code: Select all

config['use_cors'] = 1;
in my config file and now all is working as it should. Thanks HansieNL for your support and tip!

Re: KNMI API in Dashticz

Posted: Tuesday 27 December 2022 17:23
by HansieNL
👍 Glad it is working now.

Re: KNMI API in Dashticz

Posted: Saturday 04 February 2023 11:15
by Daro1003
I am from Poland, from the town of Szerzyny, how can I add Poland and such a town to have the weather? Generally the block works and the weather from amsterdam is shown

Re: KNMI API in Dashticz

Posted: Saturday 04 February 2023 12:39
by kiddigital
Daro1003 wrote:I am from Poland, from the town of Szerzyny, how can I add Poland and such a town to have the weather? Generally the block works and the weather from amsterdam is shown
KNMI is the Dutch weatherservice. You can use the OpenWeatherMap (OWM) service which has support for most (larger) cities around the world.

Re: KNMI API in Dashticz

Posted: Tuesday 27 June 2023 8:13
by renerene
tested KNMI for some months. Pretty bad. Says cloudy on sunny days.
Back to OpenWheatherMap for me

Re: KNMI API in Dashticz

Posted: Wednesday 30 August 2023 17:15
by NilsNijenhuis
Yes unfortunately I also notice that knmi deviates quite a bit, I also have continuous clouds while the sky is clear blue or similar....

But it seems like all weather stations are pretty wrong lately.