bbindreiter / node-red-contrib-alexa-remote2-applestrudel

Node-Red Nodes for interacting with Alexa
https://flows.nodered.org/node/node-red-contrib-alexa-remote2-applestrudel
MIT License
74 stars 20 forks source link

Alexa event node not firing reliably any more #130

Closed Mikee1234K closed 9 months ago

Mikee1234K commented 1 year ago

I am using the node-red-contrib-alexa-remote2-applestrudel palette 5.0.27. This has been working reliably for ages. Lately I noticed I had to say voice commands, which I intercept via the alexa event node and process in NR, I have to repeat multiple times before they trigger. I thought it was the usual alexa trouble. But after investigating a little, it seems there is a problem. My account is initialised, and the alexa event node says listening. So far so good. But quite often, when I say 'Alexa', it does not change to the green 'event fired' under the node. So then there is no output from that node. I can hear the custom Alexa response I have set in the Alexa app - routines, so she heard and understood it, but its not triggering the alexa event node. This is not all the time. If I try multiple times, eventually the event node fires, and triggers the flows.

GianZambo commented 1 year ago

Same problem here .....

richsimpson commented 1 year ago

I see the same, pity as was really well integrated into my home. Now unreliable.

dajuly20 commented 1 year ago

Is there anything in the issues of the depending libraries @bbindreiter ? Has anyone already clues what it could be? Were there changes in the API on the Amazon side? Anyone has it working (maybe with another system.. home assistant?)

I also had that pretty nicely integrated and now everything falls apart :'( Maybe it's time to implement another Voice to Text engine and throw Alexa out ;)

dajuly20 commented 1 year ago

And suddenly it just works again. WTF :D

bbindreiter commented 1 year ago

It happens from time to time that certain features stop working. Although this seemed to be a bigger outage than usual.

Unfortunately Alexa, the reverse engineered API we use and the node-red addon is a house of cards that can collapse any minute. Amazon can shut us down if they want to.

I personally don't use the event node anymore.

jonferreira commented 1 year ago

I've been experiencing this for the past week or so and I'm still using the old node-red-contrib-alexa-cakebaked

The node says it's "Listening" but never really listens for anything lol

Sounds like it may be something on Amazons API though?

Tinbum1 commented 1 year ago

I've been experiencing this for the past week or so and I'm still using the old node-red-contrib-alexa-cakebaked

The node says it's "Listening" but never really listens for anything lol

Sounds like it may be something on Amazons API though?

I'm getting the same issue with node-red-contrib-alexa-remote2-applestrudel.

I have to go into the node and redeploy and then it will work ok for a while. Is their a way to possibly 'reboot' the node automatically?

tomy-d commented 1 year ago

Same issue with the "listening" node - sometimes very slow or no response on starting events node-red-contrib-alexa-remote2-applestrudel palette 5.0.27

sometimes it helps to refresh the cookie or the athentikation...but not reliable... any news here?

bbindreiter commented 1 year ago

I've been triggering the alexa init node with option Initialise every hour for years now. Seems to work

msdigi commented 11 months ago

I've been triggering the alexa init node with option Initialise every hour for years now. Seems to work

I'm doing the same. But in the moment it doesn't help...

tomy-d commented 11 months ago

@1st initializing does not solve the issue and I think is this is the prize for getting these sollutions "for free". I think the main problem ist that someone (who has knowhow in coding....) should maintain the node according to chaches made (in this case) by Amazon on the Alexa "API". Sometimes it is just a small adaption makes the node run proberly again. (made this experience with other nodered nodes) I wish I had the know how to do this - but unfortunately i have not :( I think it would be a good idea to have something like a "pay" option for programmers to engage them to get nodes running properly again....

quadhammer commented 11 months ago

I'm getting the same issue with node-red-contrib-alexa-remote2-applestrudel.

Same here I have to go into the node and redeploy and then it will work ok for a while. Is their a way to possibly 'reboot' the node automatically?

When you say redeploy what do you mean? And are using the proxy method, or the cookie method?

quadhammer commented 11 months ago

I think it would be a good idea to have something like a "pay" option for programmers to engage them to get nodes running properly again....

I think that is a bit of a slight on the great programmers that work for things like node red, and home assistant. You're not going to suddenly get access to better programmers simply because of money. Unless Amazon releases their own version, and the chances of that are pretty much non-existent.

brunialti commented 11 months ago

As bbindreiter "does not use anymore event node" can he (or any other) suggest any alternative, if any, to capture the sentence Alexa understood ?

tjareson commented 11 months ago

The method I've used myself before was to set up an alexa routine which sets a simulated smart bulb (dimmable light) to a certain dimm level and then I just used this percentage to control things in node red. Which required a seperate routine for each command in the alexa app. The alexa event / on device activity had the big advantage that I could just summarize all commands for node red in one routine in the alexa app with different phrases, as what was said is handed over by the node directly and not only a dimm value.

Is there anything we can possibly provide to support debugging to get the event listener running again?

One more thing: I've also tried the Alexa Init node (never used that one before) but that doesn't make any change unfortunately. And another observation: if I used the "Alexa Other" node and set it to activities, I get indeed the last command I gave including the name of the alexa device it came from. The issue here is that one would need to poll that thing constantly. But it also means that the data is somehow still available, what happened.

sanjay900 commented 11 months ago

The method I've used myself before was to set up an alexa routine which sets a simulated smart bulb (dimmable light) to a certain dimm level and then I just used this percentage to control things in node red. Which required a seperate routine for each command in the alexa app. The alexa event / on device activity had the big advantage that I could just summarize all commands for node red in one routine in the alexa app with different phrases, as what was said is handed over by the node directly and not only a dimm value.

Is there anything we can possibly provide to support debugging to get the event listener running again?

One more thing: I've also tried the Alexa Init node (never used that one before) but that doesn't make any change unfortunately. And another observation: if I used the "Alexa Other" node and set it to activities, I get indeed the last command I gave including the name of the alexa device it came from. The issue here is that one would need to poll that thing constantly. But it also means that the data is somehow still available, what happened.

Thanks for pointing that out, that was enough for me to get my flows and scripts working, as i just linked the alexa other node to a button entity, and then in my scripts i have it push that button and then that gives me the name in the script as i used to use it.

quadhammer commented 11 months ago

Thanks for pointing that out, that was enough for me to get my flows and scripts working, as i just linked the alexa other node to a button entity, and then in my scripts i have it push that button and then that gives me the name in the script as i used to use it.

Does that work for devices with the same name, but in different rooms, eg. saying: "turn on lights" in 2 different places?

tjareson commented 11 months ago

Does that work for devices with the same name, but in different rooms, eg. saying: "turn on lights" in 2 different places?

Well, if it is just about the lights you would create 2 simulated (or real) lights and just group them with the respective alexa device in the alexa app. lights on/off is built in, so the echo would turn on/off all lights within the same group anyway, as set up in the alexa app.

For everything which is not a light, you can use either the "Alexa Other" node from applestrudel to get on which echo the last activity happened. So you would get from your simulated light bulb to the alexa other-node to determine where it was set from.

Or you can use this script which offers similar options, just directly in bash. Which I've used before I found the applestrudel implementation.

richsimpson commented 11 months ago

Never looked at the 'other' node. Just put one in my flow and tested and it does indeed bring through the summary (what she heard) and the name (the echo device). Are we saying this still works reliably even if the listener stops?

If that is the case, how can we go about using this in flows?

I have a couple of use cases that have become unreliable.

First one - Lamps On (or Off). With Room Aware Goal is to be able to say that command and it is picked up and passes through both the command and the device to operate the lamp in the relevant room.

Currently the Alexa Event node sends a payload to a sensor (called Last Alexa) to record the device in question. image

Then in Alexa Routines App, I have a routine for lamps. This will listen for various messages that might resemble turning the lamp on or off. "lamps on", "lamps off", lamp on", "lamp off" etc etc. That routine will toggle an artificial toggle switch.

The Switch (called Room Aware Lamp Toggle) is toggled and that will wait a moment, catch the "last alexa" from the sesnor created in the first part of the flow, and then pass on the message to toggle the lamp for that room. image

image

I have a similar routine for other items, like light scenes.

Second one, one off phrases, not room specific. I also have a routine in alexa that listens for items but does nothing with them. To avoid any alexa response.

EG I have one to turn my tv to CCTV input. "Alexa show cameras". What happens is the routine fires nothing. but because it is a routine, it doesnt bong and say not known, unrecognised or whatever... Node Red flow hears it via the Event node, takes the "msg.payload.description.summary" and if it is a recognised command, in a list, it passes through to an action. image

image

image

So this other node, how would that be best used?

Mikee1234K commented 11 months ago

I have done a little testing with the Alexa other node. Even when the listening node doesnt react, when I trigger the alexa other node with a inject, it shows me the voice command and the alexa device the command came from. Very useful. I thought I could trigger the alexa other node with a input from the listening node. Unfortunately that doesnt work, as the listening node does not send anything when it doesnt want to listen. So we need to find another way. I thought of injecting the other node every few seconds. Problem is, its still showing the last command, not a blank. So that would trigger a possible event time and time again with every inject. So what we need is a reliable trigger, which injects the other node to then process the data from the other node. Still thinking about it, if I have an idea I'll post it in this thread

Mikee1234K commented 11 months ago

I think I might have an idea. I use Homeseer as my home automation system, but it might work with other systems too. I will create a virtual switch in Homeseer. All routines will then trigger the switch (turn it on). This I can pick up in Node Red, to inject the other node. After triggering, I can turn the virtual switch off again, ready for the next time a routine gets triggered. That could work... will test when I have a little time on my hand

tjareson commented 11 months ago

So, I think I found a way to replace it for my scenario: The issue with the "other"-node is, that it needs a trigger to poll the last activity and echo which was addressed. So, the solution is quite easy actually. Like @richsimpson so far I also had one routine with all possible phrases in it, which did nothing, just to keep alexa quiet and check the command via the event node myself. Now: I keep it excatly like this, just that I replace the event node with the "other"-node and let this node trigger by a simulated light bulb. In the routine with all my phrases I just switch that light bulb always off. That fires then an event to the "other" node with "Get activities". Even the object which comes back is similar, only difference is that it is an array, so command and echo device is in: msg.payload[0].description.summary and msg.payload[0].name

I also have the impression that this works much faster, as not even the sound finishes and the response comes already.

tjareson commented 11 months ago

I have adjusted my flows now to the setup as described before. Somehow the combination of a simulated light bulb and the "other" node acts quite a bit faster than the event listener node alone. For the light bulb simulation I'm using "node-red-contrib-alexa-home" - does anyone know if that can be also covered with applestrudel? I didn't find a node simulating a light bulb there.

So it looks to me that the only reason why the event node is not working anymore (at least related to the activities) is a missing trigger, as the information as such is available for polling. Not sure, if that could be a hint how to repair this node? With only one node instead of the light bulb trigger workaround it would be a bit more elegant and easier to understand. ;-)

