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

Events are not firing again for several people #142

Closed cymplecy closed 10 months ago

cymplecy commented 12 months ago

https://discourse.nodered.org/t/alexa-on-device-activity-not-working/80901/1

cymplecy commented 10 months ago

OK - so I noticed that the Alexa nodes get re-initialised when you do a Full deploy so I restarted NR and checked all working for 5 mins and then I used pressed on a timestamp inject node than I've got connected to the init node and it failed a minute later.

sccsltd commented 10 months ago

@cymplecy is your simon says just sending text to speech to the device?

to clarify on mine all my voice prompts triggered by HA all continue to work. (doors opening/closing, doorbell ...) all fire in HA and alexa speaks the commands fine, looks like i can also see the volume changes on the drvices ok as well.

the only thing that fails for me is when i initiate the speech commands, these dont get picked up.

cymplecy commented 10 months ago

"to clarify on mine all my voice prompts triggered by HA all continue to work. (doors opening/closing, doorbell ...) all fire in HA and alexa speaks the commands fine, looks like i can also see the volume changes on the drvices ok as well."

Yes - its just the listening for spoken events that is problematic - all else works

" is your simon says just sending text to speech to the device?" - I've got another Pi connected to a speaker that's next to an Echo and that runs my "simon says" counting up

When everthing working - it can count up to 40 (4 per minute) and all are picked up by the NR On Device Activity node

When it goes into failure mode its approximately one minute of working - one minute of not working

So, at this present time, I'm saying that if I restart Node-RED and it only initialises once, then it seems to work reliably.

