[Release] Fun Api Response App (Idioms, Jokes, Trivia, Poems, Quotes & Riddles)

Thanks,:pray:
I now have this working in a rule with the below logic. One question remains illusive, is there some logic to limit this action to only run once per day ?

This could be simplified to not even creating or assigning the variable. Just use %value% as the message.

1 Like

Private boolean. Just an example: set it to True. In the actions, if true, do the actions, once the message is spoken, set the boolean to false. Then another rule to set the boolean to true at 3 am or something.

1 Like

@KurtSanders, one more observation. Please consider having abbreviations completely written out, or an option to use abbreviations or not. Fine for text message (oooh, an idiom of the day Pushover message to start the day), but doesn't work well with TTS. I tried on Alexa and Siri, and neither of them could pronounce "Rur." or "Euph." in any manner that could be understood.

Wonderful,
Thanks for your help!
I now have working with the below rules and logic (if it might help anyone else)

1 Like

Wow :rofl: :heart_eyes:, went to bed last night after posting this 1st version to HPM, and woke up so see that this app has so many comments and useful suggestions!

Here are responses to some of the previous comments and suggestions above. Keep them coming, I will make updates as time permits, but all suggestions and issues are welcomed.

  • @neerav.modi Our granddaughters, after a few weeks, have started using some of these idioms in their everyday communications. It is nice to see them picking up more than what my wife and randomly use, ie "Don't look a gift horse in the mouth".
  • @ThunderboltsRock I have a HE rule when our Theater Projector turns off that sets the idiom device's 'idiom' attribute to a local variable named quote that can be used in HE rule's TTS message as %value%. I also have it play an idiom when we eat our morning breakfast...so many options.
    • RM Example (quote is a local variable)
      • Set quote to Idioms
      • Notify Echo - Theater: '%quote%.
      • I usually end the RM rule with a device command 'refresh' or toggle the switch to 'on' to pre-load the next idiom in the idiom device's attributes so that the next RM rule can fire off faster and eliminate the delay in activating the idiom's device's logic.
  • @neerav.modi I will check the Idiom data files to see if my Python parsing routine that generates these files into bite-size chunks might have a synchronization loop issue with phrase and definition.
  • @neerav.modi Great RM tip using private boolean, so many ways to create rules for specific use.
  • @neerav.modi Great suggestion on abbreviations, 'Rur', 'Euph' and TTS struggles. I will see if I can expand some of the frequent abbreviations used in these idiom phrases and definitions. I will either re-generate these idiom data files with my python parsing program or add some regex replace logic to the groovy idiom device driver in an updated version.
1 Like

Version 0.1.0 is now available in HPM for install/upgrade.

See Version History Changelog

2 Likes

version 0.1.0, the examples are missing. Known, or a bug?

And an open, semi-related question: does anyone know how to slow Siri down? She's "speaking a hundred miles an hour", as my mom would say! Alexa is a bit slower, but still a bit too fast to really digest.

The new idioms database are shortened and have the meaning, which is a shorter example which plays better in Alexa and Google Play. The legacy idioms database was a mess as indicated in the version change log..

As far as speed of Siri TTS, here is a youtube video on the settings...

I was so hopeful. I found something similar for the HomePod minis, but it's called Voice Over, and turning it on unfortunately does not affect regular TTS. Voice Over is for reading the buttons or options out loud.

Notice: Early 'Hubitat-Fun' Adopters

Please note that I am now sunsetting the original 'pre-release' Idioms device driver in favor of the more robust Fun Api Responses application, soon to be released in a few days.

Please read my 1st post above that gives more details.

1 Like

The 'Fun Api Responses' app is now available in HPM.

You will need to turn off 'Fast Search' and then search for 'Fun' as shown below.

FAQs

  1. You will need a free Api key (50 responses/day) from ApiLeague.com for all response categories (e.g. Jokes, Trivia, Poems, Quotes & Riddles).
  2. You will NOT need an api key for Idiom Responses.
  3. You can designate a TTS device for voice output in the Fun Api Responses App. If you decide to designate a TTS device, all device Refresh and Push events will generate a voice immediately.
  4. If you choose to capture the device 'response' attribute to a local string variable using Rules, that string variable can be used in subsequent actions, for example, sending a Pushover message, etc. Remember to either Refresh or Push the device to get a new response. I generally do this action after I obtain the string response, so that the next time, it is ready for capture, avoiding the delay of the Internet.
  5. The Fun Api Responses App is Only used to:
    • Enter an Api Key for all categories except for Idioms
    • Select a response site for testing your api key.
    • Seeing how many api response tokens you have left.
    • Adding 'difficulty' level to the 'Riddles' category
    • Adding Include/Exclude filters to Jokes.
      • Note: Be cautious on adding too many restriction and inclusion tags, you may encounter a "groovyx.net.http.HttpResponseException: status code: 400, reason phrase: Bad Request" which means the server could not find any responses that met your conditions.

Once the 'Fun Api Response' app is configured with your api, you can use the respective six (6) child devices to generate new responses.

1 Like

Been anxiously looking forward to this since you teased us a few days ago. "Is it up yet? Now?" :rofl:

I'm getting "groovyx.net.http.HttpResponseException: status code: 400, reason phrase: Bad Request". Edit: I removed all of the exclude tags and the jokes worked.

My daughter is going to max out the requests everyday once she learns this has been implemented! :rofl:

1 Like

Glad it's working for you. The Api*League has 'paid' plans if you or your daughter need more than 50 responses/day (Ha)... We have been using the idioms and riddles (medium difficulty) categories for education and laughs...

  • A HTTP 400 Bad Request error means the server couldn't understand the client's request, likely due to a client-side issue like an incorrect URL, malformed data, or an invalid request format.

I, too, loaded up too many include/exclude filters for jokes and encountered the dreaded 400 response status in development. I finally figured it out, like you, and settled on these for the 'jokes' category:

Include:

  • clean

Exclude:

  • chuck norris
  • nsfw

I am looking at the next version of the app to:

  1. Include a device on/auto-off 'switch' attribute for activating the refresh using Alexa routine. Apparently, Alexa does not recognize 'Push' attribute in a device.
  2. Add an app preference setting to indicate which response categories to send the response to the designated TTS device. Current is all categories.

If you have any other app suggestions, free free to let me know.