Putting variables into the speak string

I have this test code, and it doesn’t seem to work. I don’t have any errors in my Luaupnp.log either when I run the scene.

[code]local currentTemp = luup.variable_get(“urn:upnp-micasaverde-com:serviceId:Weather1”, “CurrentTemperature”, 48)

luup.call_action(“urn:richardgreen:serviceId:VeraAlert1”, “SendAlert”,
{Message = “{tone:1} Good Morning. The current temperature is " … currentTemp … " degrees with a high today of 60 and a low of 42.”, Recipients = “”}, 46)[/code]

Is this the correct way to call variables and insert them into the speak string?

You need the Device ID for the Temperature Child device.
The service is: urn:upnp-org:serviceId:TemperatureSensor1
You can determine this by letting your mouse hover over the variable name in the Advanced tab for the device variable you want to access.

See my message template design info at: [url=http://RTS-Services.com/VeraTemplates]http://RTS-Services.com/VeraTemplates[/url]

When I integrate it will Vera Alerts (Any day now!) you will be able to put the following in your Vera Alert Message String:

“Help the temperature is {device[48].TemperatureSensor.CurrentTemperature} and climbing!”

Yeah, I’m a dummy. Not sure why I goofed up on the serviceID. I have it working now. I’m actually just generating the speak string now in a variable and passing that to Vera Alert. It’s much cleaner when setting all of the alerts up.

[code]local currentTemp = luup.variable_get(“urn:upnp-org:serviceId:TemperatureSensor1”, “CurrentTemperature”, 48)
local lowTemp = luup.variable_get(“urn:upnp-org:serviceId:TemperatureSensor1”, “CurrentTemperature”, 49)
local highTemp = luup.variable_get(“urn:upnp-org:serviceId:TemperatureSensor1”, “CurrentTemperature”, 50)

local speakMessage = "{tone:1} Good Morning. The current temperature is " … currentTemp … " degrees with a high today of " … highTemp … " and a low of " … lowTemp

luup.call_action(“urn:richardgreen:serviceId:VeraAlert1”, “SendAlert”,
{Message = speakMessage, Recipients = “”}, 46)[/code]

Is there a way to get this information from the weatherunderground API?

Yep. The code above pulls it from the Wunderground data if you have the wunderground plugin installed. Just make sure you get your device ID’s correct.

Here’s my current code I’m using:

[code]local currentTemp = luup.variable_get(“urn:upnp-org:serviceId:TemperatureSensor1”, “CurrentTemperature”, 48)
local lowTemp = luup.variable_get(“urn:upnp-org:serviceId:TemperatureSensor1”, “CurrentTemperature”, 49)
local highTemp = luup.variable_get(“urn:upnp-org:serviceId:TemperatureSensor1”, “CurrentTemperature”, 50)
local currentCondition = luup.variable_get(“urn:upnp-micasaverde-com:serviceId:Weather1”, “Condition”, 47)
local currentWind = luup.variable_get(“urn:upnp-micasaverde-com:serviceId:Weather1”, “WindCondition”, 47)

local speakMessage = "{tone:1} Good Morning. Current conditions are " … currentCondition … ". The temperature is " … currentTemp … " degrees with a high today of " … highTemp … " and a low of " … lowTemp

luup.call_action(“urn:richardgreen:serviceId:VeraAlert1”, “SendAlert”,
{Message = speakMessage, Recipients = “”}, 46)[/code]

Note that I’m not using the wind in the speak string right now because Vera Alerts would sometimes stop speaking during that part of it for some reason.

The new version of Vera Alerts will make it much easier to add variables to your message string. In fact you may never need luup code for this again!

It’s released … just needs to get through MCV audit.

The web page documentation is still being worked on but it’s in pretty good shape:
[url=http://RTS-Services.com/Vera/Plugin/VeraAlerts]http://RTS-Services.com/Vera/Plugin/VeraAlerts[/url]

@ signal15,

Where do you have a current wind device? The weather plugin gives me a device with wind, speed and conditions all in one.

[quote=“S-F, post:7, topic:173247”]@ signal15,

Where do you have a current wind device? The weather plugin gives me a device with wind, speed and conditions all in one.[/quote]

The wind is a variable that you can pull from that plugin via LUUP.