But if re-initialises (either by direct inject into the node or due to it being redeployed - then it goes into the intermittant mode

So, now I've got all the Alexa nodes on it's own Pi with only one flow tab and I've locked it so I don't accidently change it.

I'll see what happens - I'll run my test routine every now and again just to make sure it works (just done another 10 minute run - all fine)

sccsltd commented 10 months ago

That's what I thought just wanted to make sure I was explaining my self tidy.

I have restarted my node red and am no longer getting the http2-push close errors as yet, will see how long it takes to break.

GianZambo commented 10 months ago

@cymplecy

It could be a link between this two issues?

https://github.com/node-red/node-red/issues/4370

cymplecy commented 10 months ago

I wouldn't know but suspect not as that's a crash report as opposed to the intermittent failures that we are seeing

sccsltd commented 10 months ago

Still working ok here, restarted node-red and haven't touched it since, just periodically checking voice responses are picked up. ill give it another 15 then if its still running ill redeploy and see if it breaks

also i do have a flow to init and auth that runs once an hour,

[{"id":"443b92d6.132dfc","type":"inject","z":"e8bd56f8f70ccb15","g":"b6c11feb.c1f0a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"3600","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"Started!","payloadType":"str","x":1700,"y":140,"wires":[["6313cbe4.e7fc64"]]},{"id":"6313cbe4.e7fc64","type":"change","z":"e8bd56f8f70ccb15","g":"b6c11feb.c1f0a","name":"set","rules":[{"t":"set","p":"payload","pt":"msg","to":"alexa","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":1870,"y":140,"wires":[["6c43f2b4.15104c"]]},{"id":"6c43f2b4.15104c","type":"alexa-remote-init","z":"e8bd56f8f70ccb15","g":"b6c11feb.c1f0a","name":"","account":"20c7ba7a0decab30","option":"initialise","x":2060,"y":140,"wires":[["9439aeae7a79b3fd"]]},{"id":"20c7ba7a0decab30","type":"alexa-remote-account","name":"Main","authMethod":"proxy","proxyOwnIp":"192.168.0.156","proxyPort":"34567","cookieFile":"Authnew","refreshInterval":"1","alexaServiceHost":"alexa.amazon.co.uk","pushDispatchHost":"","amazonPage":"amazon.co.uk","acceptLanguage":"en-UK","onKeywordInLanguage":"","userAgent":"","usePushConnection":"on","autoInit":"off"}]

i found it somewhere as a solution to having to reauth manually a while ago, don't know of this is the best way or the right way but its been working fine so don't think its impacting but just incase.

just had a failure..... but then it started working again..

1 Oct 13:36:52 - [debug] [alexa-remote-account:Main] Alexa-Remote HTTP2-PUSH: Close: undefined: undefined
1 Oct 13:36:52 - [debug] [alexa-remote-account:Main] Alexa-Remote HTTP2-PUSH: Retry Connection in 20s
1 Oct 13:37:06 - [debug] [alexa-remote-account:Main] Alexa-Remote: No authentication check needed (time elapsed 567062)
1 Oct 13:37:12 - [debug] [alexa-remote-account:Main] Alexa-Remote: Update access token ...
1 Oct 13:37:12 - [debug] [alexa-remote-account:Main] Alexa-Remote HTTP2-PUSH: Use host bob-dispatch-prod-eu.amazon.com
1 Oct 13:37:13 - [debug] [alexa-remote-account:Main] Alexa-Remote HTTP2-PUSH: Initialization completed
1 Oct 13:38:38 - [debug] [alexa-remote-account:Main] Alexa-Remote: Update access token ...
1 Oct 13:38:38 - [debug] [alexa-remote-account:Main] Alexa-Remote HTTP2-PUSH: Use host bob-dispatch-prod-eu.amazon.com
1 Oct 13:38:38 - [debug] [alexa-remote-account:Main] Alexa-Remote HTTP2-PUSH: Initialization completed
1 Oct 13:41:33 - [debug] [alexa-remote-account:Main] Alexa-Remote: Update access token ...
1 Oct 13:41:33 - [debug] [alexa-remote-account:Main] Alexa-Remote HTTP2-PUSH: Use host bob-dispatch-prod-eu.amazon.com
1 Oct 13:41:33 - [debug] [alexa-remote-account:Main] Alexa-Remote HTTP2-PUSH: Initialization completed

(edit again) I think we are getting closer.. had an undefined close immediately after i redeployed, which stopped it working, then it updated the token and we are back..


1 Oct 13:51:10 - [debug] [server:Hassio] HA State: running
1 Oct 13:51:10 - [debug] [server:Home Assistant] HA State: running
1 Oct 13:51:21 - [debug] Flushing localfilesystem context scope e8bd56f8f70ccb15
1 Oct 13:51:21 - [debug] Flushing localfilesystem context scope global
1 Oct 13:51:22 - [debug] [alexa-remote-account:Main] Alexa-Remote HTTP2-PUSH: Close: undefined: undefined
1 Oct 13:51:22 - [debug] [alexa-remote-account:Main] Alexa-Remote HTTP2-PUSH: Retry Connection in 1s
1 Oct 13:51:23 - [debug] [alexa-remote-account:Main] Alexa-Remote: Update access token ...
1 Oct 13:51:23 - [debug] [alexa-remote-account:Main] Alexa-Remote HTTP2-PUSH: Use host bob-dispatch-prod-eu.amazon.com
1 Oct 13:51:23 - [debug] [alexa-remote-account:Main] Alexa-Remote HTTP2-PUSH: Initialization completed
1 Oct 13:52:24 - [debug] [alexa-remote-account:Main] Alexa-Remote: Update access token ...
1 Oct 13:52:24 - [debug] [alexa-remote-account:Main] Alexa-Remote HTTP2-PUSH: Use host bob-dispatch-prod-eu.amazon.com
1 Oct 13:52:24 - [debug] [alexa-remote-account:Main] Alexa-Remote HTTP2-PUSH: Initialization completed```
GianZambo commented 10 months ago

I read in the previous post ..

1 Oct 13:51:22 - [debug] [alexa-remote-account:Main] Alexa-Remote HTTP2-PUSH: Close: undefined: undefined

and @knolleary write "we don't support HTTP2 "

Excuse me, but I don't understand .....

spants commented 10 months ago

Nick is saying its not a node red issue, that's all.

DanPatten commented 10 months ago

I think the problem may be not shutting down previously open Alexa-remote2 http2 connections which is why it works initially until you deploy the node again.

sccsltd commented 10 months ago

ok so its been over an hour now and i still have functionality, im still seeing the undefined close but less often and it seems to be self recovering from them.

1 Oct 15:20:10 - [debug] [alexa-remote-account:Main] Alexa-Remote HTTP2-PUSH: Close: undefined: undefined
1 Oct 15:20:10 - [debug] [alexa-remote-account:Main] Alexa-Remote HTTP2-PUSH: Retry Connection in 60s
1 Oct 15:20:52 - [debug] [alexa-remote-account:Main] Alexa-Remote HTTP2-PUSH: Close: undefined: undefined
1 Oct 15:20:52 - [debug] [alexa-remote-account:Main] Alexa-Remote HTTP2-PUSH: Retry Connection in 60s
1 Oct 15:21:10 - [debug] [alexa-remote-account:Main] Alexa-Remote: Update access token ...
1 Oct 15:21:10 - [debug] [alexa-remote-account:Main] Alexa-Remote HTTP2-PUSH: Use host bob-dispatch-prod-eu.amazon.com
1 Oct 15:21:11 - [debug] [alexa-remote-account:Main] Alexa-Remote HTTP2-PUSH: Initialization completed

It looks as if retry isnt working correctly but the update token is fixing it? i have added some extra logging where i think its getting stuck will see what the logs say

sccsltd commented 10 months ago

still working fine with the last changed made by @DanPatten,

i removed my auto init/authenticate flow as that was triggering the initialize on each boot / redeploy and every hour, dont know if it had any effect but i see no ill effect in the changes my side.,

cymplecy commented 10 months ago

Updated to v5.0.43 - no change as far as I can tell

If the Init node is re-initilised, then within two minutes, the events stop being received (and then cycle on/off every few minutes)

Now - if we stop re-initialising, then we won't invoke the poor behaviour and we'd be alright

unfortunately, exactly the same behaviour is triggered if you do a Full deploy :(

That can be avoided as well but a lot of NR users will leave their installation in default Full deployment setting and will get hit by the issue

This shows my test logs showing the missing gaps

21:04:34.176_alexa_PI1881_activity = simon says one
21:04:46.763_alexa_PI1881_activity = simon says two
21:05:02.239_alexa_PI1881_activity = simon says three
21:05:16.887_alexa_PI1881_activity = simon says four
21:05:31.910_alexa_PI1881_activity = simon says five
21:05:47.039_alexa_PI1881_activity = simon says six
21:06:01.938_alexa_PI1881_activity = simon says seven
21:06:16.953_alexa_PI1881_activity = simon says eight
21:06:32.043_alexa_PI1881_activity = simon says nine
21:06:46.762_alexa_PI1881_activity = simon says ten
21:07:02.040_alexa_PI1881_activity = simon says eleven
missed 12,13,14 &15
21:08:17.079_alexa_PI1881_activity = simon says sixteen
21:08:32.745_alexa_PI1881_activity = simon says seventeen
21:08:47.028_alexa_PI1881_activity = simon says eighteen
21:09:02.173_alexa_PI1881_activity = simon says nineteen
21:09:17.292_alexa_PI1881_activity = simon says twenty
then missed 21,22,23 and 24
21:10:32.667_alexa_PI1881_activity = simon says twenty five
21:10:47.449_alexa_PI1881_activity = simon says twenty six
21:11:02.603_alexa_PI1881_activity = simon says twenty seven

So, AFAICT to avoid the issue, you have to:

  1. make sure you set the initialise node to auto init and never re-initialise it during a session
  2. Set deployment mode to modified nodes only and not edit the initialise node during a session
DanPatten commented 10 months ago

@cymplecy Those two steps is exactly how I have mine setup so it makes sense why mine works. Basically need to shutdown any existing connections when calling init and that does not appear to be happening. The intermittently comes from having 2 open connections to Amazon open which causes events to not get received because the event is fired by the wrong listener.

obaldius commented 10 months ago

I did manually initialize and I'm getting this:

image

Can anybody help please?

cymplecy commented 10 months ago

At the moment , don't manually initialise - just use auto init

[image: image.png]

On Wed, 4 Oct 2023 at 09:07, obaldius @.***> wrote:

I did manually initialize and I'm getting this:

[image: image] https://user-images.githubusercontent.com/61756214/272505355-61195692-120d-4e39-aae4-6a125cf2b09d.png

— Reply to this email directly, view it on GitHub https://github.com/bbindreiter/node-red-contrib-alexa-remote2-applestrudel/issues/142#issuecomment-1746354172, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR7RND7MGYGJVLMZDW62RDX5UKMRAVCNFSM6AAAAAA4ESII4KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBWGM2TIMJXGI . You are receiving this because you were mentioned.Message ID: <bbindreiter/node-red-contrib-alexa-remote2-applestrudel/issues/142/1746354172 @github.com>

tomy-d commented 10 months ago

@obaldius: try to turn "Events" to "on" in the configuration note > "off" causes the error message....

@cymplecy: 2 questions:

if the problem occurs - how can I "reset" to working mode - any idea/hint? Auto init means that I only turn the aut init "on in the configuration node right?!

Thank you!

cymplecy commented 10 months ago

@tomy-d The answer used to be to restart Node-RED. (And yes to the auto-init question) But a new problem has arisen yesterday (12Oct2023) that cannot be cured by simply doing this https://github.com/bbindreiter/node-red-contrib-alexa-remote2-applestrudel/issues/152

obaldius commented 10 months ago

@tomy-d thanks I did that and it worked or a couple of days but as @cymplecy pointed out, there's something else going on sine yesterday... I guess we'll have to wait.

Apollon77 commented 10 months ago

Amazon stopped sending "Activity" push notifications ... but also the alexa app is not getting them ... sooo lets see if it is an error or wanted

brunialti commented 10 months ago

+1

Apollon77 commented 10 months ago

Ok guys, @bbindreiter released 5.0.45 of the node with a new version of the library: It should bring back the activity event like before ... I added some workarounds that try to detect activities also without the proper events.

Please make sure to DISABLE all manual activity/history triggering you added as woraround yourself

I hope it works.

Ingo

PS: Donations always welcome ;-))

tomy-d commented 10 months ago

@Apollon77 It works again! Thank you man! Good Job :)

stephennutt commented 10 months ago

I updated the pallete, restarted Node Red, deleted old Listening Node and added a new one, and even rebooted the RPi hosting Node Red and nothing shows in the Debug Node attached to Listening Node. I never did any of the workarounds; just patiently waited for the fix. Events is On in the Config node. Any other suggestions to try?

cymplecy commented 10 months ago

Was your palette showing 5.0.45 - mine wasn't at first Check installed version number

PaytonPeterson commented 10 months ago

Ok guys, @bbindreiter released 5.0.45 of the node with a new version of the library: It should bring back the activity event like before ... I added some workarounds that try to detect activities also without the proper events.

Please make sure to DISABLE all manual activity/history triggering you added as woraround yourself

This fixed things for me! Just updated to 5.0.45 in NodeRed - rebooted, and all my events started working again! Wow, big thank you @Apollon77 + @bbindreiter!

Apollon77 commented 10 months ago

I released an update to my lib with improvements and optimizations. That should fix cases where it stayed empty.

bbindreiter commented 10 months ago

I released an update to my lib with improvements and optimizations. That should fix cases where it stayed empty.

Nice, 5.0.46 released.

bbindreiter commented 10 months ago

I will close this issue now, let's continue here: https://github.com/bbindreiter/node-red-contrib-alexa-remote2-applestrudel/issues/152