Parent/child app


#43

THIS! So much this! As soon as BigTalker is fully ported over to Hubitat I'm completely moving everything over from the old ST! Looking forward to the TTS so I can continue to use the Sonos for output.


#44

YES!!! Smartthings went through the slow cloud for TTS so Id walk in, 15 seconds later, "Front Door Open!" Haha!! So looking forward to a local TTS option.


#45

It’s unlikely that any TTS would be local.
Most probably amazon polly

Andy


#46

Well, then to keep it local I'll use it in speech synthesis mode via LanNouncer already installed on an old android phone with a nice speaker connected to it. If that's the trade-off between local and cloud I have no issue with it.


#47

You can always use locally hosted mp3s


#48

Slightly off topic. Anyone got a site where we can download mp3s from.


#49

Google amazon polly
You can register for free then make you own to download
That’s what I did

Andy


#50

Thanks. Will take a peek.


#51

You can also use webCoRE to play the mp3's. Works great!


#52

Yes, we're using AWS polly, and yes the very first TTS rendering of a given string will have to be fetched from them, but after that it's returned from local cache...

and even the first request is super fast...


#53

Thanks. I appreciate I can do it with webCoRE.
I just need some mp3 phrases to load on to a RPi (hopefully it will work) and then I'm off and running. (Hopefully. :wink: )


#54

Or.. you could use mp3 event player :slight_smile:


#55

Brilliant!


#56

This (post 33) and This (post 35) is still an issue and has stalled the porting of BigTalker.


#57

I need to correct this. The BigTalker2 parent app's TalkNow function works and that's it, until I can resolve the issues mentioned in post 33 and 35.


#58

I can't tell from your posts exactly what your problem is.

I don't know if references to parent,state.x from a child work, I've never seen that before. All of the apps I know about call methods in parent or child to communicate.

So please be more explicit for me as to just what it is that is not working for you.


#59

Child App:
log.trace("Updating settings (Parent Version: ${parent?.state?.appversion}; Child Version: ${state.appversion}; Group Enabled: ${state.groupEnabled})")

Returns:
Updating settings (Parent Version: null; Child Version: C2.0.2; Group Enabled: true)

Expected:
Updating settings (Parent Version: P2.0.2; Child Version: C2.0.2; Group Enabled: true)
This variable is set in the parent app with the following: state.appversion = "P2.0.2" and ideally should be available to the child app(s).
Instead, the child receives null when it queries this variable (and others) from the parent.

So tests like the following are not working when called within the child app:
Line 980 (referenced in the error below):
return (parent?.settings?.speechModesDefault.contains(location.mode)) //True if we are in an allowed Default mode, False if not

Log shows the following for a BT2 scheduled event:
java.lang.NullPointerException: Cannot invoke method contains() on null object on line 980 (onSchedule1Event)

So it appears, a child app is not able to query variables of the parent app. I can do this in the other platform, but not in this one.


Parent function to return settings/state data to child app
#60

Like I said, I’ve never seen this before. Is it documented in ST or just something that you discovered?

Why don’t you just use a method to return the value? RM does the same thing, but uses a method.


#61

I don't know that it's documented. It does work there though.

I suppose I could try using a method, but BT is thousands of lines of code with several references between parent/child variables, so I'm trying to port with minimal amount of code changes if possible. I'd like to just add a Hubitat/ST detection and adjust minimally as required otherwise things get heavily fragmented and for a free/hobby app with no staff or other help that just becomes a big chore.


#62

Well, a method is going to work on both platforms.