Mikee1234K commented 11 months ago

I think I might have an idea. I use Homeseer as my home automation system, but it might work with other systems too. I will create a virtual switch in Homeseer. All routines will then trigger the switch (turn it on). This I can pick up in Node Red, to inject the other node. After triggering, I can turn the virtual switch off again, ready for the next time a routine gets triggered. That could work... will test when I have a little time on my hand

Have been testing this, and it works really well, similar to @tjareson setup. The only slight niggle I have, I think as I am setting a smart home device, Alexa says OK every time a routine gets triggered. Thats ok, with the exception some actions trigger a Alexa voice response reporting temperatures or other stuff back to me. So she would for example say OK - your westerstation is reporting a temperature of... I cannot (so far) suppress that OK.

tjareson commented 11 months ago

Alexa says OK every time a routine gets triggered.

That's strange, I don't have that behaviour. Does it also happen with all other commands? Maybe it is a setup within the alexa app? I've set Voice Responses to "Brief Mode".

Mikee1234K commented 11 months ago

Alexa says OK every time a routine gets triggered.

That's strange, I don't have that behaviour. Does it also happen with all other commands? Maybe it is a setup within the alexa app? I've set Voice Responses to "Brief Mode".

I dont know if I have set her to brief mode, and normally I like the OK as confirmation that she has got the command. I have tested, and unless I have set a custom response in the Alexa app, she will always say OK. Unfortunately I cannot set a blank custom response.

richsimpson commented 11 months ago

I have adjusted my flows now to the setup as described before. Somehow the combination of a simulated light bulb and the "other" node acts quite a bit faster than the event listener node alone. For the light bulb simulation I'm using "node-red-contrib-alexa-home" - does anyone know if that can be also covered with applestrudel? I didn't find a node simulating a light bulb there.

So it looks to me that the only reason why the event node is not working anymore (at least related to the activities) is a missing trigger, as the information as such is available for polling. Not sure, if that could be a hint how to repair this node? With only one node instead of the light bulb trigger workaround it would be a bit more elegant and easier to understand. ;-)

I have done similar but took the opportunity to alter a few things too.

