Meteobridge Weather XML

Posted on
Thu Oct 03, 2019 11:14 am
DaveL17 offline
User avatar
Posts: 6744
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Meteobridge Weather XML

forestfield wrote:
How about 1 line...

Assuming wind direction is in a python variable called dir, then

Code: Select all
wind_direction = ['N','NE','E','SE','S','SW','W','NW'][int(((dir+22.5)%360)/45)]

should be about right, assuming you want 8 compass points

Elegant! Mind if I steal that?


Sent from my iPhone using Tapatalk Pro

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Thu Oct 03, 2019 11:34 am
norcoscia offline
User avatar
Posts: 1206
Joined: Sep 09, 2015

Re: Meteobridge Weather XML

So I created a variable named dir, then push the value into it and then when I try to put that line into a script and I get this error - do I need to convert the direction value to a float or is something else wrong?

Also, do I need to create a variable named wind_direction or will the script do that by itself?

Help...
Attachments
2019-10-03_10-29-14.jpeg
2019-10-03_10-29-14.jpeg (67.77 KiB) Viewed 2733 times

_______
Norm

Posted on
Thu Oct 03, 2019 11:41 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Meteobridge Weather XML

norcoscia wrote:
So I created a variable named dir, then push the value into it and then when I try to put that line into a script and I get this error - do I need to convert the direction value to a float or is something else wrong?

Also, do I need to create a variable named wind_direction or will the script do that by itself?

Help...


You need to create the Python variable 'dir' based on an Indigo variable, and then you need to store the Python variable wind_direction into the appropriate Indigo variable.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Oct 03, 2019 11:45 am
norcoscia offline
User avatar
Posts: 1206
Joined: Sep 09, 2015

Re: Meteobridge Weather XML

I created the dir variable in the first part of the trigger (below)

I don't understand how to store the python variable into an indigo variable or how that will fix the error in the script?
Attachments
2019-10-03_10-43-23.jpeg
2019-10-03_10-43-23.jpeg (74.1 KiB) Viewed 2719 times

_______
Norm

Posted on
Thu Oct 03, 2019 11:56 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Meteobridge Weather XML

norcoscia wrote:
I created the dir variable in the first part of the trigger (below)

I don't understand how to store the python variable into an indigo variable or how that will fix the error in the script?


Python variables are not Indigo variables. You stored a state into an Indigo variable. That does not create a variable in the Python script.

Read the Variables section of https://wiki.indigodomo.com/doku.php?id ... g_tutorial

In this case, you don't even need the Indigo 'dir' variable. Change the device number to match your meteobridge device.

Code: Select all
dir = int(indigo.devices[623595257].states["WIND_dir"])
wind_direction = ['N','NE','E','SE','S','SW','W','NW'][int(((dir+22.5)%360)/45)]
newVar = indigo.variable.create("wind_direction", "-")
indigo.variable.updateValue(newVar, "wind_direction")

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Oct 03, 2019 12:08 pm
norcoscia offline
User avatar
Posts: 1206
Joined: Sep 09, 2015

Re: Meteobridge Weather XML

Thanks Joe - I will read it (and try to understand it) - appreciate the help!!!!

_______
Norm

Posted on
Thu Oct 03, 2019 2:41 pm
forestfield offline
Posts: 83
Joined: Dec 29, 2014
Location: West Sussex

Re: Meteobridge Weather XML

Feel free to steal... It's something I did ages ago when I was working on a libellium weather station.

Everyone else - I didn't know where the original wind direction was coming from - and I did n't want to overcomplicate, so thanks for the extra input.

Posted on
Thu Oct 03, 2019 3:32 pm
DaveL17 offline
User avatar
Posts: 6744
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Meteobridge Weather XML

forestfield wrote:
Feel free to steal... It's something I did ages ago when I was working on a libellium weather station.

Thank you! Stolen.


Sent from my iPhone using Tapatalk Pro

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Who is online

Users browsing this forum: No registered users and 1 guest