How To - Nucal OpenWeather data as a Meshbot trigger example

UPDATE - “Cloud Variables” are currently String variable type only.

So some logic operators may not work as you might think or give you unexpected results.

Probably better to follow this newer guide here, where we use “Local Variables” and an integer variable instead.

‐--------------

I decided to look in to this as another user asked the question on the forum and I wanted to see if it was possible.

He wanted Cloud cover data from OpenWeather service and use that as a trigger in a Meshbot rule.

So how can we do this? By using the “Nucal” OpenWeather cloud service integration.

First we need to setup the Ezlo / OpenWeather connection.

In the Ezlogic web UI here on the menu on the left go to “Integrations” → “Cloud Services”

Note - My interface might look slightly different green vs blue as I have customized mine.

Click the “Add Cloud Service Integration” button.

Select OpenWeather from the list

Note - Or you can try using the Ezlo Weather one instead. I am using OpenWeather as that was the original question raised.

image

You will then see this popup with the instructions on how to get your Free OpenWeather API key. You need to do that and get your key so it can authenticate etc.

Click the Yes button

This is the URL - https://home.openweathermap.org/api_keys

On this screen paste in your OpenWeather API key

It should then say Successful

In your “My Cloud Services Integration” area you should then see your new OpenWeather service.

OK now we need to create our first Meshbot rule to pull down the weather data. In this example we are interested in Cloud Coverage information.

So on the menu on the left go to “Automation” → “Meshbots” then click the button to create a new Meshbot.

I don’t think it matters? If you select “Cloud” or “Local” here for the type of Meshbot rule, I selected “Local”

image

Give your new rule a name and add a new Action, select “Cloud Services” then “OpenWeather” then “OpenWeather Token ***” then “Get Current Weather by City Name”

Type in the name of your city in the field below and then select Celsius or Fahrenheit

Now click the “Test” button

You should now see some Weather data coming in, if you expand the “Data” node

Next select “Save Output to Cloud Variable”

You will then see a “Data Structure” on the left hand side, select and drag and drop the item you are interested in to the box on the right hand side.

I selected “clouds_all” in this example.

Now click the “Test your Variable” button.

I then saw this pop up which was working as I could see there was a value of “75”

Now you probably want to add a Trigger on your Meshbot rule, something like a time interval so it runs every hour or whatever to get fresh weather data etc.

Now Save your Meshbot rule.

So this is the first rule that obtains our Cloud Coverage data.

You can then create further Meshbot rules and use the new “Cloud Variable” as a trigger for those rules.

For example say I have an outdoor awning, I want to retract when cloud cover is above 70%

I can now create a rule to do that.

So I create a second Meshbot rule with the trigger and action shown in the screen shot below. My Virtual Switch pretending to be a motorized awning device etc.

That’s it let me know if it works for you or not ?

2 Likes

Ohh Wow thank you very much that worked for me finally :slight_smile:
The issue I had is at the (Save Output) step:
Save output to local variable → we can’t select any specific value from the data structure
But then after choosing (save output to cloud variable) I was able to choose the clouds value then created a trigger using that cloud variable.
Thank you again for your help

Yes I noticed that also, perhaps they will improve that eventually ?

Please let me know if your trigger actually works? I didn’t test it out loads tbh.

We are talking about this vs this

Save Output to Cloud Variable - Has the drag and drop Data Structure

Save Output to Local Variable - Does not have the drag and drop Data Structure

image

Yes that’s correct

Yes everything works fine :slight_smile:

1 Like

This is currently a limitation with using “Cloud Variables” as described in this how to guide. That is because “Clouds Variables” currently in Ezlogic are only of STRING type.

This means that some logic operations will not work properly or give un-expected results.

I now have a new way to do this using “Local Variables” and a LUA script. You can see the new how to guide here.