Parent/child app


#21

Not really, if you don’t mind, install the BigTalker parent/child and you will see what I am talking about (if you are used to the other ST version). Basically, all of the initial prompts are working and it saves some of the prompts, at the end of the initial config it throws you back to the hubitat apps list. I expected to go back into BigTalker and see the options to configure event groups (ie: child apps), instead, I got the first prompts of the parent app which I shouldn’t see again. I never saw the ability to setup the child apps (ie: event groups).


#22

Man, I haven’t used ST in over a year! Give me a link to Big Talker and I’ll try it.


#23

It’s here (parent and child): BigTalker2/smartapps/rayzurbock at master · rayzurbock/BigTalker2 · GitHub


#24

OK, I see what you're talking about. But I don't understand the flow of logic in the app -- there's a lot of code to look at.

sendNotificationEvent("${app.label.replace(" ","").toUpperCase()}: Settings activated")

That's what is blowing, I think. We don't have notifications implemented yet. Coming soon. Try replacing these temporarily with log.debug and see if that gets it moving forward.

Turn on logs to see these errors.


#25

I commented these out and did get through with the setup process. Thanks!
My Lannouncer speaker didn't speak even though the logs look like it should. I'm much further and confident in the port now than I was earlier though. Thanks @bravenel


#26

Lol. Hey, did you throw a few thousand lines of code at ST the first time?

Hubitat is pretty solid, once you grasp where the handful of holes are not to step in. Notifications are an artifact of the mobile app, which we don’t have yet. Our mobile app will support notifications, and then that will work. But that other type of notification in ST, where it sends a message to some list in the mobile app, forget it. Hubitat is not cloud centric, and not mobile app centric. Haha – just the opposite of ST.

Haha, on the other hand, the first app we got to work was Rule Machine, so heck, why not throw a bunch of code at it to see how it handles it. Right?


#27

Hence, why I’m here!!


#28

Hubitat is what happens when you start with, “what’s wrong with this picture?”, and go from there. Sort of.


#29

I had a moment of hold my breath while BigTalker saved… And then it saved!!! (Parent app is 3,556 lines of code currently and child is 1,750 lines). I was very intrigued. I hit a bump, but now we’ve quickly moved on… I’m impressed.


#30

I don’t know if it would be in your scope or not, but perhaps you could trap these currently not implemented functions (sendNotificationEvent()) and throw a log, auto-convert them to a log.debug() or log.trace() (with an explanation of “Unsupported function…” or just ignore them so they don’t error out and kill apps while their being ported and before you’ve implemented them.


#31

I had the same thought. But, every request like this takes engineering resources to implement and test. So, rather than waste effort on that, we’d rather push what works forward faster. Now you know, no more mystery.


#33

Alright time for the next question…
It seems that there isn’t communication/variable sharing between child and parent app. This worked in ST but it doesn’t seem to be doing so here.

ie:
Parent App

state.appversion = "1.0.0"
def dothisthing(variable1,variable2,variable3){ 
     //The code to do stuff
}

Child App

log.debug "Parent Version: ${parent.state.appversion}"
//do some processing of things
def childvariable1 = "blah1"
def childvariable2 = "blah2"
def childvariable3 = "blah3"
//maybe even more processing of childish things
//send something to the parent function to process:
parent.dothisthing(childvariable1, childvariable2, childvariable3)

Scenario, in BigTalker2, I do most heavy logic in the child app, then once everything is set and ready to go, I call a function in the Parent app, parent.Talk(). It further processes the variables passed to it then does it’s speech thing.

  • Side note, I don’t think this is officially supported in the other hub, but it works. There is a lot of capability that can be derived from parent/child communication. The location object is even used for app to app communication in the other hub (I haven’t used this much except to send data to AskAlexa which is done by sendLocationEvent ( sendLocationEvent(name: "AskAlexaMsgQueue", value: "BigTalker", isStateChange: true, descriptionText: phrase) ), Perhaps Hubitat does these things differently or it can be considered for a future release?

#34

I’m not sure about isStateChange and descriptionText, but sendLocationEvent(name: “xx”, value: “yy”) definitely works.

So does passing parameters from child to parent and parent to child. Rule Machine does that extensively.


#35

I’m going mostly based off of the “null” references in the logs and the fact that calling parent.Talk() doesn’t seem to do anything from the child app to the parent app… If I use the TalkNow() feature which is a parent app only feature then Talk() works, but from the child app, parent.Talk() doesn’t.

2018-02-27 22:12:40.379:tracePARENTCHILDTEST(C2.0.2) || Initialized (Parent Version: null; Child Version: C2.0.2; Group Enabled: true)
2018-02-27 22:12:40.378:traceBIGTALKER2(P2.0.2) || [CHILD:Parent Child Test] Initialized (Parent Version: null; Child Version: C2.0.2; Group Enabled: true)
2018-02-27 22:12:40.312:tracePARENTCHILDTEST(C2.0.2) || Updating settings (Parent Version: null; Child Version: C2.0.2; Group Enabled: true)
2018-02-27 22:12:40.311:traceBIGTALKER2(P2.0.2) || [CHILD:Parent Child Test] Updating settings (Parent Version: null; Child Version: C2.0.2; Group Enabled: true)

#36

When I ported over a parent/child app (MiLight Manager) - I found that the variables were not what was expected…

for instance:

parent.settings.var1

was really:

parent.var1

It didn’t make any sense but it works.


#38

@rayzurbock - if sendNotificationEvent()isn’t implemented, can you add it as a call in your code for now, as a placeholder, and just outputs debug log messages?

Even without notifications and TTS, your app could be useful in the meanwhile to Hubitat using it with speech synthesis hardware.

Heck, I’d love to beta test Hubitat-compatible BigTalker 2 code just to send pre-recorded .mp3 messages on a DLNA speaker!


#39

@rayzurbock

Now that the latest Hub firmware supports Sonos devices any update on you porting over BT2?


#40

I have tested porting BT2 over and for the most part it worked, but works only in speechSynthesis mode (LANNouncer and other devices that process speech locally on the device). It doesn’t work in musicPlayer mode due to the lack of a textToSpeech() function in the Hubitat platform to translate text to mp3 that can be sent to your device (Sonos, etc) to play…


#41

TTS coming soon to a Hubitat near you.


#42

Music (or is that speech) to my ears! :slight_smile: