Open Weather Map

Moderator: leecollings

Post Reply
pipiche
Posts: 2027
Joined: Monday 02 April 2018 20:33
Target OS: Linux
Domoticz version:

Open Weather Map

Post by pipiche »

Strugglingh to get Open Weather Map working

(1) I'm using the API request it works perfectly

Code: Select all

http://api.openweathermap.org/data/2.5/weather?q=London,uk&APPID=e728704791cxx76b951643f5fba9f80
When using the same in Domoticz it just failed !!

Code: Select all

 2023-03-24 22:03:50.605 Error: OpenWeatherMap: Error getting http data!
2023-03-24 22:04:57.271 Status: OpenWeatherMap: Worker stopped...
2023-03-24 22:04:57.280 Status: OpenWeatherMap: Using specified location (City La Napoule, FR)!
2023-03-24 22:04:57.593 Status: OpenWeatherMap: City (3037456)-> Lat/Long = 43.5237,6.9408
2023-03-24 22:04:57.593 Status: OpenWeatherMap: Updating preferences for forecastscreen to use OpenWeatherMap!
2023-03-24 22:04:57.594 Status: OpenWeatherMap: Started
2023-03-24 22:05:00.887 Error: OpenWeatherMap: Error getting http data! 
What am I doing wrong ?
User avatar
kiddigital
Posts: 447
Joined: Thursday 10 August 2017 6:52
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Open Weather Map

Post by kiddigital »

Run Domoticz with the NORMAL debug flag enabled `—debuglevel normal` to see what is happening.

If you have a recently created API key, it currently does not work with the OpenWeatherMap module as they have changed the API keys authorization and it is NOT valid anymore for the ‘onecall’ API version 2.5 that is used by the module.
One RPi with Domoticz, RFX433e, aeon labs z-wave plus stick GEN5, ha-bridge 5.4.0 for Alexa, Philips Hue Bridge, Pimoroni Automation Hat
One RPi with Pi foundation standard touch screen to display Dashticz
pipiche
Posts: 2027
Joined: Monday 02 April 2018 20:33
Target OS: Linux
Domoticz version:

Re: Open Weather Map

Post by pipiche »

Ok that is a new created API. So what are the alternative ?
mgugu
Posts: 226
Joined: Friday 04 November 2016 12:33
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: France
Contact:

Re: Open Weather Map

Post by mgugu »

pipiche wrote: Saturday 25 March 2023 14:17 Ok that is a new created API. So what are the alternative ?
Same problem with Onecall v3., old keys still working.
Did you finally find an alternative to OWM in Domoticz ? Darksky is dead as expected.
pipiche
Posts: 2027
Joined: Monday 02 April 2018 20:33
Target OS: Linux
Domoticz version:

Re: Open Weather Map

Post by pipiche »

Shall we report it as a DomoticZ issue?
In reality the plugin doesn’t work if you have new created Key
mgugu
Posts: 226
Joined: Friday 04 November 2016 12:33
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: France
Contact:

Re: Open Weather Map

Post by mgugu »

Yes, this is a Domoticz issue for all new OWM users.
May be a version option, v2.5 or v3, with default at v2.5 could be added in the plugin to allow both old and new keys.
User avatar
mvveelen
Posts: 710
Joined: Friday 31 October 2014 10:22
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Hoorn, The Netherlands
Contact:

Re: Open Weather Map

Post by mvveelen »

Following this topic, because I have the same issue. Using the latest Beta version and newly created API keys from Open Weather map.
RPi3b+/RFXCOM rfxtrx433E/Shelly/Sonoff Zigbee Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
pipiche
Posts: 2027
Joined: Monday 02 April 2018 20:33
Target OS: Linux
Domoticz version:

Re: Open Weather Map

Post by pipiche »

mgugu
Posts: 226
Joined: Friday 04 November 2016 12:33
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: France
Contact:

Re: Open Weather Map

Post by mgugu »

Thank you @pipiche. I can see it is a quite old issue (Sep 2022).
User avatar
habahabahaba
Posts: 266
Joined: Saturday 18 March 2023 14:44
Target OS: Windows
Domoticz version: 2024.4
Contact:

Re: Open Weather Map

Post by habahabahaba »

Try this code

Code: Select all

	
	return {
	on = {
		timer = {
			'every 6 minutes' -- just an example to trigger the request
		},
		httpResponses = {
			'OpenWeathertrigger' -- must match with the callback passed to the openURL command
		}
	},
	logging = {
		level = domoticz.LOG_INFO,
		marker = 'template',
	},
	
	
	execute = function(domoticz, item)
	
	domoticz.openURL({
				url = 'https://api.openweathermap.org/data/2.5/weather?&lang=ru&lat=57.6299&lon=39.8737&appid=<YOUR ACTIVE API KEY>',  
				method = 'GET',
				callback = 'OpenWeathertrigger', -- see httpResponses above.
			}).afterSec(5)
			
	end
User avatar
habahabahaba
Posts: 266
Joined: Saturday 18 March 2023 14:44
Target OS: Windows
Domoticz version: 2024.4
Contact:

Re: Open Weather Map

Post by habahabahaba »

And you had to now that the answer is in JSON, not http

May be because of that you are getting the error - "2023-03-24 22:03:50.605 Error: OpenWeatherMap: Error getting http data!"
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest