Open Weather Map not working with version 2022.1

Moderator: leecollings

Post Reply
kevinppb
Posts: 3
Joined: Wednesday 28 September 2022 11:57
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Open Weather Map not working with version 2022.1

Post by kevinppb »

Hi All,

I'm having an issue getting OWM to work with Domoticz 2022.1 (same issue running on both a Raspberry pi and also a Windows 10 machine as a test)

I enable new devices to be added.
Configure the hardware using my API key and location. I change the default forecast to use OWM.

My issue is that I do not get any additional devices created and I see errors in the error log:

Code: Select all

Error: Weather: Error getting http data!
I know the API key and the connectivity to OWM is okay as I see this in the status log after I configure. I use place,country and the api returns the city ID and Lat/Long.

The status logs show: (location details removed in this snippet, but they are correct)

Code: Select all

2022-09-28 10:23:51.088 Status: New sensors allowed for 5 minutes...
2022-09-28 10:24:21.555 Status: Weather: Using specified location (City XXXXXXXX, YY)!
2022-09-28 10:24:21.869 Status: Weather: City (1234567)-> Lat/Long = 50.XXXX,4.YYY
2022-09-28 10:24:21.869 Status: Weather: Updating preferences for forecastscreen to use OpenWeatherMap!
2022-09-28 10:24:21.870 Status: Weather: Started
If I manually CURL the OWM API from within a SSH session, I get the data returned. The forecast screen also works correctly, so it's not a connectivity issue either.

OWM has never worked, so I don't see that the issue is related to some leftovers from a previous upgrade.

I've a number of other devices connected via Z-Wave and a P1 sensor which all work perfectly.

Any help would be gratefully received.

Thank you in advance.

Cheers

Kevin
User avatar
kiddigital
Posts: 438
Joined: Thursday 10 August 2017 6:52
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Open Weather Map not working with version 2022.1

Post by kiddigital »

Try running Domoticz with ‘hardware’ debug flag(s) turned on.

OWM recently made changes and when you have a recent API key with a OneCall API subscription, it seems that it does not work with the old (2.5) version.
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
kevinppb
Posts: 3
Joined: Wednesday 28 September 2022 11:57
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Open Weather Map not working with version 2022.1

Post by kevinppb »

Hi kiddigital,

Thank you for your reply.

When I enable:

Code: Select all

DAEMON_ARGS="$DAEMON_ARGS -log /tmp/domoticz.txt"
DAEMON_ARGS="$DAEMON_ARGS -debuglevel normal,hardware"
DAEMON_ARGS="$DAEMON_ARGS -loglevel  debug"
I do indeed see a http401

Code: Select all

2022-09-28 20:41:11.604  Debug: Weather: Get data from https://api.openweathermap.org/data/2.5/onecall?lat=50.XXXX&lon=4.YYY&exclude=minutely&appid=257f62fc3
375ca5930184a1----------&units=metric&lang=en

2022-09-28 20:41:11.871  Debug: HTTP 401: Unauthorized
If I curl the same URL, which is different to the working one supplied by OWM I see:

Code: Select all

curl -l "https://api.openweathermap.org/data/2.5/onecall?lat=50.XXXX&lon=4.YYY&exclude=minutely&appid=257f62fc3375ca5930184a----------&units=metric&lang=en"
{"cod":401, "message": "Invalid API key. Please see http://openweathermap.org/faq#error401 for more info."}
I still see the same if I exclude everything but the current temperature.

If I check this API URL, it works:

Code: Select all

curl -l "http://api.openweathermap.org/data/2.5/weather?lat=50.XXXX&lon=4.YYY&APPID=257f62fc3375ca5930184a----------

{"coord":{"lon":4.YYY,"lat":50.XXXX},"weather":[{"id":801,"main":"Clouds","description":"few clouds","icon":"02n"}],"base":"stations","main":{"temp":281.75,"feels_like":280.66,"temp_min":280.4,"temp_max":284.01,"pressure":999,"humidity":85},"visibility":10000,"wind":{"speed":2.06,"deg":250},"clouds":{"all":20},"dt":1664391890,"sys":{"type":1,"id":1227,"country":"BE","sunrise":1664343439,"sunset":1664386094},"timezone":7200,"id":1111111,"name":"abcdefg","cod":200}
I'm using the free account if that makes any difference. The only data I'd like to get is the current temperature, which I think should be covered by the free account.

Do you have any suggestions as to how I could get this to work?

Thank you!
User avatar
kiddigital
Posts: 438
Joined: Thursday 10 August 2017 6:52
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Open Weather Map not working with version 2022.1

Post by kiddigital »

At the moment, the OWM module makes use of 2 different OWM API’s. Which was fine as both were covered under the same subscription (incl the Free subscription).

This has recently changed (somewhere late September 2022) and now these 2
API’s need 2 different subscriptions (each with their own API key).

It still works for subscribers (and holders of older API keys) from before the change.

There is no (easy) solution yet in Domoticz OWM module.

Changing the existing module will break functionality for current users.

Possible a separate module has to be developed with similar functionality but some changes to only use the OneCall API.

But that has to be developed first…
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
kevinppb
Posts: 3
Joined: Wednesday 28 September 2022 11:57
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Open Weather Map not working with version 2022.1

Post by kevinppb »

I'm no developer, but I can usually find my way through code.

Assuming the data returned by the API is in largely the same format as the old version, then it should just be a matter of modifying the API that is called.

If anyone can point me towards resources for creating modules and where the source of the current module can be found, I'm happy to take a look.
User avatar
kiddigital
Posts: 438
Joined: Thursday 10 August 2017 6:52
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Open Weather Map not working with version 2022.1

Post by kiddigital »

See also GitHub Issue 5336
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
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest