Thank you for looking at this
I had a copy fault in the currentTemp variable.
But I can not see what is wrong with the parenthesis?
I am on extremely thin ice when it comes to luup
Thank you for looking at this
I had a copy fault in the currentTemp variable.
But I can not see what is wrong with the parenthesis?
I am on extremely thin ice when it comes to luup
I managed to save this code.
I will see if it works when I get home.
[code]url = require(“socket.url”)
local AV_DEV = 253
local LS_SID = “urn:micasaverde-com:serviceId:Sonos1”
local currentTemp = luup.variable_get(“urn:upnp-org:serviceId:TemperatureSensor1”, “CurrentTemperature”, 232)
local currentCondition = luup.variable_get(“urn:upnp-micasaverde-com:serviceId:Weather1”, “Condition”, 115)
luup.call_action(LS_SID, “Say”, {Text = string.format"The outdoor condtion is %s, and the temperature is currently at %s degrees",currentCondition, currentTemp,Volume=23}, AV_DEV)[/code]
luup.call_action(LS_SID, "Say", {Text = string.format("The outdoor condtion is %s, and the temperature is currently at %s degrees",currentCondition, currentTemp) ,Volume=23}, AV_DEV)
Should probably be better like that ?
So I did a new try to get this to work. I am sure that it is correct to change the parenthesis. But the luup still doesn’t work.
So I tried to modify it again and I think I am closer now, but I still get an error when I try the luup. The code that I have now is as follows:
[code]url = require(“socket.url”)
local AV_DEV = 253
local LS_SID = “urn:micasaverde-com:serviceId:Sonos1”
local TEMP_SID = “urn:upnp-org:serviceId:TemperatureSensor1”
local OutTemp = luup.variable_get(TEMP_SID,“CurrentTemperature”, 232)
local Cond_SID = “urn:upnp-org:serviceId:Weather1”
local OutCond = luup.variable_get(Cond_SID,“Condition”, 115)
luup.call_action(LS_SID, “Say”, {Text = string.format(“The outdoor condtion is %s, and the temperature is currently at %s degrees”,OutCond, OutTemp) ,Volume=23}, AV_DEV)
[/code]
The thing is that the temperature part is working. This whole project is about implementing the current condition from the weather underground app.
So I think something must be wrong with line 3 or 4. I created line 3 and 4 based on line 1 and 2, and according to similar codes found here on the forum.
Can you see something in the luup that doesn’t make sense?
Try this:
local OutCond = luup.variable_get(Cond_SID,"Condition", 115) or "bad"
Then if TTS is working, it would mean that you probably don’t use the right variable name or service id.
hello i had the same problem with sonos tts and the weather plugin. i could post my code, its working for me to say the condition.
local AV_DEV = 28
local MN_SID = "urn:micasaverde-com:serviceId:MediaNavigation1"
local device = 3
local LS_SID = "urn:micasaverde-com:serviceId:Sonos1"
local TEMP_SID = "urn:upnp-org:serviceId:TemperatureSensor1"
local WUGTemp1 = luup.variable_get(TEMP_SID, "CurrentTemperature", 21)
local time = os.date('%M minutes past %I:')
local t = luup.variable_get("urn:upnp-micasaverde-com:serviceId:Weather1", "ConditionGroup", 20)
luup.call_action("urn:micasaverde-com:serviceId:Sonos1", "PlayURI", {URIToPlay="Q:", Volume=20, Duration=20}, AV_DEV)
m = 60 --60 sek
luup.call_delay( 'switch_ON', m)
function switch_ON()
luup.call_action(LS_SID, "Say", {Text = string.format("Good morning. The time is currently %s. Current temperature outside is %s and the Condition outside is %s", time, WUGTemp1, t), Volume=40}, AV_DEV)
end
luup.call_delay( 'switch_off', 900) -- Call the switch off function after a delay of 2 seconds
function switch_off()
luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{ newTargetValue="0" },device)
luup.call_action("urn:micasaverde-com:serviceId:Sonos1", "PlayURI", {URIToPlay="Q:", Volume=0 }, AV_DEV)
end
this play music for one minute and then it speaks the sentence: Good morning with the time, temperature and the condition outside, and then it goes back to play music for 900 sec.
hope this helps
I did some tweaking on the code, and finally got it to work.
I am not 100% sure what did the trick. But the faultfinding help lolodomo got me on the right track.
The code that works for me is as follows:
[code]url = require(“socket.url”)
local AV_DEV = 253
local LS_SID = “urn:micasaverde-com:serviceId:Sonos1”
local OutTemp = luup.variable_get(“urn:upnp-org:serviceId:TemperatureSensor1”,“CurrentTemperature”, 232)
local currentCondition = luup.variable_get(“urn:upnp-micasaverde-com:serviceId:Weather1”, “Condition”, 115)
luup.call_action(LS_SID, “Say”, {Text = string.format(“The outdoor condition is %s, and the temperature is currently at %s degrees”, currentCondition, OutTemp) ,Volume=23}, AV_DEV)
[/code]
Thanks for your help!
And you can remove this, as it’s not referenced anywhere or needed:
url = require("socket.url")
I just wanted it create a link to a really good TTS discussion that’s going on elsewhere in the forum.
It’s goal is to dynamical change the messages that are delivered via TTS.
Hi
Please could someone share some working code that groups a couple of Sonos zones players together so that it can Say a particular piece of text, after which it should return to the previous state it was in (whatever that was.?)
[quote=“parkerc, post:70, topic:173177”]Hi
Please could someone share some working code that groups a couple of Sonos zones players together so that it can Say a particular piece of text, after which it should return to the previous state it was in (whatever that was.?)[/quote]
I will try to update the example in the wiki page. I just noted the corresponding paragraph as outdated in the wiki as it lacks few arguments and in particular the GroupZones argument.
Thanks @lolodomo -
That’s where I went first to check, but like you said, it’s still marked as ‘outdated’ - I’m looking forward to using the new group commands.
Just a thought - but is there scope to have a ‘GroupSay’ command created, one that does all the grouping of Zones for you, an alternative to the current singular ‘Say’ command ?
[quote=“parkerc, post:72, topic:173177”]Thanks @lolodomo -
That’s where I went first to check, but like you said, it’s still marked as ‘outdated’ - I’m looking forward to using the new group commands.
Just a thought - but is there scope to have a ‘GroupSay’ command created, one that does all the grouping of Zones for you, an alternative to the current singular ‘Say’ command ?[/quote]
You can use “ALL” as value for the GroupZones argument.
Hi Lolodomo
Would you be able to give me an example of how that is used with a Say command?
[quote=“parkerc, post:74, topic:173177”]Hi Lolodomo
Would you be able to give me an example of how that is used with a Say command?[/quote]
It is now explained with several examples in the Wiki: http://code.mios.com/trac/mios_sonos-wireless-music-systems/wiki/WikiStart#MakingaSonosSaysomething
I hope I am clear in my explanations.
[quote=“haavard, post:67, topic:173177”]I did some tweaking on the code, and finally got it to work.
I am not 100% sure what did the trick. But the faultfinding help lolodomo got me on the right track.
The code that works for me is as follows:
[code]url = require(“socket.url”)
local AV_DEV = 253
local LS_SID = “urn:micasaverde-com:serviceId:Sonos1”
local OutTemp = luup.variable_get(“urn:upnp-org:serviceId:TemperatureSensor1”,“CurrentTemperature”, 232)
local currentCondition = luup.variable_get(“urn:upnp-micasaverde-com:serviceId:Weather1”, “Condition”, 115)
luup.call_action(LS_SID, “Say”, {Text = string.format(“The outdoor condition is %s, and the temperature is currently at %s degrees”, currentCondition, OutTemp) ,Volume=23}, AV_DEV)
[/code]
Thanks for your help![/quote]
obsessed with the TTS
My Sonos device is 73 so I edited that…
Can someone point out what needs to be edited from the above working code…
My weather underground plug in is 74
But I’m doing something wrong here …
Hi
Just change the value next to AV_DEV to your own Sonos device number e.g.
Local AV_DEV = 73
And then add the rest of the code, updating the temperature from 232 to 74 and then the Condition device numbers from 115 to ??? (What ever it is?)
yes, I should have edited to say I did that:
OK GOT IT! … items below are the variables that needed to be edited for the weather plugin and SONOS
local AV_DEV = 73
local LS_SID = “urn:micasaverde-com:serviceId:Sonos1”
local OutTemp = luup.variable_get(“urn:upnp-org:serviceId:TemperatureSensor1”,“CurrentTemperature”, 75)
local currentCondition = luup.variable_get(“urn:upnp-micasaverde-com:serviceId:Weather1”, “Condition”, 74)
luup.call_action(LS_SID, “Say”, {Text = string.format(“The outdoor condition is %s, and the temperature is currently at %s degrees”, currentCondition, OutTemp) ,Volume=23}, AV_DEV)
Sorry I just updated my previous post, to use that piece of code you need all three of the device numbers…
… I must have got that telepathically!!
Best Home Automation shopping experience. Shop at Ezlo!
© 2024 Ezlo Innovation, All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules