[OBSOLETE] BigTalker 2.0 -- Development

Thanks @greg. @sonnaps, yes there is a 2.0 in development. The GitHub integration is Owner: rayzurbock, Name: SmartThings-BigTalker Branch: development (2.0 is a total re-config from 1.x branch; You can still run the latest 1.x version but 2.0-dev is not a simple replacement of code as previous. It is now a Parent/Child app (2 apps) configuration for expandability).

Just a quick update for the next development release. No promises but these are my latest efforts… A few (very few) additional personality phrases added and support for speechSynthesis and musicPlayer devices in the same instance (may require reconfigure at least in choosing audio output devices; I’m trying to avoid that, but it’s still early development)

2 Likes

FYI - I’m only running 2.0 and not having any issues. However I don’t have any speechSynthesis devices to test in the same instance.

Hey guys, I was a Big Talker user in the early days, but then was swayed away. One of the reasons was the delay in announcements. If the door opened, it took too long for Smarthings to announce.

I’m curious is this still the case?

I’m going to be jumping back into this and would love to use and support the app.

Thanks

There is no delay for me. Some events I subscribe to send me push notifications and BT notifications and they come through at the same time.

Hi,
I am going to attempt to use Big Talker with VLC thing.
I had a few questions:

  1. Does Big Talker allow the ability to play custom MP3s for events? For instance I want to play the Star Trek door swoosh sound when I enter my front door.
  2. Does Big Talker allow for different volumes for different events?
  3. Is there an http API to invoke Big Talker? When my house alarm is triggered, I can have it call an http URL. I would like to expose a URL that will play a really loud recording of rottweilers barking.
  1. Not currently. It’s been requested by several people so I’ll likely add it soon.
  2. Yes (in musicPlayer mode)
  3. Not directly in BigTalker, but if you can find a device handler that does it and perhaps introduces it as a switch on/off event you can trigger BigTalker to speak (or play an alarm sound if using LanNouncer which requires speechSynthesis mode)

Just curious but is Big Talker 2.0 suppose to be refreshing all my speakers every minute all day long?

There is a setting where you can turn polling off. If you want to resume music after notifications you should leave it on.

1 Like

Brian were you able to add the additional personality?

@ rayzurbock

I am very interested in adding more personality such as the ones I posted above. My problem is where in the Developer app do I put them, and what do I have to change. Any help would be appreciated. Thanks.

I have this added in my unpublished dev code; however I am also working out some other issues created in that version so I haven’t published it yet. Plus vacation, busy time of year at work, etc…

