Announcement

Collapse
No announcement yet.

One Node for TTS

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ksum
    replied
    What about a virtual device with status values of things such as "Wake the Teenager." and "Announce the clothes are dry." When that device changes, a flow is triggered. For the first, as long as the door sensor is closed it sends the announcement. This puts all of your text and TTS speaker items in Node-RED, but uses HomeSeer to determine when they run. I use HomeSeer events whenever possible and I also use HomeSeer as the central brain/point of knowledge of all automated settings. But if I end up going to something such as Node-RED, I try to minimize complexities. Maybe moving parts to Node-RED does this? It did mean a more complex flow, but does it ultimately simplify things and make it easier to follow? That is up to you to determine. I'm just offering a different view.

    Leave a comment:


  • jmhitchcock
    replied
    Thank Karl!

    In general, I’m not manually triggering the event. The event in my earlier post was just for testing purposes. I use the TTS in several events that are not manually triggered. For example, if our teenager hasn’t opened their door by a certain time then alexa say “the time is X:XX get up” every minute until the door is opened.

    i don’t doubt a lot of this would be better in node red, but I’m still in the mindset that HomeSeer is the “brains” of the house and Node Red, Homebridge, etc are tools for extending node reds capability.

    Leave a comment:


  • ksum
    replied
    Why not do it all with Node-RED then? Skip the HomeSeer Event and Virtual Device all together. Since you are apparently manually triggering the Event, can you have a Node-RED flow start based on the same thing which triggers the HomeSeer Event? I imagine something in HomeSeer initially triggers the Event. Use that same item to trigger the flow and branch based on your needs.

    OR keep what you have with the Virtual Device. Then use a Change node to set the Device and spoken strings as shown below. (this is not tested) The two JSONata items are:
    $substringBefore(HomeSeerPayload.status,'|')
    '[' & $substringAfter(HomeSeerPayload.status, '|') & ']'

    Click image for larger version

Name:	HS1.png
Views:	197
Size:	28.3 KB
ID:	1527361


    With this, we have set your spoken string AND the device you send the text to, so you should be able go straight to the Alexa Routine Speak node. Again, untestyed, but this does mean you just need the initial HomeSeer Device node, the change node above, and the Alexa Speak node.

    Also, if you do use a Virtual Device, there is NO NEED to set the string back to a known "do not speak me" string. Just check the Virtual Device setting for Last Change Time Updates on Status Change Only and the trigger if the value is actually changed.

    If it were me, I would be looking at my first suggestion of dropping much of this out of HomeSeer and doing it in Node-RED.

    Karl

    Leave a comment:


  • jmhitchcock
    replied
    Originally posted by ksum View Post
    How would you like your room and messages to be determined? What would you like to trigger these? Doing all of the message in Node-RED could be possible, but depends on what the message would be and how we determine such. For instance, if a light turns on, do you want to announce that? The same sentence can be sent, replacing the light name as needed for different lights. Or something more complicated is possible. Also, how would you determine which Alexa to send the message to? Programmatically putting the message together and determining the room(s) to send it to are possible with Node-RED.

    Also, which Alexa contrib are you using?
    I'm using node-red-contrib-alexa-remote2-applestrudel. I was having issues with the original alexa remote and switched a while back.

    I am using the virtual devices I had to send custom messages as part of events. If I wanted to tell my daughter to get up in the morning, I would set the string virtual device for her Echo to speak the message in her room. Rather than having a virtual TTS device for each echo, I wanted to have a single Virtual TTS device where I specify the echo and the message.

    Currently, I was able solve it by creating a single virtual device and setting the string to be AlexaName|Message as shown below.
    Click image for larger version

Name:	hsEvent.png
Views:	215
Size:	16.9 KB
ID:	1527350


    Then I created the flow as below:
    Click image for larger version

Name:	ttsFlow.png
Views:	139
Size:	44.9 KB
ID:	1527351


    The first switch checks if the HomeSeer device string is X, the expected format or unknown. If the device string is X the flow ends, if it is the expected format the flow continues, and logs the payload if it is not the expect format.

    When the flow continues, the change node uses regular expressions to extract the Alexa name and the message from the device string.

    The next switch uses the device name to set the device id of the Alexa to speak on.

    The routine speak then speaks the extracted message on the Alexa corresponding to the device id.

    The steps after the delay node are use to reset the device string to x. If the device string is not X, I wait 5 seconds, the clear payload, and passes the required information on to the HomeSeer node to reset the string to X (This step may not be needed, but I saw issues in other posts where Alexa didn't always speak if the string didn't change.)


    The portion of the flow above I would like to eliminate is using regular expressions to parse the device string. The only option I could think of is having two devices (one for the device name, and one for the message to speak), but I didn't see a way to make the flow work with two devices.

    Leave a comment:


  • ksum
    replied
    How would you like your room and messages to be determined? What would you like to trigger these? Doing all of the message in Node-RED could be possible, but depends on what the message would be and how we determine such. For instance, if a light turns on, do you want to announce that? The same sentence can be sent, replacing the light name as needed for different lights. Or something more complicated is possible. Also, how would you determine which Alexa to send the message to? Programmatically putting the message together and determining the room(s) to send it to are possible with Node-RED.

    Also, which Alexa contrib are you using?

    Leave a comment:


  • jmhitchcock
    started a topic One Node for TTS

    One Node for TTS

    I've followed to instructions to control Alexa from HomeSeer and it works great. I have created devices for TTS, changing the Alexa volume, and playing music. My only complaint is for each Alexa I have to have a virtual device for each Aexa function per Alexa. In a perfect world, I would like to have one TTS virtual device that would send the text to speak and which device to speak it on to NR

    I did a little exploring and I can set the virtual device string to <room>|<message>, and then use NR to extract room and message. Does anyone else have a more elegant solution to funnel all TTS requests through a single virtual device?
Working...
X