Use weather info from OpenWeatherMap


First of all, actually I can't show anything because some days ago I've made a soft reset and I'm still setting up devices and apps. I've had to do it because as soon I've got the hub I've tried some things, messing around a bit because I was just in a test phase.
Anyway, in this test time I've installed the app to grab data from OpenWeatherMap. I've configured it to get different information, checking what the offer for free. After this I've expected to use its LUX information inside a rule to change the brightness of a light, but no way. I've not found anything that allowed me to get the LUX value inside a Rule.
Can someone help me, please? I just need to know where this information is stored: is it in a global variable? Should I install a virtual device that grabs this data from the App (but I've found nothing)? I wasn't able to find anything that allowed me to get what I need.

Thanks in advance!

May need to look under the Custom sections…

Not sure if this is helpful or not - for my needs I display OWM Lux and UV values on a camera overlay in BlueIris - I also set 2 lights based on a schedule to simulate Circadian light rythms (rudimentary - I do it in a different rule not shown here)

Thank you for your reply.

Actually I don't know if it's what I really need.

I try to explain it better.

I was able to configure the connection to OpenweatherMap. Once active, I've got a set of variables, with the relative values. My problem is that I can't access this variables outside the app (device, actually). So, even if I've them, I can't use even one inside a rule.

My question is: how can I export those information into (global) variables?
Or, is it really so simple as in your code: wherever I need it, I just use
OpenWeatherMap [variableName]

I look at your post in two parts, although you didn't ask this specific question. I think it is worth considering the most appropriate source for the lux reading, along with your questions about the setup of your rules.

In the end I think it is fine to use the open weather map service, particularly while you are getting started, but you may want to consider utilising sensors of some kind to report more tailored lux readings for you house. My indoor Philips Hue motion sensors include an illuminance reading (are they the same?), as an example. But like I said, not so much something to worry about now. And I can't talk, I use an even more crude method of Sunset minus X minutes... :slight_smile:

With you rule, I was going to suggest triggering on a custom attribute value, but I am now thinking a regular time-based poll of the lux reading may be all you really need, like @jshimota showed earlier. You can then include the lux reading in a conditional statement. In case you want to pursue the trigger option, here is an example using the illuminance attribute on one of my motion sensors:

Here's an example of setting up a condition using an attribute:

Obviously there is more to setting up what you want, but I may let others chime in, or you can also play with these yourself.


Thank you for the answer.
Actually I also use a crude and naive way, exactly like yours. And, to be fair, I plan to use OpenweatherMap for now, but in the future I hope I'll find a place where 'hide' more sensors (from Hue) and get information from them.

Anyway, back to the question, my problem is where the information about illuminance is set.
Now I see that you use ... or Home C-7 reports illuminance(0) ..., hence I suppose that is saved in a global variable of the device (Home C-7). Is this variable automatically available once I've configure the OpenweatherMap device? If not, what should I do to save this and other values?
This was my problem the last time, I wasn't able to get (or bring, is more correct) it outside the OpenweatherMap device.

1 Like

Ah, yes, should have probably explained that one...

I have two hubs, one a C-4 model, the other a C-7. I started the setup for the test rule and captured the screenshots on my C-4 hub, but the motion sensor is actually paired to the C-7 hub. I also have Hub Mesh configured, syncing devices between the two hubs. The reference to "Home C-7" is part of the device name for the copy of the motion sensor represented on the C-4 hub. Anyway, none of that is relevant to your setup, only to explain my previous example...

I'll need to check, but I would expect the OpenWeatherMap setup on your HE hub will include a device that captures the readings, including lux / illuminance. Again I am assuming that these readings are automatically updated for you based on some kind of schedule typically configured via the OpenWeather app / device settings.

The screenshots I was showing you are what you can then do with these readings inside your rule.

I'll try and look up the details on exactly how this will work for OpenWeatherMap, but at least in the case of your rule you need to setup, the screenshots I showed for triggers and conditions are some examples of what you can use once you setup OpenWeatherMap.


Super! As soon I'll be back at home and I'll have a bit of time I'll give it a try. Anyway, I suppose it works as you suggest, hence I'm pretty confident that I've found a solution.
Thank you very much!

1 Like

If you're using the community driver for this it does look like lux is a calculation based on sunrise / sunset, so you may be just as well to use a sunrise minus X minutes as your trigger, like me. But in the end, it's all a learning experience I expect, so still useful to go through the process of setting this up regardless of that...

I can't quite find the details on setting up he scheduled updates, but am assuming you have already sorted that out, so will leave you to play with what I have suggested in terms of the rule... Like I mentioned earlier, there may be a bit more to it, so keep that in mind and come back with any follow up questions. Good luck!!