Weather - how to build a bolk

Dashticz, alternative dashboard based on HTML, CSS, jQuery

Moderators: leecollings, htilburgs, robgeerts

Daro1003
Posts: 167
Joined: Monday 14 November 2022 12:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Poland
Contact:

Weather - how to build a bolk

Post by Daro1003 »

Hello
I am asking for help because I have no idea how to display the weather in the config I set the weather data:

Code: Select all

config['owm_api'] = '8af221b0bc4022e7c72e03f8b1eb7766';
config['owm_city'] = 'Szerzyny';
config['owm_name'] = 'Pogoda';
config['owm_country'] = 'PL';
config['owm_lang'] = 'PL';
config['owm_cnt'] = '4';
Now I don't know how to transfer it to pain and further to the column. I tried the ways in the manual but nothing is displayed at all. I don't know how to construct a block in this case.
Lokonli
Posts: 2287
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Weather - how to build a bolk

Post by Lokonli »

Just add 'weather' to a column.

Or, create a block:

Code: Select all

blocks['myniceweatherblock'] = {
   type: 'weather'
}
If needed add additional block parameters.

And add 'myniceweatherblock' to a column.

Also see:
https://dashticz.readthedocs.io/en/mast ... r-forecast

Note:
If you've only recently requested a OWM key this probably doesn't work anymore. Try 'knmi' by adding the following to your block:

Code: Select all

   provider: 'knmi',
Daro1003
Posts: 167
Joined: Monday 14 November 2022 12:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Poland
Contact:

Re: Weather - how to build a bolk

Post by Daro1003 »

Code: Select all


blocks['myniceweatherblock'] = {
   type: 'weather'
}

columns[26] = { blocks : ['myniceweatherblock'], width: 12}

screens[5] = { columns: [26]}

did not work. There is only a sun icon on the dashtich screen and that's it.
I have no idea what I'm doing wrong.

How do you upload a google calendar? Will you send the block?
ressof
Posts: 60
Joined: Thursday 20 April 2017 7:20
Target OS: Linux
Domoticz version: Latest
Contact:

Re: Weather - how to build a bolk

Post by ressof »

Could dashticz be updated to support OneCall 3.0 API from openweathermap? Maybe a config line to select API 2.5 or 3.0? Don't know if the information from the API has changed?
Daro1003
Posts: 167
Joined: Monday 14 November 2022 12:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Poland
Contact:

Re: Weather - how to build a bolk

Post by Daro1003 »

The API key generated a few days ago is no longer working properly, and all the functionalities of the newly generated keys are not available this year, so no.
Where else can I download the weather and the api key for it?
Lokonli
Posts: 2287
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Weather - how to build a bolk

Post by Lokonli »

I''ll check whether the 3.0 API can be used. Will take some time ...
Daro1003
Posts: 167
Joined: Monday 14 November 2022 12:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Poland
Contact:

Re: Weather - how to build a bolk

Post by Daro1003 »

Lokonli wrote: Thursday 02 February 2023 23:07 I''ll check whether the 3.0 API can be used. Will take some time ...
Has anything happened on the subject?
Lokonli
Posts: 2287
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Weather - how to build a bolk

Post by Lokonli »


Daro1003 wrote:
Lokonli wrote: Thursday 02 February 2023 23:07 I''ll check whether the 3.0 API can be used. Will take some time ...
Has anything happened on the subject?
No, not yet. If you can help with this, that would be great.

Verstuurd vanaf mijn SM-A526B met Tapatalk

Daro1003
Posts: 167
Joined: Monday 14 November 2022 12:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Poland
Contact:

Re: Weather - how to build a bolk

Post by Daro1003 »

Lokonli wrote: Tuesday 21 February 2023 19:49
Daro1003 wrote:
Lokonli wrote: Thursday 02 February 2023 23:07 I''ll check whether the 3.0 API can be used. Will take some time ...
Has anything happened on the subject?
No, not yet. If you can help with this, that would be great.

Verstuurd vanaf mijn SM-A526B met Tapatalk
How can I help
Lokonli
Posts: 2287
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Weather - how to build a bolk

Post by Lokonli »

Daro1003 wrote: Tuesday 21 February 2023 19:22
Lokonli wrote: Thursday 02 February 2023 23:07 I''ll check whether the 3.0 API can be used. Will take some time ...
Has anything happened on the subject?
I've added support for the 3.0 API in the latest Dashticz beta version.

Can you test?

Update Dashticz with

Code: Select all

git pull
Request your API key and One Call 3.0 subscription on:
https://openweathermap.org/api

Also see:
https://dashticz.readthedocs.io/en/beta ... .html#owm3
marmachine
Posts: 133
Joined: Saturday 26 March 2016 10:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.4834
Location: Netherlands
Contact:

Re: Weather - how to build a bolk

Post by marmachine »

I have found out that a newly generated key on a new account, works with the old link in order to download (json) data.

Doesn't work without an aditional subscription to onecall (still free for 1000 calls per day)
api.openweathermap.org/data/3.0/onecall?lat=52.211462&lon=5.972701&appid={API key}

This works (which is the older version)
api.openweathermap.org/data/2.5/weather?lat=52.211462&lon=5.972701&appid={API key}
Last edited by marmachine on Sunday 07 May 2023 11:52, edited 1 time in total.
marmachine
Posts: 133
Joined: Saturday 26 March 2016 10:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.4834
Location: Netherlands
Contact:

Re: Weather - how to build a bolk

Post by marmachine »

I am using the default OWM blocks, so in my config file there is;

Code: Select all

//Configuring the OWM parameters
config['owm_api'] = 'put personal API key here'; // Personal OWM API key
config['owm_city'] = 'Apeldoorn'; // city or nearby city to use (you can also fill in the city id here)
config['owm_name'] = ''; // Name to use instead of city name
config['owm_country'] = 'nl'; // Your country
config['owm_lang'] = 'nl'; // Set language for description of the forecast (rain, cloudy, etc.). For available languages, see https://openweathermap.org/forecast5/#multi or '' (empty string, default) Use Dashticz language setting
config['owm_cnt'] = '3'; // Number of forecast elements (3-hour intervals or days) to show
config['owm_min'] = true; // true: Show minimum temperature on 2nd row (only applicable if owm_days is set to true) or false
config['owm_days'] = true; // false: Show forecast per 3 hour interval, true: Show daily forecast

Code: Select all

columns[14] = {
  blocks:  ['currentweather_big_owm','weather_owm'],
  width: 3
}

Code: Select all

var screens = {}
screens[1] = {
  columns: [14]
}
The above was working fine in an older (previous?) version.
In the latest version this has lead me to an OpenWeather One Call service usage alert email message
I'm expecting this updates once every hour (default is 3600, right?), so with four clients that is 4 x 48 = 96 per day
I am also running a script on domotics, every 30 minutes, this calls every 30 mins, so 192 per day, this i am sure off.
Unfortunately OWM doesn't offer logging, so i cannot see which key is causing the overload, though i use a different key for Domoticz and Dashticz.

So i have created a new OWM account and a new key for Dashticz
I suspect that Dashticz somehow doesn't default to 3600 anymore, or could something else trigger a new call? Like refresh of the Kiosk browser?
Is there logging or some way to see the triggers that are fired @ OWM?

Stuff is messed up and now doesn't work at all, i only see the 'sun' icon.

I am now running:
"version": "3.10.0.1",
"branch": "master",
"last_changes": "Publictransport: Fix for OVAPI",
"changelog" : {
"3.10.0": "Beta derived from 3.10",
"3.10": "Master version"
}

Willing to test beta branch, but don't know how to move to beta from here...
User avatar
HansieNL
Posts: 964
Joined: Monday 28 September 2015 15:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Weather - how to build a bolk

Post by HansieNL »

@marmachine
If you did a git install you can simply change Dashticz' branch to Beta by typing the following command (Terminal) in the Dashticz folder:

Code: Select all

git fetch origin
git checkout beta
Blah blah blah
marmachine
Posts: 133
Joined: Saturday 26 March 2016 10:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.4834
Location: Netherlands
Contact:

Re: Weather - how to build a bolk

Post by marmachine »

HansieNL wrote: Sunday 07 May 2023 12:30 @marmachine
If you did a git install you can simply change Dashticz' branch to Beta by typing the following command (Terminal) in the Dashticz folder...
Excellent, thanks!

Code: Select all

git fetch origin
git checkout beta
M custom_2/CONFIG_DEFAULT.js
M index.html
M index2.html
M jsconfig.json
Branch 'beta' set up to track remote branch 'beta' from 'origin'.
Switched to a new branch 'beta'

Code: Select all

git pull
hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint:
hint: git config pull.rebase false # merge (the default strategy)
hint: git config pull.rebase true # rebase
hint: git config pull.ff only # fast-forward only
hint:
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
Already up to date.
marmachine
Posts: 133
Joined: Saturday 26 March 2016 10:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.4834
Location: Netherlands
Contact:

Re: Weather - how to build a bolk

Post by marmachine »

Using the default OWM blocks, so in my config file there is;

Code: Select all

