Trying to create OpenWeatherMap virtual device

Hi, I'm totally a noob and need help so let me know if here is the wrong place to ask. I'm just trying to see my local temperature in Hubitat using OpenWeatherMap and then I will try to actually do things with that. What steps I've taken so far:

  • Created virtual OWM device by going to + Add device, type=virtual, selecting OpenWeatherMap, no room
  • Signed up on https://home.openweathermap.org/ and generated an API key, copied it to the preferences for the new device (It's a 32 character string of numbers and letters)
  • Tried my zip code, country code of "United States", country code of "United%20States", latitude, longitude with different decimal places, setting weather polling interval, setting default current state, and a bunch of permutations of some of these without the other
  • Enabled all logging, refreshed, and checked logs over and over
  • Waited days to see if my API key needed to activate

It still says "undefined° F" in Home when I check devices, and I don't see any data anywhere. In the log it says "OpenWeatherMap - getWeather() execption java.net.URISyntaxException: Illegal character in query at index 61: https://api.openweathermap.org/data/2.5/weather?..." followed by my API key, longitude and latitude. I have gotten different variations of this error at index 62 and 64 as well.

Any ideas to make it work?

I use the OpenWeatherMap - alerts driver and it works. It's on Hubitat package manager:
OpenWeatherMap-Alerts-Weather-Driver - :gear: Custom Apps and Drivers / Custom Drivers - Hubitat

Now, I see in your log entry it is hitting the 2.5 API from openweathermap. Have you tried the 3.0? I have had problems in the past where it took a while for the API key to take a while to activate, but that would show up with a different error, not a Java error.

RNoia - are you saying that instead of the built-in OWM device, you use one you got on HPM? I installed HPM for something else, so that isn't out of the question, but I am trying to use the built-in one right now.

How do I switch from the 2.5 API to the 3.0? Is that because my OWM account is old and I am just using an old active key? I tried generating a new key just now, maybe that will be a 3.0 key?

I use OpenWeatherMap too and for that Preferences page, I ONLY entered the Key. It's got the red * indicating it's required, nothing else is.

Lat and Long are pulled from your Hub's Details page (Settings: Hub Details) as is C vs F

I'd suggest discarding that virtual and create another. Paste in only the API Key. It's alphaNumeric (hex) meaning 0-9 plus a-f. Make sure you don't have any leading or trailing spaces.

Right click on Logs and open a new browser tab. Then go to the commands tab and click Refresh. Look at what the logs say this time around.

1 Like

Having only the key entered worked! I see cloudiness, pressure, humidity, temperature, etc now, but I will work on it tomorrow, gotta go to bed now.

In the OpenWeatherMap - alert driver, there is a toggle field to use which version of the API. I am very happy with the "alert" driver from HPM as it has tons of features and attributes you can use and play with for automations.

1 Like