Comments (6)
Thank you, every flow I have are working without crashes now.
from node-red-contrib-avr-yamaha.
Thanks for the report. Seems like the incoming event data has a format, that I do not expect. I've updated the nodes and tried to catch the error. Please have a look at version 0.8.1.
I also added a warning. If you enable debug mode in the config node, then the unexpected event data is logged in the node-red debug output.
Would be happy if you could post the data here, as I would be curious what data arrives.
Cannot reproduce your error here with my AVR.
from node-red-contrib-avr-yamaha.
Thanks for the support. I tried the new version and after a while it started failing again. I modified the line #335 to print the received event:
3 Dec 00:48:15 - [info] [avr-yamaha:yamaha receiver] STARTING event listener
3 Dec 00:48:15 - [info] [avr-yamaha:yamaha receiver] UDP client listening on 0.0.0.0:1900
3 Dec 00:48:15 - [info] [mqtt-broker:b2e78784.11b098] Connected to broker: mqtt://192.168.1.200:1883
3 Dec 00:48:25 - [info] [avr-yamaha:yamaha receiver] sending PUT command:<YAMAHA_AV cmd="PUT"><Zone_2><Power_Control><Power>On</Power></Power_Control></Zone_2></YAMAHA_AV>
3 Dec 00:48:26 - [info] [avr-yamaha:yamaha receiver] UPnP Event from [192.168.1.202] --> NOTIFY * HTTP/1.1
Host: 239.255.255.250:1900
NT: urn:schemas-yamaha-com:service:X_YamahaRemoteControl:1
NTS: yamaha:propchange
USN: uuid:::urn:schemas-yamaha-com:service:X_YamahaRemoteControl:1
<?xml version="1.0" encoding="utf-8"?><YAMAHA_AV cmd="EVENT"><Zone_2><Property>Power</Property><Property>Play_Info</Property></Zone_2></YAMAHA_AV>
3 Dec 00:48:26 - [red] Uncaught Exception:
3 Dec 00:48:26 - TypeError: Cannot read property '0' of undefined
at /data/node_modules/node-red-contrib-avr-yamaha/avr-yamaha.js:382:37
at Parser.<anonymous> (/data/node_modules/xml2js/lib/parser.js:303:18)
at emitOne (events.js:96:13)
at Parser.emit (events.js:188:7)
at Object.onclosetag (/data/node_modules/xml2js/lib/parser.js:261:26)
at emit (/data/node_modules/sax/lib/sax.js:624:35)
at emitNode (/data/node_modules/sax/lib/sax.js:629:5)
at closeTag (/data/node_modules/sax/lib/sax.js:889:7)
at Object.write (/data/node_modules/sax/lib/sax.js:1436:13)
at Parser.exports.Parser.Parser.parseString (/data/node_modules/xml2js/lib/parser.js:322:31)
at Parser.parseString (/data/node_modules/xml2js/lib/parser.js:5:59)
at exports.parseString (/data/node_modules/xml2js/lib/parser.js:354:19)
at Socket.<anonymous> (/data/node_modules/node-red-contrib-avr-yamaha/avr-yamaha.js:365:13)
at emitTwo (events.js:106:13)
at Socket.emit (events.js:191:7)
at UDP.onMessage (dgram.js:548:8)
from node-red-contrib-avr-yamaha.
After several tests, the node works as expected if you are working with the main zone. If you want to control another zone, it crashes when the first response event is received:
{"YAMAHA_AV":{"$":{"cmd":"EVENT"},"Zone_2":[{"Property":["Power","Play_Info"]}]}}
I think the problem is line #374 looking for Main_Zone in result... it is in a try, it fails, mainZone is set to "undefined" and this is the reason why it crashes in #382.
A dirt way to avoid this is to check if mainZone is undefined after the try and try again with the next zone...
if (mainZone == undefined){ try{ mainZone = result.YAMAHA_AV.Zone_2; }catch (e){ if (node.debug) { node.warn('Unknown event message format: ' + JSON.stringify(result)); } return; }
from node-red-contrib-avr-yamaha.
Thanks for the help. Your're right. It crashed when events other than from the Main_Zone were received. Good point. I tried to fix it in a way, that also the event data of the correct zone is ouput. Should also work for zone 3 + 4 now.
Please have a look at v0.8.2.
from node-red-contrib-avr-yamaha.
Thanks for the feedback.
from node-red-contrib-avr-yamaha.
Related Issues (20)
- Bookmarks Net Radio HOT 2
- [Enhancement] Add support for Bluetooth Input selection HOT 3
- Yamaha RX-V679 Error Message on PUT Node HOT 5
- receive input on change HOT 12
- Errors missing in debug-node when device is off HOT 5
- RX-V775 Output 2 HOT 2
- missing DAB on my RX-V500D HOT 1
- RX-V3900 iPod Control HOT 2
- Cannot load scene HOT 8
- V500D HOT 1
- Cannot set System.Misc.Event.Notice to On - "Received error response code: "4"" HOT 2
- Number of presets.
- AVR Yamaha Node shows "connected" but receives no data HOT 3
- Add DAB-FM selection for RX-S610D
- error on yamaha node HOT 8
- MusicCast support HOT 13
- SyntaxError with Main_Zone.Volume.Lvl.Val HOT 2
- Possible to open/access the original original yamaha-nodejs library? HOT 6
- error after firmware update HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-red-contrib-avr-yamaha.