So I now have a few specific app routines setup. "Room Aware Lamp", "Room Aware Scene" etc. Plus a "Room Aware General".

They each flow onto a separate part of the node red page, each will then hit the 'other' node to get the summary and the room calling it. Before doing the action.

The "Room Aware General" routine is essentially a list of things to ignore on the echos. Any will trigger the artificial toggle for "Room Aware Generic" which runs to another section and the summary of the command is extracted, matched against a list of commands and then triggers an event.. The event goes on to trigger the action.

One of my generic items is Show Cameras. That is simple and just turns my TV to the CCTV HDMI input. Another is to Reboot Chloe Internet and is more complex. That deals with an intermittent WiFi issue I have, and will run a different flow which goes through turning WiFI off and then on for each device in turn, leaving time between each on/off command. The possibilities are endless.

I only use events on some items as the same flow/routine is triggered from different sources. So QR codes or tags being scanned, or even responses to questions asked by an Alexa routine.

sanjay900 commented 11 months ago

Thanks for pointing that out, that was enough for me to get my flows and scripts working, as i just linked the alexa other node to a button entity, and then in my scripts i have it push that button and then that gives me the name in the script as i used to use it.

Does that work for devices with the same name, but in different rooms, eg. saying: "turn on lights" in 2 different places?

What im using it for at the moment, is i say "Turn on the TV" and if im near my lounge alexa, then it pulls the name from that and turns the tv on on the lounge, while if the alexa in the bedroom hears it, then the bedroom tv turns on.

richsimpson commented 11 months ago

Happy with the results of using the 'other' node. After fixing various things in my flows I have been seeing reliable performance. Bit of work to update stuff, but always enjoyable to tinker and improve stuff.

I now have: Routines for: LAMPS (on , off) - detects the echo/room called and changes lamp in that room. SCENES (activates room scene) - detect the echo/room called and works for that room. HEATING (warmer/cooler/boost/set temperature/set mode) - detects the echo/room called and works for the TRV in that room. GENERAL (any magic words I add to that generic/ignore routine. show cameras, show sky, reboot internet, boost hot water) - control any individual event/scene/routine that I want. Input is from the Alexa hub/Nodes which is how I publish my devices to Amazon Echo. image

From that the, output of the hub can go off to the individual devices. image

But also the output from the echo commands lands in the specific artificial devices set up ( Room Aware Lamp Toggle and so on). At that point I complete a sensor used elsewhere in Home Assistant for both the Last Device called (from one of my magic phrases, not for general use) and the summary of what was called. image

Each of the different types of commands will send out put to an individual section where I handle the command and convert to an event. Eg toggle the lamp. Where an on or off command simply toggles the lamp. On the assumption that if you are in the room and lamp is on, you would only ask if you want it off. But in reality and alexa lamp on or an alexa lamp off would just toggle it. Saying alexa lamp off over again would just turn lamp on then off repeatedly.

image

quadhammer commented 11 months ago

it is slightly quicker using the 'other' node, because before it would have to parse the sentence, but this way it is just turning on a light: a light name which it expects.

~~One problem I have found though, is that if you use a custom response, it doesn't seem to cause a trigger with activity. ~~

For instance, when I say turn oven on, I have a response that says. ' turning on rumpus room air-conditioning to oven', but the 'other' node isn't picking that up.

I found a way around it, if you use the routines in the Alexa app, rather than the My Questions skill to generate a response, you can flip a virtual switch in node red, as above.

and I have to use a custom response, because otherwise it complains that it can't find a smart cooking appliance.

Edit: another problem seems to be that if you say the wake word, and then pause, before issuing a command, the only event that is triggered is 'wake word only'. The old one used to send both events.

Never mind, for some reason in the old flow I had a message limiter to one message every 2 seconds, but removing that allows the proper payload to come through, even with a pause. I can't even remember why I had the limiter there in the first place! :-)

looks like I spoke too soon, sometimes only the 'wake word only' is sent, unfortunately.

Tinbum1 commented 11 months ago

I've just updated to 5.0.34 and it's started working ok- not sure if that's just a coincidence!

github-actions[bot] commented 10 months ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 9 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.

richsimpson commented 8 months ago

@Mikee1234K @tjareson

As you have been using the alexa other/activities to identify the device called, are you currently seeing any issues, just opened an issue I have with it. Had been rock solid since our August exchanges ... https://github.com/bbindreiter/node-red-contrib-alexa-remote2-applestrudel/issues/156