Page 2 of 2
Re: Weather - how to build a bolk
Posted: Thursday 11 May 2023 21:07
by marmachine
marmachine wrote: ↑Wednesday 10 May 2023 12:31
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'
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.
Is there a way to pull an older branch?
Re: Weather - how to build a bolk
Posted: Thursday 11 May 2023 21:54
by Lokonli
Most releases have a tag.
With 'git tag' you get a list of all tags.
Via 'git checkout <tag>' you can switch to an earlier release.
Re: Weather - how to build a bolk
Posted: Tuesday 18 July 2023 18:56
by MasMat
marmachine wrote: ↑Sunday 07 May 2023 11:35
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}
Does anyone know if the API address can be altered to support the free accounts? Since the only difference is the call address (onecall vs weather)? Add another "provider" to facilitate this?
Re: Weather - how to build a bolk
Posted: Wednesday 19 July 2023 10:44
by habahabahaba
It you try to use 3.0/onecall you'll receive message "Please note that using One Call 3.0 requires a separate subscription to the One Call by Call plan. Learn more here
https://openweathermap.org/price. If you have a valid subscription to the One Call by Call plan, but still receive this error, then please see
https://openweathermap.org/faq#error401 for more info."
So 3.0 - is only for payment
2.5 - is free (1 000 cals/day), works with recent API keys.
How to get data from any weather provider if answer is JSON i told
here
Hope this help you
Re: Weather - how to build a bolk
Posted: Wednesday 19 July 2023 13:26
by MasMat
Awesome!
I would like to get the forecast etc working as well so just making calls for current weather seems lacking.
Anything to be done about it?
Re: Weather - how to build a bolk
Posted: Wednesday 19 July 2023 15:40
by habahabahaba
MasMat wrote: ↑Wednesday 19 July 2023 13:26
Awesome!
I would like to get the forecast etc working as well so just making calls for current weather seems lacking.
Anything to be done about it?
If you read the documentation for API of your provider i think it will not be a problem
I'm using the OWM as one of the providers so can give you an example
api.openweathermap.org/data/2.5/forecast?&lang=us&lat=57.6299&lon=39.8737&appid=<YOUR_API_KEY> - the link
Code: Select all
return {
on = {
timer = {'at 06:58 on mon,tue,wed,thu,fri',
'at 07:55 on sat',
'at 08:55 on sun'
},
httpResponses = {'weatherForecastOpenWeather'}
},
execute = function(domoticz, item)
if (item.isTimer) then
domoticz.openURL({
url = 'https://api.openweathermap.org/data/2.5/forecast?&lang=us&lat=57.6299&lon=39.8737&appid=<YOU_API_KEY>',
method = 'GET',
callback = 'weatherForecastOpenWeather', -- see httpResponses above.
}).afterSec(5)
end
if (item.isHTTPResponse) then
if (item.ok) then
if (item.isJSON) then
local jsonParser = require('JSON')
local json1 = jsonParser:decode(item.data)
local dateTime1 = os.date("%H:%M",json1['list'][1]['dt'])
local dateTime2 = os.date("%H:%M",json1['list'][2]['dt'])
local dateTime3 = os.date("%H:%M",json1['list'][3]['dt'])
local dateTime4 = os.date("%H:%M",json1['list'][4]['dt'])
local temp1 = (json1['list'][1]['main']['temp']-273)
local temp2 = (json1['list'][2]['main']['temp']-273)
local temp3 = (json1['list'][3]['main']['temp']-273)
local temp4 = (json1['list'][4]['main']['temp']-273)
local pressure1 = (json1['list'][1]['main']['pressure']*0.750064)
local pressure2 = (json1['list'][2]['main']['pressure']*0.750064)
local pressure3 = (json1['list'][3]['main']['pressure']*0.750064)
local pressure4 = (json1['list'][4]['main']['pressure']*0.750064)
local humidity1 = (json1['list'][1]['main']['humidity'])
local humidity2 = (json1['list'][2]['main']['humidity'])
local humidity3 = (json1['list'][3]['main']['humidity'])
local humidity4 = (json1['list'][4]['main']['humidity'])
local description1 = (json1['list'][1]['weather'][1]['description'])
local description2 = (json1['list'][2]['weather'][1]['description'])
local description3 = (json1['list'][3]['weather'][1]['description'])
local description4 = (json1['list'][4]['weather'][1]['description'])
local windSpeed1 = (json1['list'][1]['wind']['speed'])
local windSpeed2 = (json1['list'][2]['wind']['speed'])
local windSpeed3 = (json1['list'][3]['wind']['speed'])
local windSpeed4 = (json1['list'][4]['wind']['speed'])
local windGust1 = (json1['list'][1]['wind']['gust'])
local windGust2 = (json1['list'][2]['wind']['gust'])
local windGust3 = (json1['list'][3]['wind']['gust'])
local windGust4 = (json1['list'][4]['wind']['gust'])
local str1 = dateTime1..': Temp.: '..math.floor(temp1+0.5)..'°С , press.: '..math.floor(pressure1+0.5)..'mm, hum.: '..humidity1..'%, wind: '..math.floor(windSpeed1+0.5)..'-'..math.floor(windGust1+0.5)..'m/s, '..description1
local str2 = dateTime2..': Temp.: '..math.floor(temp2+0.5)..'°С , press.: '..math.floor(pressure1+0.5)..'mm, hum.: '..humidity2..'%, wind: '..math.floor(windSpeed2+0.5)..'-'..math.floor(windGust2+0.5)..'m/s, '..description2
local str3 = dateTime3..': Temp.: '..math.floor(temp3+0.5)..'°С , press.: '..math.floor(pressure1+0.5)..'mm, hum.: '..humidity3..'%, wind: '..math.floor(windSpeed3+0.5)..'-'..math.floor(windGust3+0.5)..'m/s, '..description3
local str4 = dateTime4..': Temp.: '..math.floor(temp4+0.5)..'°С , press.: '..math.floor(pressure1+0.5)..'mm, hum.: '..humidity4..'%, wind: '..math.floor(windSpeed4+0.5)..'-'..math.floor(windGust4+0.5)..'m/s, '..description4
local commStr = 'Weather forecast for nearest 12 hours:'..'\n'..str1..'\n'..str2..'\n'..str3..'\n'..str4
domoticz.executeShellCommand('curl -v -X POST --silent --output /dev/null https://api.telegram.org/<you bot number>/sendMessage -d chat_id=<your chat id> -d text="'..commStr..'"') -- sending notification to telegram
end
end
end
Re: Weather - how to build a bolk
Posted: Wednesday 19 July 2023 17:35
by MasMat
If I'm reading this right, this script sends a Telegram msg every morning from Domoticz.
I think we're getting there but how do I move this info to Dashticz to make a weather-block? That's what the original post is dealing with and I didn't want to go off topic.
The default 'weather'-block makes "onecall"s and 'weather_owm' didn't work for me either.