Git Product home page Git Product logo

Comments (6)

kuchod avatar kuchod commented on August 11, 2024 1

Thank you, every flow I have are working without crashes now.

from node-red-contrib-avr-yamaha.

krauskopf avatar krauskopf commented on August 11, 2024

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.

kuchod avatar kuchod commented on August 11, 2024

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.

kuchod avatar kuchod commented on August 11, 2024

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.

krauskopf avatar krauskopf commented on August 11, 2024

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.

krauskopf avatar krauskopf commented on August 11, 2024

Thanks for the feedback.

from node-red-contrib-avr-yamaha.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.