OpenWeatherMap-Alerts-Weather-Driver

I am not aware of any polling issues. You set the polling frequency in the preferences. If you are not getting data turn on Extended Logging and look as the log for values there.

New to Hubitat and I'm trying to get this driver to work. I tried looking through this topic and I'm still a bit lost:

  1. Signed up for the Free Weather plan a few weeks ago. API key and everything works fine through the "built-in" "OpenWeatherMap" driver.

  2. Trying to use this driver with the same API key, I get this in the logs:

  1. Pasting the call directly into my browser I get this:

{"cod":401, "message": "Please note that using One Call 3.0 requires a separate subscription to the One Call by Call plan. Learn more here Pricing - OpenWeatherMap. If you have a valid subscription to the One Call by Call plan, but still receive this error, then please see Frequently Asked Questions - OpenWeatherMap for more info."}

Questions

  1. Are there multiple "free plan" types (I must have missed this)? Does it not subscribe to the One Call 3.0 service by default? Looking at the One Call 3.0 plan, I have to put in my information and credit card info? Is it not free?

  2. On the Hubitat Dashboard, what "template" are we supposed to choose for this driver? My current plan shows this:

Thanks for the help.

look back a few notes in this thread

2 Likes

Thank you @nh.schottfam, that resolved things.

I see that it states <1000 calls are free, but when I look at the details it's showing $0.15 for every 100 calls. Am I missing something?

1 Like

I see what that shows but the details under the subscription do not mention a daily limit, only the fact that 0-100 calls cost $0.15..... Has this changed? Why are there conflicting statements?

Here is a direct link to their site with the pricing info. Many of us use this without incurring any charges from OWM as we stay well under the 1,000 daily limit. They also have a feature where you can set a limit on your account to cut you off after you exceed your self-imposed limit to prevent excessive charges. Those who choose not to pay simply put in '999' for that daily limit on their account. Ultimately it is your choice. If you want to use this driver, you will need a valid One Call By Call API Key.

2 Likes

I follow the OWM threads - content (and grateful) for my success. I notice that nearly all the fielded issues seem to be around the 3.0 and One Call API. It made me go check mine. I still am actively using a 2.5 but it is no longer available at OWM - that explained a lot. Are there many of us 2.5 users still out there?

Hey @Matthew, thanks for a great plugin! I'm in the process of adding wind forecasts to it (so that I can automate whether to inflate my Christmas decorations, and for a notification to take the flag off the house). I've got it working in miles per hour, but I'm in Canada so I'd like it to work in km/h.

I see there's a switch for metric/imperial, and I see that there's logic to set the right unit names, but I can't see where any conversion between imperial and metric is happening. (I found adjTemp but nothing for wind, or for precipitation for that matter). The units in the openweathermap API request are hardcoded to "imperial". Can you give me a pointer on where the units conversion is happening for things other than temperature?

The wind speed conversion happens in rows 457-475 of the driver code. It is dependent on the user's selection for the Distance Format (Miles, Kilometers, knots or meters).

Right in front of my face. Thanks!

The myTile variable of the driver is giving me the following line for the temperature:

19.0°CnullFeels like 18.9°C

Digging into the code, I noted that this is generated at lines 1255-1256:

		mytext += sTR + String.format(ddisp_twd, myGetDataBD(sTEMP)) + myGetData(sTMETR) + myGetData('imgName0')
		mytext += 'Feels like ' + String.format(ddisp_twd, myGetDataBD('feelsLike')) + myGetData(sTMETR)

The null part of the line seems to come from myGetData('imgName0').

At line 596, this piece of code seems to be responsible for that variable:

				myUpdData('imgName0', sIMGS5 + tmpImg0 + sRB) // For daily forecasted condition text for 'Today' 

It references tmpImg0, which is defined at line 563:

//			String tmpImg0= myGetData(sICON) + getImgName((!owmDaily[0].weather[0].id ? 999 : owmDaily[0].weather[0].id.toInteger()), sTRU) + imgT1

For some reason, tmpImg0 is commented out, and it is likely the reason why I'm getting a null there. Is there any reason for commenting that line out?

I'm using version 0.6.2 from HPM.

By the way, I'm rather new to Hubitat, and the more I dig into it, I'm discovering more strange approaches and obvious technical debt. For example, it baffles me that developers have to use this "myTile" workaround to get custom tiles on the Dashboard.

1 Like

tmpImg0 It is defined on line 562 and allows for switching from 'Current' to 'Forecast' conditions.

Make sure you can access the location where your icon files are stored (they are not being blocked by your browser, Pi-hole, ad blockers, etc...) The default location is https://tinyurl.com/icnqz/ which point to https://raw.githubusercontent.com/HubitatCommunity/WeatherIcons/master/

Add an icon file name (e.q. '1.png') to the end of those links (or wherever you have stored the icons) and see if you get a image back.

1 Like

I missed line 562. In any event, I didn't change the default location; in fact, even if the location URL were invalid, there shouldn't be a null there but simply a broken image. Something is wrong with the code and I'm not sure why.

Many of us this code everyday. It may not behave as you desire it to, but it is open source so feel free to alter it to meet your needs. It does seem to work for most of us when the conditions are right.

Past experience indicates that you are having issues because your system is not allowing access to the icon location. Did you verify that you can access that location and get a valid image returned as suggested above? If you do not get an image when you put https://tinyurl.com/icnqz/1.png into your browser, then you will need to figure out why that location is being blocked before this driver will work as intended. You should see this:'
image
If you do get an image returned, then I suggest you turn on 'Extended Logging' and look in the logs for other clues as to what the issue may be.

Good luck to you.

3 Likes

Thank you. What I was alluding to wasn't the image, because I can, in fact, access the image.

What I was saying was, even if the problem was accessing the image (i.e. a connectivity issue), the code should have written out the HTML img tag and displayed as a broken image (i.e. 3) and not printed a null there. By printing a null, it means there was some undefined variable in that section of the code that needs to be fixed.

I don't have a debugging environment for Groovy at the moment so I can't dig into it right now. But I'd like to bring it up as a bug in the app here.

EDIT: To be clear, this is how it looks like on the device states:
Screenshot 2023-01-05 061143

Thank you for the coding guidance. Sorry the driver does not meet your standards. I am not a professional coder, nor have I ever claimed to be one. I acknowledge that the driver is not 100% error free.

I cannot replicate your issue. I also am not aware of any others having this issue. Perhaps it is time to move on to another driver that better suits your requirements. Thank you.

7 Likes

I just wanted to share that I have been having this same issue for quite some time. The images used to work fine on the myTile attribute, then there was an update a long time ago when they stopped and I started seeing null just like this other user is. I have never been able to figure out why. I also can't remember now when I started seeing this behavior because it's been a while. At least a year, if not more. I'm pretty sure I reported my issue in this thread a while ago, so I suppose if I scrolled back far enough I would find the date, etc.

I don't think my problem is with being able to access the images, because if I look on the device page, the icon shows up fine:

image

And yet right below that I see this for myTile:

image

I'm not complaining or anything because I don't really use the icons for anything...just wanted to point out that this problem is not isolated to the above user. This app has been rock solid otherwise and I love it.