//Configuring the OWM parameters
config['owm_api'] = 'put personal API key here'; // Personal OWM API key
config['owm_city'] = 'Apeldoorn'; // city or nearby city to use (you can also fill in the city id here)
config['owm_name'] = ''; // Name to use instead of city name
config['owm_country'] = 'nl'; // Your country
config['owm_lang'] = 'nl'; // Set language for description of the forecast (rain, cloudy, etc.). For available languages, see https://openweathermap.org/forecast5/#multi or '' (empty string, default) Use Dashticz language setting
config['owm_cnt'] = '3'; // Number of forecast elements (3-hour intervals or days) to show
config['owm_min'] = true; // true: Show minimum temperature on 2nd row (only applicable if owm_days is set to true) or false
config['owm_days'] = true; // false: Show forecast per 3 hour interval, true: Show daily forecast

Code: Select all

columns[14] = {
  blocks:  ['currentweather_big_owm','weather_owm'],
  width: 3
}

Code: Select all

var screens = {}
screens[1] = {
  columns: [14]
}
Problem with above config
The above has been working fine in an older (previous?) version of Dashticz.
In the latest version this has lead me to an OpenWeather One Call service usage alert email message
I'm expecting this updates once every hour (default is 3600, right?), so with four clients that is 4 x 48 = 96 per day
I suspect that Dashticz in this case somehow doesn't default to 3600 anymore, or something else must trigger a new call, like refresh of the Kiosk browser? This i don't know, unfortunately OWM doesn't offer logging.
I am also running a script on domotics, every 30 minutes, this calls every 30 mins, so 192 per day, this i am sure off.

Problem with new config
So i have created a new OWM account and created a new key for Dashticz, but now it doesn't work at all, i only see the 'sun' icon.
When i move to my old account and API key, the newer blocks work!

Code: Select all

blocks['owm_weather_current'] = {
  type: 'weather',
  apikey: '<put personal API key here>', // Personal OWM API key
  city: 'Apeldoorn',
  width: 3,
  refresh: 3600, // default = 3600
  lang: 'nl',
  icons: 'fill', // Icon set: 'line' Dynamic line icons | 'linestatic' Static version of the line icons | 'fill' Dynamic filled icons | 'static' Static icons | 'meteo' Alternative set of static icons
  layout: 2 // Layout: 0: Daily forecast (=default) | 1: Hourly forecast | 2: Current weather | 3: Current weather detailed | 4: Combination of 2,3,0,1
}
So in the meanwhile, succesfully moved to beta branch, still did not manage to get blocks to work with my new API-key.
The above (older) config will also only work with my older key, a newer key does not work,
Funny thing is that, there is a similar API-response on both OLD and NEW key, with the following url;
https://api.openweathermap.org/data/2.5 ... key here>
Note: this is no longer described on OWM website, since they have moved to One-call (v3.0) so eventually this might stop working.

Question remains:
Can i somehow control (and ideally check) the update frequency, as i suspect that the old OWM blocks are updating more often than (3600) expected.

Suggestion
My suggestion would be to download data to the server once and (re-)use that for all connected clients in order to seperate API from dashboard refreshes. I'm guessing, but assume that currently each client will (re-)trigger the API.
Last edited by marmachine on Wednesday 10 May 2023 16:58, edited 2 times in total.
User avatar
HansieNL
Posts: 964
Joined: Monday 28 September 2015 15:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Weather - how to build a bolk

Post by HansieNL »

Have you checked https://dashticz.readthedocs.io/en/beta ... ather.html?
For the new version 3 key you have to add a provider parameter to the block.
Blah blah blah
marmachine
Posts: 133
Joined: Saturday 26 March 2016 10:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.4834
Location: Netherlands
Contact:

Re: Weather - how to build a bolk

Post by marmachine »

HansieNL wrote: Wednesday 10 May 2023 15:33 Have you checked https://dashticz.readthedocs.io/en/beta ... ather.html?
For the new version 3 key you have to add a provider parameter to the block.
For OWM the provider parameter seems irrelevant actually, because when i add this -> provider: 'owm', <- the block doesn't work.
Without the parameter it works, however only when i use my old OWM account, API-key!
My newly created account and key doesn't work!
This goes for both old and new type OWM blocks.

When i use KNMI API, the block works by the way... ;) my issue is regarding the OWM API

Example (working) for KNMI:

Code: Select all

