[OBSOLETE 1.1.6 5/25/16] Big Talker - Talk when events occur

Big Talker uses the Zipcode that SmartThings shows your hub near. WeatherUnderground is likely using only US based postal codes. Will you launch Big Talker (1.1.4-Beta), then go to the Status page, then look under Defaults for “Hub ZipCode for Weather*”. Finally go to http://www.wunderground.com/weather-forecast/xxxxx (where xxxxx is the Zipcode shown on the BigTalker status page) and see what that returns?

This is one of the reasons that I added the custom location feature, ie: %weathertoday(france/paris)% or %weathertoday(uk/london)%

Yeah my hub is reporting a 00000 zipcode :frowning: - It’s annoying why they do that

BIG TALKER - 1.1.5 - RELEASE ANNOUNCEMENT - 1/31/2016

Download Big Talker 1.1.5 from: https://github.com/rayzurbock/SmartThings-BigTalker

  • 1.1.4 was a development/beta version branch. These features and bug fixes were rolled into 1.1.5
  • 1/31/2016 - 1.1.5
    • Metadata Update: Update copyright from 2014 to 2014-2016.
    • New Feature: poll() or refresh() on Talk() to try to update current status of player. Protect crash using try/catch routines. Delays poll for 2 minutes after any speech event. (mediaPlayer mode only)
    • New Feature: Added detection of failure to convert text to speech (SmartThings intermittent issue with textToSpeech function), send notification instead so message is not missed.
    • New Feature: Added new Talk variables %weathercurrent%, %weathertoday%, %weathertonight%, %weathertomorrow%. Can be added to any event.
    • New Feature: Upon Install or settings update, a poll process will execute every minute to check all configured speech devices for their latest status. This is in an effort to better detect if a device is playing before interrupting to speak. (Note: VLCThing doesn’t report ‘playing’ until after the second poll or 2 minutes into a playlist; others may as well). (mediaPlayer mode only)
    • New Feature: Added Status page item to show the ZipCode that SmartThings has derived from the hub via Latitude/Longitude.
    • New Feature: Added Phrase Variables
      • %weathercurrent% - Current weather
      • %weathertoday% - Today’s weather forecast
      • %weathertonight% - Tonight’s weather forecast
      • %weathertomorrow% - Tomorrow’s weather forecast
      • %weathercurrent(00000)% = Current weather based on custom zipcode (replace 00000)
      • %weathertoday(00000)% = Today’s weather forecast based on custom zipcode (replace 00000)
      • %weathertonight(00000)% = Tonight’s weather forecast based on custom zipcode (replace 00000)
      • %weathertomorrow(00000)% = Tomorrow’s weather forecast based on custom zipcode (replace 00000)
        • NOTE: (00000) can also be replaced by any supported location of the WeatherUnderground API such as (France/Paris), (latitude,longitude), (AirportCode), (State/City)
    • New Feature: Add adjustWeatherPhrase() function to convert mph to “Miles Per Hour”, NNE to “North Northeast”, etc…
    • New Feature: Added “Help” section to each event configuration page with a “Phrase Tokens” option to give the user an In-App reference of the known phrase tokens that can be used.
    • Feature Modification: Re-write of Talk() to better detect latest playing track and play status (latestValue() instead of currentValue()). (mediaPlayer mode only)
    • Feature Modification: Modified Start page, About section
    • Feature Modification: Add LANnouncer into the supported device descriptions for speechSynthesis.
    • Feature Modification: Remove unsupported Volume setting / function when operating in speechSynthesis mode.
    • BugFix: Corrected default phrases for Water sensor (Thanks ST Community: Greg) (was using acceleration phrases)
    • BugFix: Corrected home mode change issue if exclusion was not set (Thanks for the report ST Community: Greg)
    • BugFix: Resolve an error that is present if both currentTrack and currentStatus return null. “java.lang.NullPointerException: Cannot get property ‘status’ on null object”
    • BugFix: Setting changes were not activated when editing within the “Configure Defaults” menu and pressing Done. Settings only activated after editing within the “Configure Events” menu and pressing Done. Resolved.
    • BugFix: Replace special characters found in phrase (ie: URL tokens) such as those that end up in weather reports which cause LANnouncer to not speak when expected.
    • BugFix: Fix Talk() routine for speechSynthesis only devices which typically do TTS on the phrase passed to them on their own or within their deviceType.
    • BugFix: Talk() function has been further optimized and more bugs have been resolved.
4 Likes

Are there still problems with text to speech on SmartThings? I got VLC Thing installed and the test button produces audio. I installed Big Talker and set up a couple of events. When I tried one, I didn’t get anything. Here’s the log:

87f5515d-dfea-40a4-a73a-c55bee62adc3 9:48:01 AM: trace BIGTALKER(1.1.5) || mP | Mini Old Man | cT<>null | cS/cT<>playing | Sending playTrackAndRestore().
87f5515d-dfea-40a4-a73a-c55bee62adc3 9:48:01 AM: trace BIGTALKER(1.1.5) || mP | Mini Old Man | Current Status: stopped, CurrentTrack: [genre:Jazz, title:It-Alien - La Femme et le Chien, station:It-Alien - It-Alien - La Femme et le Chien, album:Life 2.0, filename:http://api.jamendo.com/get2/stream/track/redirect/?id=479887, artist:It-Alien, date:2009, artwork_url:file:///Users/curt/Library/Caches/org.videolan.vlc/art/artistalbum/It-Alien/Life%202.0/art.jpg].
87f5515d-dfea-40a4-a73a-c55bee62adc3 9:48:01 AM: trace BIGTALKER(1.1.5) || Mini Old Man | Volume: 50
87f5515d-dfea-40a4-a73a-c55bee62adc3 9:48:01 AM: trace BIGTALKER(1.1.5) || Last poll: 9:46:37 am
87f5515d-dfea-40a4-a73a-c55bee62adc3 9:48:01 AM: trace BIGTALKER(1.1.5) || TALK(contact) |mP| >> kitchen door is now closed
87f5515d-dfea-40a4-a73a-c55bee62adc3 9:47:59 AM: trace BIGTALKER(1.1.5) || mP | Mini Old Man | cT<>null | cS/cT<>playing | Sending playTrackAndRestore().
87f5515d-dfea-40a4-a73a-c55bee62adc3 9:47:59 AM: trace BIGTALKER(1.1.5) || mP | Mini Old Man | Current Status: stopped, CurrentTrack: [genre:Jazz, title:It-Alien - La Femme et le Chien, station:It-Alien - It-Alien - La Femme et le Chien, album:Life 2.0, filename:http://api.jamendo.com/get2/stream/track/redirect/?id=479887, artist:It-Alien, date:2009, artwork_url:file:///Users/curt/Library/Caches/org.videolan.vlc/art/artistalbum/It-Alien/Life%202.0/art.jpg].
87f5515d-dfea-40a4-a73a-c55bee62adc3 9:47:59 AM: trace BIGTALKER(1.1.5) || Mini Old Man | Volume: 50
87f5515d-dfea-40a4-a73a-c55bee62adc3 9:47:59 AM: trace BIGTALKER(1.1.5) || Last poll: 9:46:37 am
87f5515d-dfea-40a4-a73a-c55bee62adc3 9:47:59 AM: trace BIGTALKER(1.1.5) || TALK(contact) |mP| >> kitchen door is now open

Mini Old Man is my very old Mac Mini running VLC. I just installed Big Talker so I’m on 1.1.5.

Update

I got it to work. I set the volume and the do not talk before and after times on the ‘Configure Defaults’ page. I thought I only had to set them to override some default. It appears they are required.

Now that’s it’s working at all, I’m having some problems. Some events only generate an audio message some of the time. For others, only the last few words are spoken. Sometimes it works just fine.

In one instance, I saw this error in the log:

87f5515d-dfea-40a4-a73a-c55bee62adc3 2:30:18 PM: error java.lang.reflect.UndeclaredThrowableException @ line 2984
87f5515d-dfea-40a4-a73a-c55bee62adc3 2:30:18 PM: trace BIGTALKER(1.1.5) || TALK(acceleration) |mP| >> Someone Is At The Front Door
0781b48f-ac98-4f46-bb08-cc9dbe0026af 2:30:17 PM: debug accelerationActiveHandler: phone present

##Update##

The problem seems to be with the VLC media player. After the event has generated an audio file, it appears in the VLC playlist. When I first click on it, it only sounds out the last word. If I click on it again, I get the complete message. If I wait a minute or two, I can repeat the scenario. If I constantly click on it, it plays the full message after the first attempt each subsequent time. It seems like the audio is being cached for a brief period of time and then purged.

##Update 2##

Now it appears to be an OS X problem. If I play a sound from Preferences/Sound/Sound Effects just before I play the file in VLC, the file plays completely. It seems like the audio service is being paged out and has to be reloaded.

##Update 3##

I found someone on the VLC forums that had the same problem. He tried an older version of VLC (2.0.9) and it was OK. When I installed it, it didn’t have HTTP for LUA and didn’t work.

This was certainly not anticipated. I’ll file a bug on Github for this and check into resolving it for the next release.

Thanks for the logs, it helps diagnose the issue tremendously.

This is due to an intermittent scheduling / unscheduling issue within SmartThings platform that started around Jan 18, 2016.

Line 2984 calls the SmartThings API Unschedule() function which is apparently broken or randomly working for some (or all?) users. This is within the Talk() function and deals with rescheduling the polling system. Since SmartThings platform is throwing this random exception, the Talk() function never completes when this happens. Code execution stops. I could apply a patch to BigTalker, but either way this scheduling bug breaks the poller which will primarily affect Sonos users ability to detect if a playlist is playing.

I’ll wait a few days and see if SmartThings addresses this bug and try to patch BigTalker with a workaround if they do not.

See:

@rayzurbock, is it possible to write a smartapp that can send text to your app to be spoken? What I would like to do is to write an app that would have Big Talker speak a greeting message when my phone becomes present and the door into the house is opened for the first time there after. I don’t want it going off every time I go in and the door.

I believe Rule Machine can do this for you. It might involve a virtual switch that is switched on for the first entry so you don’t get multiple greetings, just have Rule Machine check the state of the virtual switch for each door open. You turn off the virtual switch when your presence leaves.

I don’t believe SmartApp’s can directly communicate with one another (ie: passing variables and data). This would have to be done in the form of toggling a switch or something that each app can subscribe to to monitor for events and then act on those events.

As @eibyer suggested:
You could create a simulated switch (virtual switch) device to track/communicate to BigTalker. For example, create a simulated switch, Toggle that switch to ON when your I’m back routine runs and OFF when your Goodbye routine runs. I do something similar for my morning weather report (Toggle ON when Good Morning runs and OFF when Good Night runs). Add that simulated switch in BigTalker switch events with the phrase you wish to speak when you arrive. For more elaborate control, you could toggle the simulated switch based on various conditions using Rule Machine ( http://thingsthataresmart.wiki/index.php?title=Rule_Machine )

Thanks @eibyer and @rayzurbock. A virtual switch has the advantage of keeping the design loosely coupled. @rayzurbock, what version of VLC are you running? Are you having any playback issues?

I’ve actually recently switched my Raspberry Pi from using VLC (and VLC Thing) to gmediarenderer-resurrect with “Generic Media Renderer”. I am moving towards setting up Android devices and using @NWTony’s LANnouncer.

VLC worked fine for me when I was using it, I just wanted to try something else. My Raspberry Pi keeps dropping wifi though and I have to pull the USB adapter out of it and reinsert it. Once I do that all is well again. (This has nothing to do with VLC or gmediarenderer-resurrect).

I am noticing though with mediaPlayer devices, such as I am using with gmediarenderer-resurrect, the SmartThings TTS (Text-To-Speech) cache is not always accurate anymore with the new SmartThings TTS engine. SmartThings Live Logging will show that the TTS engine is skipping generating the sound file for the text and using it from cache, but then use the wrong file that says something totally different than was requested.

I’m using it on OS X 10.11.3. I suspect that a new version of the OS broke the playback. I have another Mac Mini lying around that I was going to reimage to Ubuntu. I may try it on that OS.

One thing interesting about OS X is that it has a text to speech interface. You can choose from a number of voices and change the speed of the voice. I’ve been playing with it in Terminal with

say -v agnes “this is a test”

where agnes is one of the voices. I didn’t find the voices quite as real sounding as the one ST sends. Were one to create a LAN device to drive it, only the message text would be sent. Nothing would be cached. I’m not suggesting that you add this to your app. I just wanted to bring it up.

On a different subject, would there be a way to set up a variable message? If I set up a virtual switch that was recomended above, when I came in the door, I would like to collect some information and generate a message. For example, it could tell me how many times someone knocked on the door or rang the bell while I was away. I suspect this is not possible, but I thought I would ask.

I was testing Big Talker against some changes I made to VLC and it didn’t work. When I set debug and checked the log, it said “Remain silent while in mode Night”. It’s 2200 and the do not talk time is from 0000 to 0700.

##Update##

It’s now 0900 and it works again.

Indeed, @NWTony has done something similar with his LANdroid app for Android devices. If someone wanted to write the OS X code and then a SmartThings device handler exposing a speechSynthesis or musicPlayer capability then it should be able to be added to SmartThings and BigTalker.

Currently, BigTalker does not have a variable / counter for such events.

BigTalker uses the SmartThings API function location.TimeZone (link) along with your configured Start/End times to feed into the function timeOfDayIsBetween() (link) which will return True/False in regards to remaining silent or not.

According the the documentation (see link above), location.TimeZone requires that location services is allowed on your mobile device for your SmartThings App. Are you in the US. or UK? If you have location services turned on and this is still an issue, perhaps this is a locale timezone calculation issue?

@rayzurbock, I’ve written the server. In the process of testing it, I started getting messages from VLC Thing. Since the actual text to be spoken is in the name of the mp3 file, I just parsed it out, replaced the underscores with spaces, and fed it to ‘say’. It works better than VLC. I don’t know what response VLC expects back so I just send an http header along with ‘OK’. I’m working on making the server less brittle. I always relied on Rails, Symfony, or PHP to do it for me. My next step is to create my own deivce handler. I was going to use VLC Thing as a starting point and strip it down to what I need, but it’s mostly stuffe I donn’t need. I’m going to find a better example

I tried the latest Big Talker 1.1.5 with my Samsung R1 speaker. It works really well for the weather announcement. Thanks Brian.

2 Likes

Awesome! Thanks for the feedback.

I just set Big Talker up with an old android phone (uPNP monkey installed) using the generic media renderer in smart things. Then I paired the phone (bluetooth) with amazon echo. This setup works far better that I would have thought. If the echo is busy talking, the Bluetooth audio gets faded in over top. Also, having the phone connected does not prevent the echo from receiving voice commands…

It also works with LANouncer, but I liked the TTS voice better with the DLNA generic speaker.

Thanks for making this app. Works great.

2 Likes