Davis WeatherLink-Vantage Vue Wind Direction?

Posted on
Sat Apr 17, 2021 9:43 am
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Davis WeatherLink-Vantage Vue Wind Direction?

Found a Vantage Vue bundled with a WeatherLink on eBay for $344 so I went for it.
Got it working fine with your excellent plugin but am hoping you could add a text, e.g. WNW, wind direction state?
I see there is an integer state but not too useful, for me anyway.

Thanks,

Carl

Posted on
Sat Apr 17, 2021 10:28 am
FlyingDiver offline
User avatar
Posts: 7221
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Davis WeatherLink-Vantage Vue Wind Direction?

Sorry, no. The plugin doesn't do any transformations of the data reported by the weather station, and I really don't want to start now. I would recommend that you set a trigger on any change to the wind direction state you want, and run a Python script that sets a variable with the direction text. That way you can set the text exactly the way you want. Something like:

Code: Select all
wind_dir_last = indigo.devices[623595257].states["wind_dir_last"]
wind_dir_var = indigo.variables[1550780091] # "WindDir"

if wind_dir_last > 338 or wind_dir_last < 22:
   dir = "North"
elif wind_dir_last > 22 and wind_dir_last < 67:
   dir = "Northeast"
elif wind_dir_last > 67 and wind_dir_last < 112:
   dir = "East"
elif wind_dir_last > 112 and wind_dir_last < 157:
   dir = "Southeast"
elif wind_dir_last > 157 and wind_dir_last < 202:
   dir = "South"
elif wind_dir_last > 202 and wind_dir_last < 247:
   dir = "Southwest"
elif wind_dir_last > 247 and wind_dir_last < 292:
   dir = "West"
elif wind_dir_last > 292 and wind_dir_last < 338:
   dir = "Northwest"

indigo.variable.updateValue(wind_dir_var, dir)


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

Posted on
Sat Apr 17, 2021 12:09 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Davis WeatherLink-Vantage Vue Wind Direction?

Perfect! Thanks a bunch!

Carl

Posted on
Sat Apr 17, 2021 2:01 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Davis WeatherLink-Vantage Vue Wind Direction?

Decided to trigger the script from a variable but can't seem to make it work.
Code: Select all
wind_number = indigo.variables[1377125246] # "Wind_Dir_Number"
wind_text = indigo.variables[1567274241] # "Wind_Dir_Text"

if wind_number > 338 or wind_dir_last < 22:
   dir = "North"
elif wind_number > 22 and wind_dir_last < 67:
   dir = "Northeast"
elif wind_number > 67 and wind_dir_last < 112:
   dir = "East"
elif wind_number > 112 and wind_dir_last < 157:
   dir = "Southeast"
elif wind_number > 157 and wind_dir_last < 202:
   dir = "South"
elif wind_number > 202 and wind_dir_last < 247:
   dir = "Southwest"
elif wind_number > 247 and wind_dir_last < 292:
   dir = "West"
elif wind_number > 292 and wind_dir_last < 338:
   dir = "Northwest"

indigo.variable.updateValue(wind_text, dir)


Any idea why this won't work?

Thanks,

Carl

Posted on
Sat Apr 17, 2021 2:04 pm
FlyingDiver offline
User avatar
Posts: 7221
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Davis WeatherLink-Vantage Vue Wind Direction?

So you're copying the state value into a variable with a different trigger?

You're trying to reference the Indigo variable object directly. You need to get the integer value of it instead.

Code: Select all
wind_number = indigo.variables[1377125246].intValue().   # "Wind_Dir_Number"

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

Posted on
Sat Apr 17, 2021 2:22 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Davis WeatherLink-Vantage Vue Wind Direction?

Now getting "Invalid syntax"

Code: Select all
wind_number = indigo.variables[1377125246].intValue().   # "Wind_Dir_Number"
wind_text = indigo.variables[1567274241] # "Wind_Dir_Text"

if wind_number > 338 or wind_dir_last < 22:
   dir = "North"
elif wind_number > 22 and wind_dir_last < 67:
   dir = "Northeast"
elif wind_number > 67 and wind_dir_last < 112:
   dir = "East"
elif wind_number > 112 and wind_dir_last < 157:
   dir = "Southeast"
elif wind_number > 157 and wind_dir_last < 202:
   dir = "South"