In the parent app code, locate the function def addPersonalityToPhrase(phrase, evt){ It’s on or about line 2117 in version P.2.0.a8. Edit the available “response =” lines. Change "options = " to match the new number of options available. Prefix each phrase with either {PRE} or {POST} to tell it where your personality phrase should be placed in the original desired spoken phrase.

For example for an ON event, within the addPersonalityToPhrase function, locate if (evt.value == "on") {. If this is a light then under the if (phrase.contains("light")){ section increase the options count from 8 to 9 and under response[8] = .... add response[9] = "{POST} It is about time it is awfully dark in here", If it is not a light go under the } else { increment options = 3 to options = 4 and then under response[3] = "{PRE}Oh, Hi" add response[4] = "{POST} Glad you are here I was lonely"

Same for an OFF event. and a little further down is a list of generic events, these are supposed to be personality phrases that could be prefixed/appended to almost any other type of event.

Good luck!

I don’t know what I did wrong but I changed value to 10 for ON and OFF but no sound from BigTalker after I published the app for myself. Below is my changes.
def addPersonalityToPhrase(phrase, evt){
LOGDEBUG(“addPersonalityToPhrase(${phrase},${evt})”)
def response = new String[20]
response[0] = “”
def options = 0
def genericresponse = new String[20]
genericresponse[0] = “”
def genericoptions = 0
def myRandom = 0
//SWITCHES BEGIN
if (evt.value == “on”) {
if (phrase.contains(“light”)){
options = 10
response[1] = “{POST}please don’t forget to turn the light off”
response[2] = “{POST}night vision goggles would do the same but I guess they are more expensive.”
response[3] = “{POST}Thanks Thomas Edison!”
response[4] = “{POST}Wow, this is bright!”
response[5] = “{POST}Where are my sunglasses.”
response[6] = “{POST}there goes the electricity bill!”
response[7] = “{POST}the same old thing everyday.”
responce[8] = “{POST}It is about time it is awfully dark in here.”
responce[9] = “{POST}Glad you are here I was lonely.”
response[10] = “{PRE}Oh, Hi”
} else {
//Something turned on, but it wasn’t a light
options = 3
response[1] = “{POST}there goes the electricity bill!”
response[2] = “{POST}the same old thing everyday.”
response[3] = “{PRE}Oh, Hi”
}
}
if (evt.value == “off”) {
if (phrase.contains(“light”)){
options = 10
response[1] = “{POST}It’s about time!”
response[2] = “{POST}time to save some money!”
response[3] = “{POST}wow, it’s dark”
response[4] = “{POST}going green are we?”
response[5] = “{POST}I’ll still be here, in the dark.”
response[6] = “{POST}Hey! You know I am afraid of the dark.”
response[7] = “{POST}Please don’t leave me alone in the dark.”
responce[8] = “{POST}Good thing you turned that off otherwise I would have.”
responce[9] = “{POST}You rally like wasting money.”
response[10] = “{PRE}Oh, Hi”
} else {
//Something turned off, but it wasn’t a light
options = 4
response[1] = “{POST}It’s about time!”
response[2] = “{POST}time to save some money!”
response[3] = “{POST}going green are we?”
response[4] = “{PRE}Oh, Hi”
}
}
//SWITCHES END

You have a few typo’s where you did “responce” instead of “response

1 Like

Now I feel super stupid. I looked at everything except the spelling. Thanks for the heads up

Working now?

Yes thank you. Trying to come up with some more personality. Just don’t know if I want to increase the amount of quirky remarks. But I am so tempted! Everyone get a kick out of these statements, and it is a great conversation point.

1 Like

Brian, what causes a certain phrase or phrases to be used more often than others? It seems it is less random than I thought. Is there something I can change? I am working on a list of new phrases to be inserted into the code. Once done I will post it code and all for you to see. Thanks.

OK Here is my version with a number of additions.

def addPersonalityToPhrase(phrase, evt){
LOGDEBUG(“addPersonalityToPhrase(${phrase},${evt})”)
def response = new String[20]
response[0] = ""
def options = 0
def genericresponse = new String[20]
genericresponse[0] = ""
def genericoptions = 0
def myRandom = 0
//SWITCHES BEGIN
if (evt.value == “on”) {
if (phrase.contains(“light”)){
options = 13
response[1] = "{POST}please don’t forget to turn the light off"
response[2] = "{POST}night vision goggles would do the same but I guess they are more expensive."
response[3] = "{POST}Thanks Thomas Edison!"
response[4] = "{POST}Wow, this is bright!"
response[5] = "{POST}Where are my sunglasses."
response[6] = "{POST}there goes the electricity bill!"
response[7] = "{POST}the same old thing everyday."
response[8] = "{POST}It is about time it is awfully dark in here!"
response[9] = "{POST}Glad you are here I was lonely!"
response[10] = "{POST}Is it time for us to play?"
response[11] = "{POST}WoW! Didn’t realize it was time to get up!"
response[12] = "{PRE}Oh, Hi"
response[13] = “{PRE}Oh, Hi there”
} else {
//Something turned on, but it wasn’t a light
options = 4
response[1] = "{POST}there goes the electricity bill!"
response[2] = "{POST}the same old thing everyday."
response[3] = "{PRE}Oh, Hi"
response[4] = “{PRE}Oh, Hi there”
}
}
if (evt.value == “off”) {
if (phrase.contains(“light”)){
options = 13
response[1] = "{POST}It’s about time!"
response[2] = "{POST}time to save some money!"
response[3] = "{POST}wow, it’s dark"
response[4] = "{POST}going green are we?"
response[5] = "{POST}I’ll still be here, in the dark."
response[6] = "{POST}Hey! You know I am afraid of the dark."
response[7] = "{POST}Please don’t leave me alone in the dark."
response[8] = "{POST}Good thing you turned that off it was hurting my eyes!"
response[9] = "{POST}You really like saving some money!"
response[10] = "{POST}Is it bedtime aready?"
response[11] = "{POST}Time for me to take a nap!"
response[12] = "{PRE}Oh, Hi"
response[13] = “{PRE}Oh, Hi there”
} else {
//Something turned off, but it wasn’t a light
options = 5
response[1] = "{POST}It’s about time!"
response[2] = "{POST}time to save some money!"
response[3] = "{POST}going green are we?"
response[4] = "{PRE}Oh, Hi"
response[5] = “{PRE}Oh, Hi there”
}
}
//SWITCHES END

image

Try changing myRandom = Math.abs(new Random().nextInt() % options) + 1 (on line 2190 from the original parent version P2.0.a8) to myRandom = (new Random().nextInt(options))

You might also try adjusting line 2168 from the original parent version P2.0.a8 from myRandom = Math.abs(new Random().nextInt() % 10) + 1 to myRandom = (new Random().nextInt(10)) — This line is used to determine if we should use the generic phrase when the random number between 1 and 10 returns 1, 4 or 7.

Since you’ve adjusted your code, you’ll need to find where these lines are in your version.


I tested the original formula and this one online at https://www.tutorialspoint.com/execute_groovy_online.php using:

myRandomOrig = Math.abs(new Random().nextInt() % 10) + 1
myRandomNew = (new Random().nextInt(10))
println("RandomOrig = " + myRandomOrig + " RandomNew = " + myRandomNew)

Initially myRandomNew was more random than myRandomOrig, but now that I’ve gone back while editing this post, both seem to return a random number in the range desired for testing (1-10), but the new format is easier to read.

I think I will wait as I don’t want to screw things up. But I will look to see if it is easier than it looks.