Getting current default TTS voice

Did my best on a search here, but couldn't find anything...

So, is there a way to get the currently set default TTS voice?

This is what I'm looking for, but via code:

Seems like I can get lat/long and a few other bits from that page on the location object using getLocation(), but there's no mention of the TTS setting.

I've tried a few guesses at what it might be, since it's not documented here: Location Object | Hubitat Documentation

Is this available somehow? I'm trying to make a custom command with a selector for the TTS voices. I can get the list of voices easily with getTTSVoices().collect{it.name}.sort(), but then it defaults to 'Aditi' and that's not good for most people. I could just hard code 'Matthew', and that would work for a lot of people since a lot probably just use the pre-set default... but ideally I could have this default to whatever the default the user already has set.

Edit: This works, but is a total hack:

String getCurrentTTSVoice() {
  Map params = [uri: "http://127.0.0.1:8080/hub/details/json?reloadAccounts=false"]
  params.contentType = 'application/json'
  params.requestContentType = 'application/json'
  String voice
  httpGet(params) {resp ->
    if(resp.status == 200) {
      def json = resp.data
      voice = json?.ttsCurrent ? json?.ttsCurrent : 'Matthew'
    }
  }
  return voice
}
1 Like

The users choice, aka default voice for the hub is set in the Setting->Hub Details. Mine is Matthew yours appears to be Aditi.

That's not what I'm looking for. I put a screen shot in my above message of where it's at the UI, so I obviously know where it is. What I'm looking for is how to get this value in driver code.

1 Like