elif wind_number > 202 and wind_dir_last < 247:
   dir = "Southwest"
elif wind_number > 247 and wind_dir_last < 292:
   dir = "West"
elif wind_number > 292 and wind_dir_last < 338:
   dir = "Northwest"

indigo.variable.updateValue(wind_text, dir)

Thanks,

Carl

Posted on
Sat Apr 17, 2021 2:24 pm
FlyingDiver offline
User avatar
Posts: 7221
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Davis WeatherLink-Vantage Vue Wind Direction?

Remove that trailing period after .intValue()

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

Posted on
Sat Apr 17, 2021 2:28 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Davis WeatherLink-Vantage Vue Wind Direction?

Now get, 'Variable object has no attribute "IntValue"

Posted on
Sat Apr 17, 2021 2:29 pm
FlyingDiver offline
User avatar
Posts: 7221
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Davis WeatherLink-Vantage Vue Wind Direction?

ckeyes888 wrote:
Now get, 'Variable object has no attribute "IntValue"


Do you actually have that I in caps?

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

Posted on
Sat Apr 17, 2021 2:31 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Davis WeatherLink-Vantage Vue Wind Direction?

Yes. Wind_Dir_Number

No sorry. i don't have the i in caps.

Posted on
Sat Apr 17, 2021 2:35 pm
FlyingDiver offline
User avatar
Posts: 7221
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Davis WeatherLink-Vantage Vue Wind Direction?

Post your current code.

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

Posted on
Sat Apr 17, 2021 2:35 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Davis WeatherLink-Vantage Vue Wind Direction?

Yes, I do have another trigger that sets the wind direction number.

Posted on
Sat Apr 17, 2021 2:37 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Davis WeatherLink-Vantage Vue Wind Direction?

Code: Select all
wind_number = indigo.variables[1377125246].intValue()   # "Wind_Dir_Number"
wind_text = indigo.variables[1567274241]   # "Wind_Dir_Text"

if wind_number > 338 or wind_dir_last < 22:
   dir = "North"
elif wind_number > 22 and wind_dir_last < 67:
   dir = "Northeast"
elif wind_number > 67 and wind_dir_last < 112:
   dir = "East"
elif wind_number > 112 and wind_dir_last < 157:
   dir = "Southeast"
elif wind_number > 157 and wind_dir_last < 202:
   dir = "South"
elif wind_number > 202 and wind_dir_last < 247:
   dir = "Southwest"
elif wind_number > 247 and wind_dir_last < 292:
   dir = "West"
elif wind_number > 292 and wind_dir_last < 338:
   dir = "Northwest"

indigo.variable.updateValue(wind_text, dir)

Posted on
Sat Apr 17, 2021 2:46 pm
FlyingDiver offline
User avatar
Posts: 7221
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Davis WeatherLink-Vantage Vue Wind Direction?

My bad, I forgot the correct syntax for getting an integer value from a variable. I don't actually use variables all that much.

Not that you didn't change both instances of wind_dir_last in each if test line.
Code: Select all
wind_number = indigo.variables[1332247332].getValue(int)   # "Wind_Dir_Number"
wind_text = indigo.variables[543848099]   # "Wind_Dir_Text"

if wind_number > 338 or wind_number < 22:
   dir = "North"
elif wind_number > 22 and wind_number < 67:
   dir = "Northeast"
elif wind_number > 67 and wind_number < 112:
   dir = "East"
elif wind_number > 112 and wind_number < 157:
   dir = "Southeast"
elif wind_number > 157 and wind_number < 202:
   dir = "South"
elif wind_number > 202 and wind_number < 247:
   dir = "Southwest"
elif wind_number > 247 and wind_number < 292:
   dir = "West"
elif wind_number > 292 and wind_number < 338:
   dir = "Northwest"

indigo.variable.updateValue(wind_text, dir)


Also, the actual error was:
Code: Select all
AttributeError: 'Variable' object has no attribute 'intValue'


which is not the same as:
'Variable object has no attribute "IntValue"

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

Posted on
Sat Apr 17, 2021 2:52 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Davis WeatherLink-Vantage Vue Wind Direction?

Sorry on the error description. Tried to copy and paste it but no go.

Works great! Many thanks!

Carl

Who is online

Users browsing this forum: No registered users and 3 guests

cron