i8beef / node-red-contrib-castv2

MIT License
22 stars 14 forks source link

getStatusAsync is not defined #17

Closed felixpackard closed 4 years ago

felixpackard commented 4 years ago

I am trying to use this node on a clean install of Node-Red, running on a Raspberry Pi (Raspbian Buster Lite, kernel version 4.19).

Upon making any request, I get the following error: "ReferenceError: getStatusAsync is not defined".

My layout is as follows: Inject > Function (to set payload) > CastV2 Sender

[{"id":"abe1cc29.2dba","type":"inject","z":"a2138180.daa82","name":"Trigger TTS","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":380,"wires":[["280d0049.e1ac1"]]},{"id":"280d0049.e1ac1","type":"function","z":"a2138180.daa82","name":"Hello world payload","func":"msg.payload = {\n  host: \"192.168.2.138\",\n  payload: {\n    type: \"TTS\",\n    text: \"Hello world\",\n    speed: 1, // optional to adjust TTS speed, defaults to 1\n    language: \"en\", // optional to set TTS language, default to en\n    metadata: { // optional unless desired, follows normal metadata rules noted above\n      title: \"Media title\" \n    }\n  }\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":380,"wires":[["e6e55d1b.de90c"]]},{"id":"e6e55d1b.de90c","type":"castv2-sender","z":"a2138180.daa82","name":"Cast TTS","host":"192.168.2.138","x":520,"y":380,"wires":[[]]}]

I assume this must be an issue specific to my configuration, as I haven't seen any other mention of this issue. Spent a while trying to debug this myself, but not getting far so I hoped someone else might be able to offer some insight.

Cheers

i8beef commented 4 years ago

I did find one non-qualified call to that which might be your issue. I just pushed another version. I think it would only occur if you were doing media commands though (play, pause, etc.). Try out 2.0.3

felixpackard commented 4 years ago

I appreciate you taking a look and getting back to me so quickly. I updated to the new version and although the error had disappeared I was getting a new error – I realised that this, and most likely the first error as well, were due to my own ignorance (as I initially thought they might be). I was setting msg.payload to the example objects provided in the readme, when actually I should have been assigning the objects to msgcommand.type didn't exist (as I was setting command.payload.type) therefore the else condition for the media commands was run.

Thanks again for your help, and for the node, it's working flawlessly now.

i8beef commented 4 years ago

I would be interested in what the new error is, but I'm glad you've gotten yourself squared away here for the rest. Let me know if you need anything else!

felixpackard commented 4 years ago

If I remember correctly it was the "not playing" error thrown on line 75 of the JS file, which I suppose makes sense as if command.type is left unspecified, it will default to a media command, then error out due to the fact there's no media stream to control. Maybe it would make sense to change the else to an else if and throw an error if command.type isn't set – this could point others in the right direction if they make a similar mistake.

i8beef commented 4 years ago

Ok, that at least is a legitimate error in this case.