Closed BassTeQ closed 5 years ago
Hi you can actually do it in two ways. Either lopping and sending the Alexa device name, else you connect a function node to multiple device
Could you share a screenshot of such examples?
Thanks
On Tue, 4 Jun. 2019, 18:30 ThomasPoett, notifications@github.com wrote:
Hi you can actually do it in two ways. Either lopping and sending the Alexa device name, else you connect a function node to multiple device
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/586837r/node-red-contrib-alexa-remote2/issues/20?email_source=notifications&email_token=AHZN53PXMCHS5AO6BBKNDEDPYYR2ZA5CNFSM4HSYWXNKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODW32RLY#issuecomment-498575535, or mute the thread https://github.com/notifications/unsubscribe-auth/AHZN53JUU45IVGD727QEQZLPYYR2ZANCNFSM4HSYWXNA .
@BassTeQ I'm using this node to resend the msg. https://flows.nodered.org/node/node-red-contrib-msg-resend
Then a switch node with msg.count, so 1 goes to bedroom, 2 goes to kitchen, 3 goes study,
I think that's the easiest way. A function node does similar but this way uses less code.
Thanks @NovaGL will give this a try!
sure it could look like this
Every time I deploy my flow I have to re-authenticate, is this expected behaviour?
I have that too. Store a cookie in a file that way it won't re-authenticate it will just use the cookie.
I'm using a init node and it seems to work.
@NovaGL , this is what I have at the moment, have I missed something? Using an sequence for each device, should I be using an init node instead?
I've noticed the cookie directory I've specified 'C:\temp\node-red' is empty
Thanks
Your problem is file path is a file not a folder.
do you run node-red on windows? if not and its raspi, use the Linux notation. but I still have an issue with (cannot authenticate) with proxy. still figuring out whats going on
@ThomasPoett I'm using a Pi2. What happens when you try to authenticate, connect it to a debug node and does it have output
@NovaGL Thanks, I've changed it to C:\temp\node-red\cookie.txt and its working now :) Is there any benefit to using an 'init' node? Do I also need to have a flow that does a cookie refresh? If so how would this be done?
@ThomasPoett , yes I'm running on windows.
Cookie refresh is done in the init node using a payload of refresh.
So I guess that answers both your questions :)
@ThomasPoett I'm using a Pi2. What happens when you try to authenticate, connect it to a debug node and does it have output
its the message of cookie file doesn't exitis, I guess this is a wrong path with my PI3
Cookie refresh is done in the init node using a payload of refresh.
So I guess that answers both your questions :)
Thanks @NovaGL , are you able to share a screenshot? Does this look correct? How often does this node need to be invoked to refresh the cookie? Once per week?
Looks right to me. I would try 48hrs not sure how long the cookie lasts
the cookie lasts approx. 8 days. but sure refresh every 24hrs and trace the response can be help full. I'll trace the response every 24 hrs and write it to dashboard
Any idea why I'm getting this "no JSON" error appearing? The payload is coming from an MQTT Topic, I'm setting it to "this is a test" Thanks
Has the cookie expired?
No, if I re-deploy the flow, it goes to a "ready" state.
So other commands, like get devices work?
I've not used that one before, will add it.
Yes get devices works fine
Things seem to be working ok for the time being, will monitor.
Do you know if its possible to get the current volume from a device? I'd like to set the volume, read the text to speech and set the volume back to its original value.
Cheers
Pretty sure you can set device actions not at a PC to check Just look at the various nodes.
I cant find anything obvious to obtain the volume level within the "Alexa Get" node
Thanks, so I want to look at example 3, to see how it works. I have the dashboard installed, how do I create one using a json string? Eg; [{"id":"d88ff07e.1817a","type":"tab","label":"Alexa Music","disabled":false,"info":""},{"id":"85ce383c.682918","type":"ui_dropdown","z":"d88ff07e.1817a","name":"","label":"Provider","place":" SNIP
Just look at the nodes not the output. You might get overwhelmed otherwise
Spoke too soon, now getting an error "no csrf" I've removed the cookie, re-authenticated, and still see this error.
Delete the cookie and re-authenticate should work.
Use "Alexa command" to set the volume. Get Media has the current volume
@BassTeQ
[{"id":"cbdf4c36.0296a","type":"alexa-remote-get","z":"c7058271.2790f","name":"","account":"","target_type":"select","target_value":"media","serialOrName_type":"str","serialOrName_value":"","options":{"devices":{},"cards":{"limit":{"type":"num","value":"10"},"beforeCreationTime":{"type":"str","value":"%t"}},"media":{},"playerInfo":{},"list":{"size":{"type":"num","value":"100"},"startTime":{"type":"str","value":""},"endTime":{"type":"str","value":""},"completed":{"type":"bool","value":"false"},"listType":{"type":"select","value":"TASK"}},"wakewords":{},"notifications":{"cached":{"type":"bool","value":"true"}},"doNotDisturb":{},"deviceNotificationState":{},"bluetooth":{"cached":{"type":"bool","value":"true"}},"activities":{"startTime":{"type":"str","value":""},"size":{"type":"num","value":"1"},"offset":{"type":"num","value":"1"}},"account":{},"conversations":{"latest":{"type":"bool","value":"true"},"includeHomegroup":{"type":"bool","value":"true"},"unread":{"type":"bool","value":"false"},"modifiedSinceDate":{"type":"str","value":"1970-01-01T00:00:00.000Z"},"includeUserName":{"type":"bool","value":"true"}},"automationRoutines":{"limit":{"type":"num","value":"2000"}},"musicProviders":{},"homeGroup":{},"devicePreferences":{},"smarthomeDevices":{},"smarthomeGroups":{},"smarthomeEntities":{},"smarthomeBehaviourActionDefinitions":{}},"x":330,"y":740,"wires":[["297f0996.343656"]]},{"id":"280eeef7.485c92","type":"inject","z":"c7058271.2790f","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":740,"wires":[["cbdf4c36.0296a"]]},{"id":"297f0996.343656","type":"alexa-remote-sequence","z":"c7058271.2790f","name":"","account":"","serialOrName_type":"str","serialOrName_value":"","sequenceInputs":[{"command":"volume","value_type":"num","value_value":"50"},{"command":"speak","value_type":"str","value_value":"Hello World!"},{"command":"volume","value_type":"msg","value_value":"payload.volume"}],"x":520,"y":740,"wires":[[]]}]
Tried deleting the cookie, re-authenticated, but still seeing the error.
@586837r , I've tried using the content of the cookie with the "cookie" method, but it says authentication failed, should I be using the whole content of the cookie.txt or just part of it?
The code you pasted to set to the original volume, how would I use that? I currently have an "alexa sequence" where I set the volume, speak the text, then I'd like to reset the volume to the original value.
Cheers
That looks correct assuming you stored the volume before in that payload (from get media)
@NovaGL I'm actually passing a volume value in the json via mqtt in that screenshot, its not from the device.
How do I use the code below to create a node?
[{"id":"cbdf4c36.0296a","type":"alexa-remote-get","z":"c7058271.2790f","name":"","account":"","target_type":"select","target_value":"media","serialOrName_type":"str","serialOrName_value":"","options":{"devices":{},"cards":{"limit":{"type":"num","value":"10"},"beforeCreationTime":{"type":"str","value":"%t"}},"media":{},"playerInfo":{},"list":{"size":{"type":"num","value":"100"},"startTime":{"type":"str","value":""},"endTime":{"type":"str","value":""},"completed":{"type":"bool","value":"false"},"listType":{"type":"select","value":"TASK"}},"wakewords":{},"notifications":{"cached":{"type":"bool","value":"true"}},"doNotDisturb":{},"deviceNotificationState":{},"bluetooth":{"cached":{"type":"bool","value":"true"}},"activities":{"startTime":{"type":"str","value":""},"size":{"type":"num","value":"1"},"offset":{"type":"num","value":"1"}},"account":{},"conversations":{"latest":{"type":"bool","value":"true"},"includeHomegroup":{"type":"bool","value":"true"},"unread":{"type":"bool","value":"false"},"modifiedSinceDate":{"type":"str","value":"1970-01-01T00:00:00.000Z"},"includeUserName":{"type":"bool","value":"true"}},"automationRoutines":{"limit":{"type":"num","value":"2000"}},"musicProviders":{},"homeGroup":{},"devicePreferences":{},"smarthomeDevices":{},"smarthomeGroups":{},"smarthomeEntities":{},"smarthomeBehaviourActionDefinitions":{}},"x":330,"y":740,"wires":[["297f0996.343656"]]},{"id":"280eeef7.485c92","type":"inject","z":"c7058271.2790f","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":740,"wires":[["cbdf4c36.0296a"]]},{"id":"297f0996.343656","type":"alexa-remote-sequence","z":"c7058271.2790f","name":"","account":"","serialOrName_type":"str","serialOrName_value":"","sequenceInputs":[{"command":"volume","value_type":"num","value_value":"50"},{"command":"speak","value_type":"str","value_value":"Hello World!"},{"command":"volume","value_type":"msg","value_value":"payload.volume"}],"x":520,"y":740,"wires":[[]]}]
By node I mean variable. You can use the change node to store the value or store in a global or flow variable.
@BassTeQ
The cookie method does not work with the content of the file that has been created with the proxy method. To manually get the cookie to paste into the cookie field see get_cookie.md
How do I use the code below to create a node?
Thanks @NovaGL and @586837r , will try out your suggestions and see how it goes.
Any idea why the proxy method is no longer working? Not ideal to use the cookie due to the expiry,
Yeah, it seems something changed with amazon. Other users of the underlying library have reported the same error. https://github.com/Apollon77/alexa-remote/issues/44
Thanks for confirming, I have the cookie working now, and I've included your example, just trying to get it working in my flow.
Cheers
I've created this, now a little stuck.
In the inject node I pass a json string
{ "text": "this is some test", "volume_before" : "50" }
In the commands, the highlighted ones come from the JSON payload, and the 3rd comes from "get media kitchen". It appears the payload is missing the values from the JSON, how should these be injected?
Cheers
Volume before should be a number and doesn't need quotes.
You can use the change node.
Then use this
Thanks @NovaGL will try out your suggestion.
Yeah, it seems something changed with amazon. Other users of the underlying library have reported the same error.
https://github.com/Apollon77/alexa-remote/issues/44
Reading that thread, it appears they've now fixed it, hope it gets included here soon!
You're right! It should work again in version 2.3.0
Mhhh, either I'm not clever enough or there is still an issue with Proxy Auth. Cookie works within the limitation to TTL, but Proxy has an issue with now Auth fail. it running on rapsmatic…
There is nothing wrong with your configuration. Some ideas if you haven't done that already:
it is a little wired, there was no file stored and uppon i used icognito mode I got this error from the node: "Error: EISDIR: illegal operation on a directory, read"
going to reboot the system and try it again
well, it came up with chapta Auth.. but same result, after typing in my credential massage : Authentication failed. Further, reentering the credentials again do not work,: the internal web proxy is not responding. waiting 5-10min let the proxy respond again, but same "Authentication failed"
The first error is because a path to a file is expected like /usr/test01/alexa-cookie.json
, not a directory.
But authentication should still work.
Looks like there is something wrong with the proxy on your system.
As a workaround I suppose you could generate the file on a different system and copy it over.
I think I know why… the RaspMatic is different from a "normal" Linux distribution. Therefore the main directories are not writable. So I can create a in e.g. tmp. I also was able to write a file with "vi". Could may post a json example of the cookie file. I'll will copy the actual cookie in and try. This seems also the problem with Authentication/Proxy, due to the RaspMatic seem to be a little to different. @hobbyquaker who ported Node-Red might be the right one helping out with this issue
If I want to control or send TTS to multiple devices, does this require an "alexa sequence" for each device?