blocks['knmi_weather_current'] = {
  type: 'weather',
  provider: 'knmi',
  apikey: '<put personal API key here>', // Personal API key @ API Weerlive.nl
  city: 'Apeldoorn',
  width: 12,
  refresh: 3600, // default = 3600
  lang: 'nl',
  icons: 'fill', // Icon set: 'line' Dynamic line icons | 'linestatic' Static version of the line icons | 'fill' Dynamic filled icons | 'static' Static icons | 'meteo' Alternative set of static icons
  layout: 2 // Layout: 0: Daily forecast (=default) | 1: Hourly forecast | 2: Current weather | 3: Current weather detailed | 4: Combination of 2,3,0,1
}
User avatar
HansieNL
Posts: 964
Joined: Monday 28 September 2015 15:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Weather - how to build a bolk

Post by HansieNL »

Have you read the last line of the Weather forecast beta documentation?
If you want to use OpenWeatherMap One Call API 3.0 set provider to owm3 in your block definition.
Blah blah blah
Lokonli
Posts: 2287
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Weather - how to build a bolk

Post by Lokonli »

marmachine wrote: Wednesday 10 May 2023 16:29
HansieNL wrote: Wednesday 10 May 2023 15:33 Have you checked https://dashticz.readthedocs.io/en/beta ... ather.html?
For the new version 3 key you have to add a provider parameter to the block.
For OWM the provider parameter seems irrelevant actually, because when i add this -> provider: 'owm', <- the block doesn't work.
Without the parameter it works, however only when i use my old OWM account, API-key!
My newly created account and key doesn't work!
This goes for both old and new type OWM blocks.

When i use KNMI API, the block works by the way... ;) my issue is regarding the OWM API

Example (working) for KNMI:

Code: Select all

blocks['knmi_weather_current'] = {
  type: 'weather',
  provider: 'knmi',
  apikey: '<put personal API key here>', // Personal API key @ API Weerlive.nl
  city: 'Apeldoorn',
  width: 12,
  refresh: 3600, // default = 3600
  lang: 'nl',
  icons: 'fill', // Icon set: 'line' Dynamic line icons | 'linestatic' Static version of the line icons | 'fill' Dynamic filled icons | 'static' Static icons | 'meteo' Alternative set of static icons
  layout: 2 // Layout: 0: Daily forecast (=default) | 1: Hourly forecast | 2: Current weather | 3: Current weather detailed | 4: Combination of 2,3,0,1
}
The default weather provider is 'owm'.
Recently created API keys only work with the OWM 3.0 API. For the OWM 3.0 API you have to add provider:'owm3' to your domoticz block.

At the moment Dashticz obtains the weather data directly from the OWM3 server. No Dashticz server is used. Theoretically it's possible to store the weather data in Domoticz for caching. Feel free to add this to Dashticz...

Every Dashticz refresh will result into a call to the OWM server. Maybe this explains the high number of API calls you have.
marmachine
Posts: 133
Joined: Saturday 26 March 2016 10:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.4834
Location: Netherlands
Contact:

Re: Weather - how to build a bolk

Post by marmachine »

Lokonli wrote: Wednesday 10 May 2023 21:58
marmachine wrote: Wednesday 10 May 2023 16:29
HansieNL wrote: Wednesday 10 May 2023 15:33 Have you checked https://dashticz.readthedocs.io/en/beta ... ather.html?
For the new version 3 key you have to add a provider parameter to the block.
For OWM the provider parameter seems irrelevant actually, because when i add this -> provider: 'owm', <- the block doesn't work.
Without the parameter it works, however only when i use my old OWM account, API-key!
My newly created account and key doesn't work!
This goes for both old and new type OWM blocks.

When i use KNMI API, the block works by the way... ;) my issue is regarding the OWM API

Example (working) for KNMI:

Code: Select all

blocks['knmi_weather_current'] = {
  type: 'weather',
  provider: 'knmi',
  apikey: '<put personal API key here>', // Personal API key @ API Weerlive.nl
  city: 'Apeldoorn',
  width: 12,
  refresh: 3600, // default = 3600
  lang: 'nl',
  icons: 'fill', // Icon set: 'line' Dynamic line icons | 'linestatic' Static version of the line icons | 'fill' Dynamic filled icons | 'static' Static icons | 'meteo' Alternative set of static icons
  layout: 2 // Layout: 0: Daily forecast (=default) | 1: Hourly forecast | 2: Current weather | 3: Current weather detailed | 4: Combination of 2,3,0,1
}
The default weather provider is 'owm'.
Recently created API keys only work with the OWM 3.0 API. For the OWM 3.0 API you have to add provider:'owm3' to your domoticz block.

At the moment Dashticz obtains the weather data directly from the OWM3 server. No Dashticz server is used. Theoretically it's possible to store the weather data in Domoticz for caching. Feel free to add this to Dashticz...

Every Dashticz refresh will result into a call to the OWM server. Maybe this explains the high number of API calls you have.
This explains my issues quite well, thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest