Is there a way to parse variables that capture message data from one automation to another automation so it can be used by the above trigger or some other way to do this efficiently?
Passing data to automations is not possible, other than creating sensors that act as global variables. Unless you want to run automations by hnd, which is not advised.
But I think what you mean is pass variables to a script. Automations are meant to be started by events, scrips are meant to be called by you (from automations, other scripts, UI, etc).
Passing data to scripts is possible. An example from my config, when calling:
@Edwin_D thank you for your response. It’s good to see what options I can use. Can I then use the data in the script to parse into another automation? So run your script in automation 1 then grab the variables that are in the script and trigger automation 2. It doesn’t seem like I can?
@Sir_Goodenough thank you for the suggestion. I wonder if maybe I should merge automation 1 and automation 2 and use trigger_id to deal with the response that way I can deal with the data/ utilise the variable(s) to announce message data to the "assist satellite announcer, within the one single automation.
Not all together ideal, it could get rather large.
Regarding helpers I am not sure how to use them, if for example I have an action with data in it of type message?
How do I use the helper to get the message to my other automation to trigger it as a sentence, of course I will need to manipulate the message string to have Announce or Notify to trigger the automation. And use it to announce the message.
Yes, a script can return a result as well, so you can use the script to do some calculation. This post covers returning some data from the script.
But on second hand, if it is about doing some calculation using jinja, macro’s might be the easiest way. They were introduced some time ago. You can put them in a separate file and include them when you need them:
Thank you again for your input. After a lot of pondering regarding this, I will ask the question in a different way after understanding the above options so far.
Is there an easy way to get:
Data such as
Data:
Message: asdghbjknvfxghfd
Take this as is or via a variable that’s been manipulated via regex and “pipe” it to assist as text? So It can then trigger according to sentence triggers in any automation I may have. I can type in an assist dialogue box or say a sentence directly but can data be “piped” to assist as such, unless there is a way and I am unaware of it?
Perhaps I am trying to be lazy and efficient for my self but not computationally here, an the best thing to do is to add an assist satellite announcer for each message that I want announced. Even though I have an “Announce” automation.
I don not quite understand what you mean. Sentence triggers are triggered by the voice integration, not by another automation. .Do you mean to invoke the sentence event yourself as if you were the voice integration, thereby triggering other automations with a sentence trigger?
Or do you want automations that were triggered by a sentence to do some other common thing (for instance use the sentence to create a notification by applying a regex?
As I was trying to say: “running” another automation is not an advised way to work, because automtions are meant to be started by the triggers inside them. Running them makes things confusing, because that means none of the triggers fired. Tht is why scripts are there. You can run them. they do things, but they do not have triggers of their own.
Yes this is closer to what I would like to do. I don’t know if the assist dialogue box is deemed the voice integration, but as I can simply type the sentence in the dialogue box without using my voice and get a response or action via triggers in any relevant automation. The “assist Satellite announcer” is just an example.
The current solutions just seem a bit too convuluted (Just like my descriptions of the problem I would like to solve ) for what I want to achieve, apart from adding each action again to announce the same notification action message above it through “assist satellite” announcer (as one example) lots of duplication IMHO.
Now I can trigger from one automation to another, via the “conversation.process” action:
action: conversation.process
metadata: {}
data:
text: announce, This is a test from the speech to text engine
agent_id: conversation.home_assistant
I tested the above in an automation, ran it and it triggered my other automation (snippet in original post in this topic) to run actions to the assist satellites and any other messages to any device I want to include.
I now can stick any variables in the text attribute (not tested but should work). Nice simple and efficient. This functions like “Alexa Announce or Alexa Broadcast” that I wanted HA voice PE and other HA media players/ devices to replace, and with this feature (action) it’s better as I can run it via an automation, that I am about to arrive home, have arrived and endless other messages that I not longer have to duplicate in and across automations.