Parent/child app

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.

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

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

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.

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.

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.

1 Like

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

UPDATE: Resolved.. See post 4 at the link below for the working parent function to return setting/state variables to a child app. I'm sure this could be improved, but it's working for me.

@bravenel and/or anyone else that may be able to offer advise..

I'm super close on resolving the parent/child variable issue but have run into an issue I am not sure how to resolve. The parent method/function returning data to the child app is mostly working; however dates are being returned as strings and then when compared with timeOfDayIsBetween() an error is thrown. I'm not sure how to detect/cast these to date/datetime.

I'm moving discussion on this particular issue here under a topic of it's own:

Do we use the same git hub location for Bigtalker rayzurblock ?

Yes, but use the Hubitat-Dev branch.

It's not currently working with Sonos due to lack of playTextAndRestore() and playTextAndResume() functions in the Hubitat driver. You may be able to port a custom Sonos driver and resolve that.
See this thread for the discussion on that:

I've had confirmations of it working on some other speakers though. So, if it works for you, please post that info and what speaker and driver you are using.

I use LanAnnouncer so this should work then right ?

What's the Allow Personality setting rayzurback ?

Yes, but make sure on install that you set the slider to the option for speechSynthesis (slider to the off position I believe)

1 Like

It injects a small pool of randomness in phrases at random times.
ie: "The family room light is now off" becomes "The family room light is now off, time to save some money", but not always and the phrase may differ from time to time. Your typed text is always spoken. The randomness is then added to the beginning or end of your phrase.

Hopefully someday, I'll enhance the pool of random prefixed/appended phrases that it uses. It's pretty small and repetitive at this point.

1 Like

Works perfectly with Lan Announcer !! Thanks and I donated yesterday to you for your excellent work.

1 Like

@anon61068208 Thanks for the feedback and for your support of the project.

I got a question about BT2 -- Its not pulling weather data when I try using any of the weather variables... even if I use %weathercurrent(00000)% and use my zip code I get a error.

Just saw that getWeatherFeature is not in the firmware code yet.... bummer.

Just found out you can't install BT2 twice -- one for music and one for speech. Can this be fixed ?

Edit the code in the Parent app. Change singleInstance: true to false

1 Like

Thanks !

I have my Fabriq RIFF speakers connected to Hubitat with the DLNA driver. I was able to get them working with Bigtalker2 for speech. One thing I noticed however is when I created an event, say Test and attached it to a light switch. While it worked, it didn't show up as a child under the Big Talker2 app listing in Hubitat. Also, there is no "Remove" button to delete the actual event. How can events be removed that are no longer needed?

The child should show up under the BigTalker2 parent, at least if your using the current port that I have on GitHub. I'll need to check on the uninstall function missing for the child app. You should be able to click the (i) next to the child app in the Hubitat Apps page and choose Remove there.