Skip to content

Instantly share code, notes, and snippets.

@cokefridge
Created August 2, 2020 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cokefridge/8fe5add4451c2c3bc95ce02fb4a0dfc7 to your computer and use it in GitHub Desktop.
Save cokefridge/8fe5add4451c2c3bc95ce02fb4a0dfc7 to your computer and use it in GitHub Desktop.
Marantz (with Heos) Web API Flow

I am using this flow with a Marantz SR5014 Receiver with built-in Heos. Out of all receivers I have used in the past this one has by far the worst understandable API possibilities and I wasn't able to find much official info on the topic. It's almost like they don't want you to use it. :)

The more elegant and powerful solution is to use a telnet connection. I failed at that attempt and the existing denon&marantz modules didn't work for me, but my requirements are also very basic and the Web Interface solves just that. It allows to catch a basic status, switch the device on and off, select the source and set the volume.

Also I am not a programmer, just a guy trying to solve a problem. :) I am not experiencing any issues with the flow, but I guess it's not perfect, so please feel free to alter and improve this flow for yourself. To configure just open the config node and enter your variables. You can also rename the source buttons in there and set a standard source and a standard volume.

[{"id":"2f52681b.fb4b08","type":"tab","label":"Media","disabled":false,"info":""},{"id":"8a7ab50f.9bfe9","type":"http request","z":"2f52681b.fb4b08","name":"","method":"use","ret":"txt","paytoqs":false,"url":"","tls":"","persist":false,"proxy":"","authType":"","x":450,"y":280,"wires":[["16264a5f.6ac126"]]},{"id":"e3c0eaf3.f38488","type":"inject","z":"2f52681b.fb4b08","name":"","topic":"","payload":"","payloadType":"str","repeat":"2","crontab":"","once":true,"onceDelay":"0.2","x":120,"y":280,"wires":[["dc9c1a84.b1872"]]},{"id":"16264a5f.6ac126","type":"xml","z":"2f52681b.fb4b08","name":"","property":"payload","attr":"","chr":"","x":610,"y":280,"wires":[["3f6f9c78.f9f924","cb55aaaf.519b6","20512b17.58e87c","dac57c22.a59df","ba837246.a4dd"]]},{"id":"3f6f9c78.f9f924","type":"debug","z":"2f52681b.fb4b08","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":770,"y":180,"wires":[]},{"id":"a5c253f7.96314","type":"ui_slider","z":"2f52681b.fb4b08","name":"","label":"Volume","tooltip":"","group":"dbd6c8f9.0c5338","order":4,"width":0,"height":0,"passthru":true,"outs":"end","topic":"","min":"-80","max":"0","step":1,"x":360,"y":800,"wires":[["a2909374.2078"]]},{"id":"a2909374.2078","type":"function","z":"2f52681b.fb4b08","name":"Volume Command","func":"var ip = flow.get('marantz_ip')\nvar port = flow.get('marantz_port')\nvar method = \"POST\"\n\nvolume = msg.payload\n\nmsg.url = 'http://' + ip + ':'+port+ '/goform/formiPhoneAppVolume.xml?1+'+ volume + '.0';\nmsg.method = method;\nmsg.payload = null;\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":800,"wires":[["fb0bc78f.74e468","a00d8703.1daad8"]]},{"id":"b1a0bb49.15d27","type":"function","z":"2f52681b.fb4b08","name":"Marantz Config","func":"// General setup\n\nvar marantz_ip = \"10.10.10.23\" //fixed IP recommended\nvar marantz_port = \"8080\"\nvar marantz_startvolume= \"-60\"\n\n// Optional Standard Source after Power On\n//var marantz_startsource = \"SATCBL\"\nvar marantz_startsource = \"MPLAY\"\n//var marantz_startsource = null\n\n// Optional Source Renaming for display purposes\n\nvar SATCBL = \"SAT/CBL\"\nvar DVD = \"DVD\"\nvar BD = \"BluRay\"\nvar GAME = \"Game\"\nvar AUX1 = \"Aux 1\"\nvar AUX2 = \"Aux 2\"\nvar MPLAY = \"Media Player\"\nvar CD = \"CD\"\nvar TUNER = \"Tuner\"\nvar NET = \"HEOS Music\"\nvar TV = \"TV\"\nvar BT = \"Bluetooth\"\nvar PHONO = \"Phono\"\n\n\n\nflow.set('marantz_ip', marantz_ip);\nflow.set('marantz_port', marantz_port);\nflow.set('marantz_startvolume', marantz_startvolume);\n\nflow.set('marantz_startsource', marantz_startsource);\n\nflow.set('marantz_SATCBL',SATCBL);\nflow.set('marantz_DVD',DVD);\nflow.set('marantz_BD',BD);\nflow.set('marantz_GAME',GAME);\nflow.set('marantz_AUX1',AUX1);\nflow.set('marantz_AUX2',AUX2);\nflow.set('marantz_MPLAY',MPLAY);\nflow.set('marantz_CD',CD);\nflow.set('marantz_TUNER',TUNER);\nflow.set('marantz_NET',NET);\nflow.set('marantz_TV',TV);\nflow.set('marantz_BT',BT);\nflow.set('marantz_PHONO',PHONO);\n\n\n\nreturn msg;","outputs":1,"noerr":0,"x":340,"y":100,"wires":[[]]},{"id":"5e18f8dd.7b70b","type":"inject","z":"2f52681b.fb4b08","name":"Inject at Start","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":160,"y":100,"wires":[["b1a0bb49.15d27"]]},{"id":"fb0bc78f.74e468","type":"http request","z":"2f52681b.fb4b08","name":"","method":"use","ret":"txt","paytoqs":false,"url":"","tls":"","persist":false,"proxy":"","authType":"","x":770,"y":800,"wires":[[]]},{"id":"4e373721.03bbd8","type":"comment","z":"2f52681b.fb4b08","name":"Readme","info":"I am using this flow with a Marantz SR5014 Receiver with built-in Heos.\nOut of all receivers I have used in the past this one has by far the worst \nunderstandable API possibilities and I wasn't able to find much official info\non the topic. It's almost like they don't want you to use it. :)\n\nThe more elegant and powerful solution is to use a telnet (rly?) connection.\nI failed at that attempt and the existing denon&marantz modules didn't work for\nme, but my requirements are also very basic and the Web Interface solves just \nthat. It allows to catch a basic status, switch the device on and off, \nselect the source and set the volume.\n\nAlso I am not a programmer, just a guy trying to solve a problem. :)\nSo please feel free to alter and improve this flow. I found the URLS below\nto be working.\n\n\nTo configure just open the config node and enter your variables.\nYou can also rename the source buttons in there and set a standard source \nand a standard volume\n\n\nStatus Overview\nhttp://<IP>:8080/goform/formMainZone_MainZoneXmlStatusLite.xml\n\nPower\nhttp://<IP>:8080/goform/formiPhoneAppPower.xml?1+PowerOn\nhttp://<IP>:8080/goform/formiPhoneAppPower.xml?1+PowerStandby\n\n\nVolume\nhttp://<IP>:8080/goform/formiPhoneAppVolume.xml?1+-20.0 *Custom value replaces -20.0\nhttp://<IP>:8080/goform/formiPhoneAppDirect.xml?MVUP\nhttp://<IP>:8080/goform/formiPhoneAppDirect.xml?MVDOWN\nhttp://<IP>:8080/goform/formiPhoneAppMute.xml?1+MuteOn\nhttp://<IP>:8080/goform/formiPhoneAppMute.xml?1+MuteOff\n\n\n\nSources\nhttp://<IP>:8080/goform/formiPhoneAppDirect.xml?SIDVD\nhttp://<IP>:8080/goform/formiPhoneAppDirect.xml?SIGAME\nhttp://<IP>:8080/goform/formiPhoneAppDirect.xml?SI<OTHER> *Check status URL for others","x":100,"y":60,"wires":[]},{"id":"c8dd2be4.1a5bc8","type":"convert","z":"2f52681b.fb4b08","name":"","convertTo":"number","x":1010,"y":300,"wires":[["967f548c.ffb2b8"]]},{"id":"a00d8703.1daad8","type":"debug","z":"2f52681b.fb4b08","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":730,"y":760,"wires":[]},{"id":"cb55aaaf.519b6","type":"change","z":"2f52681b.fb4b08","name":"Status: Get Volume","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.item.MasterVolume[0].value[0]","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":810,"y":300,"wires":[["c8dd2be4.1a5bc8"]]},{"id":"837042a3.69fda8","type":"link out","z":"2f52681b.fb4b08","name":"OUT: Status Volume Marantz","links":["be4ee4d3.00c908"],"x":1575,"y":300,"wires":[]},{"id":"be4ee4d3.00c908","type":"link in","z":"2f52681b.fb4b08","name":"IN: Status Volume Marantz","links":["837042a3.69fda8","add84a0f.02ef"],"x":75,"y":800,"wires":[["a5c253f7.96314"]]},{"id":"3f0d82bc.7b92e6","type":"comment","z":"2f52681b.fb4b08","name":"Volume Slider","info":"**Slider for volume control.**\nCan be replaced by any other object delivering \na specific number in the msg.payload\n\nTo avoid mismatching values between slider and receiver \nI intended to connect the request result to the slider again, but the request \nresult sometimes carries the old value, while the volume and the status page are\nalready updated (which results in the slider jumping back to the old value).\nSo instead I connected the status page result to the slider input, which\nworks much better.","x":110,"y":760,"wires":[]},{"id":"dc9c1a84.b1872","type":"function","z":"2f52681b.fb4b08","name":"Get Status","func":"var ip = flow.get('marantz_ip')\nvar port = flow.get('marantz_port')\nvar method = \"GET\"\n\nmsg.url = 'http://' + ip + ':'+port+ '/goform/formMainZone_MainZoneXmlStatusLite.xml';\nmsg.method = method;\nmsg.payload = null;\nreturn msg;","outputs":1,"noerr":0,"x":270,"y":280,"wires":[["8a7ab50f.9bfe9"]]},{"id":"dac57c22.a59df","type":"change","z":"2f52681b.fb4b08","name":"Status: Get Power","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.item.Power[0].value[0]","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":810,"y":220,"wires":[["5f4bc8c3.c0adc8"]]},{"id":"ba837246.a4dd","type":"change","z":"2f52681b.fb4b08","name":"Status: Get Mute","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.item.Mute[0].value[0]","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":810,"y":340,"wires":[[]]},{"id":"20512b17.58e87c","type":"change","z":"2f52681b.fb4b08","name":"Status: Get Source","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.item.InputFuncSelect[0].value[0]","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":810,"y":260,"wires":[["681f25ec.b7bbac"]]},{"id":"94316596.02fd48","type":"ui_button","z":"2f52681b.fb4b08","name":"SATCBL","group":"73907b42.e5392c","order":1,"width":0,"height":0,"passthru":false,"label":"{{msg.payload}}","tooltip":"","color":"","bgcolor":"","icon":"","payload":"SAT%2FCBL","payloadType":"str","topic":"","x":600,"y":1020,"wires":[["66d76fdc.c77ef"]]},{"id":"da9099b6.437d78","type":"comment","z":"2f52681b.fb4b08","name":"Source Selection","info":"**Source Selection Buttons**\n\nFunction nodes to get renamings from config node. Only for display.","x":120,"y":980,"wires":[]},{"id":"74499ddd.2fb2cc","type":"function","z":"2f52681b.fb4b08","name":"Get name SATCBL","func":"var name = flow.get('marantz_SATCBL')\n\nmsg.payload = name;\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":1020,"wires":[["94316596.02fd48"]]},{"id":"dbe806a5.0bb598","type":"inject","z":"2f52681b.fb4b08","name":"Inject at Start","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"0.5","x":140,"y":1020,"wires":[["74499ddd.2fb2cc","b1a974e6.b712b","d70397c7.db8b8","bfa7ac34.711e9","63db1a4e.978acc","4dceddcf.206a8c","894e92b.fb0e1f","e79280a6.e6b89","fab5dd00.5792e","d4d6294d.2abea8","4512e31a.fc66bc","8a7599a9.9144d8","a4fd7547.ff8098"]]},{"id":"9126d04c.b0ccb","type":"ui_button","z":"2f52681b.fb4b08","name":"DVD","group":"73907b42.e5392c","order":2,"width":0,"height":0,"passthru":false,"label":"{{msg.payload}}","tooltip":"","color":"","bgcolor":"","icon":"","payload":"DVD","payloadType":"str","topic":"","x":590,"y":1060,"wires":[["66d76fdc.c77ef"]]},{"id":"b1a974e6.b712b","type":"function","z":"2f52681b.fb4b08","name":"Get name DVD","func":"var name = flow.get('marantz_DVD')\n\nmsg.payload = name;\nreturn msg;","outputs":1,"noerr":0,"x":420,"y":1060,"wires":[["9126d04c.b0ccb"]]},{"id":"5b1adb8f.c0f26c","type":"ui_button","z":"2f52681b.fb4b08","name":"BD","group":"73907b42.e5392c","order":3,"width":0,"height":0,"passthru":false,"label":"{{msg.payload}}","tooltip":"","color":"","bgcolor":"","icon":"","payload":"BD","payloadType":"str","topic":"","x":590,"y":1100,"wires":[["66d76fdc.c77ef"]]},{"id":"d70397c7.db8b8","type":"function","z":"2f52681b.fb4b08","name":"Get name BD","func":"var name = flow.get('marantz_BD')\n\nmsg.payload = name;\nreturn msg;","outputs":1,"noerr":0,"x":420,"y":1100,"wires":[["5b1adb8f.c0f26c"]]},{"id":"45342103.b1f47","type":"ui_button","z":"2f52681b.fb4b08","name":"GAME","group":"73907b42.e5392c","order":4,"width":0,"height":0,"passthru":false,"label":"{{msg.payload}}","tooltip":"","color":"","bgcolor":"","icon":"","payload":"GAME","payloadType":"str","topic":"","x":590,"y":1140,"wires":[["66d76fdc.c77ef"]]},{"id":"bfa7ac34.711e9","type":"function","z":"2f52681b.fb4b08","name":"Get name GAME","func":"var name = flow.get('marantz_GAME')\n\nmsg.payload = name;\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":1140,"wires":[["45342103.b1f47"]]},{"id":"fc27d491.fa537","type":"ui_button","z":"2f52681b.fb4b08","name":"AUX1","group":"73907b42.e5392c","order":5,"width":0,"height":0,"passthru":false,"label":"{{msg.payload}}","tooltip":"","color":"","bgcolor":"","icon":"","payload":"AUX1","payloadType":"str","topic":"","x":590,"y":1180,"wires":[["66d76fdc.c77ef"]]},{"id":"63db1a4e.978acc","type":"function","z":"2f52681b.fb4b08","name":"Get name AUX1","func":"var name = flow.get('marantz_AUX1')\n\nmsg.payload = name;\nreturn msg;","outputs":1,"noerr":0,"x":420,"y":1180,"wires":[["fc27d491.fa537"]]},{"id":"2e405548.6697fa","type":"ui_button","z":"2f52681b.fb4b08","name":"AUX2","group":"73907b42.e5392c","order":6,"width":0,"height":0,"passthru":false,"label":"{{msg.payload}}","tooltip":"","color":"","bgcolor":"","icon":"","payload":"AUX2","payloadType":"str","topic":"","x":590,"y":1220,"wires":[["66d76fdc.c77ef"]]},{"id":"4dceddcf.206a8c","type":"function","z":"2f52681b.fb4b08","name":"Get name AUX2","func":"var name = flow.get('marantz_AUX2')\n\nmsg.payload = name;\nreturn msg;","outputs":1,"noerr":0,"x":420,"y":1220,"wires":[["2e405548.6697fa"]]},{"id":"1d60a539.aefe53","type":"ui_button","z":"2f52681b.fb4b08","name":"MPLAY","group":"73907b42.e5392c","order":7,"width":0,"height":0,"passthru":false,"label":"{{msg.payload}}","tooltip":"","color":"","bgcolor":"","icon":"","payload":"MPLAY","payloadType":"str","topic":"","x":600,"y":1260,"wires":[["66d76fdc.c77ef"]]},{"id":"894e92b.fb0e1f","type":"function","z":"2f52681b.fb4b08","name":"Get name MPLAY","func":"var name = flow.get('marantz_MPLAY')\n\nmsg.payload = name;\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":1260,"wires":[["1d60a539.aefe53"]]},{"id":"7a7daea4.72e41","type":"ui_button","z":"2f52681b.fb4b08","name":"CD","group":"73907b42.e5392c","order":8,"width":0,"height":0,"passthru":false,"label":"{{msg.payload}}","tooltip":"","color":"","bgcolor":"","icon":"","payload":"CD","payloadType":"str","topic":"","x":590,"y":1300,"wires":[["66d76fdc.c77ef"]]},{"id":"e79280a6.e6b89","type":"function","z":"2f52681b.fb4b08","name":"Get name CD","func":"var name = flow.get('marantz_CD')\n\nmsg.payload = name;\nreturn msg;","outputs":1,"noerr":0,"x":420,"y":1300,"wires":[["7a7daea4.72e41"]]},{"id":"350788fe.dcc558","type":"ui_button","z":"2f52681b.fb4b08","name":"TUNER","group":"73907b42.e5392c","order":9,"width":0,"height":0,"passthru":false,"label":"{{msg.payload}}","tooltip":"","color":"","bgcolor":"","icon":"","payload":"TUNER","payloadType":"str","topic":"","x":600,"y":1340,"wires":[["66d76fdc.c77ef"]]},{"id":"fab5dd00.5792e","type":"function","z":"2f52681b.fb4b08","name":"Get name TUNER","func":"var name = flow.get('marantz_TUNER')\n\nmsg.payload = name;\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":1340,"wires":[["350788fe.dcc558"]]},{"id":"4f614078.32fae8","type":"ui_button","z":"2f52681b.fb4b08","name":"NET","group":"73907b42.e5392c","order":10,"width":0,"height":0,"passthru":false,"label":"{{msg.payload}}","tooltip":"","color":"","bgcolor":"","icon":"","payload":"NET","payloadType":"str","topic":"","x":590,"y":1380,"wires":[[]]},{"id":"d4d6294d.2abea8","type":"function","z":"2f52681b.fb4b08","name":"Get name NET","func":"var name = flow.get('marantz_NET')\n\nmsg.payload = name;\nreturn msg;","outputs":1,"noerr":0,"x":420,"y":1380,"wires":[["4f614078.32fae8"]]},{"id":"c19f8bac.68358","type":"ui_button","z":"2f52681b.fb4b08","name":"BT","group":"73907b42.e5392c","order":12,"width":0,"height":0,"passthru":false,"label":"{{msg.payload}}","tooltip":"","color":"","bgcolor":"","icon":"","payload":"BT","payloadType":"str","topic":"","x":590,"y":1460,"wires":[["66d76fdc.c77ef"]]},{"id":"4512e31a.fc66bc","type":"function","z":"2f52681b.fb4b08","name":"Get name BT","func":"var name = flow.get('marantz_BT')\n\nmsg.payload = name;\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":1460,"wires":[["c19f8bac.68358"]]},{"id":"62bf213e.bba77","type":"ui_button","z":"2f52681b.fb4b08","name":"PHONO","group":"73907b42.e5392c","order":13,"width":0,"height":0,"passthru":false,"label":"{{msg.payload}}","tooltip":"","color":"","bgcolor":"","icon":"","payload":"PHONO","payloadType":"str","topic":"","x":600,"y":1500,"wires":[["66d76fdc.c77ef"]]},{"id":"8a7599a9.9144d8","type":"function","z":"2f52681b.fb4b08","name":"Get name PHONO","func":"var name = flow.get('marantz_PHONO')\n\nmsg.payload = name;\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":1500,"wires":[["62bf213e.bba77"]]},{"id":"a4fd7547.ff8098","type":"function","z":"2f52681b.fb4b08","name":"Get name TV","func":"var name = flow.get('marantz_TV')\n\nmsg.payload = name;\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":1420,"wires":[["a9719ca.95c0be"]]},{"id":"a9719ca.95c0be","type":"ui_button","z":"2f52681b.fb4b08","name":"TV","group":"73907b42.e5392c","order":11,"width":0,"height":0,"passthru":false,"label":"{{msg.payload}}","tooltip":"","color":"","bgcolor":"","icon":"","payload":"TV","payloadType":"str","topic":"","x":590,"y":1420,"wires":[["66d76fdc.c77ef"]]},{"id":"66d76fdc.c77ef","type":"function","z":"2f52681b.fb4b08","name":"Set Source Command","func":"var ip = flow.get('marantz_ip')\nvar port = flow.get('marantz_port')\nvar method = \"POST\"\n\nsource = msg.payload\n\nmsg.url = 'http://' + ip + ':'+port+ '/goform/formiPhoneAppDirect.xml?SI'+ source;\n\nmsg.method = method;\nmsg.payload = null;\nreturn msg;","outputs":1,"noerr":0,"x":920,"y":1260,"wires":[["823472de.2bb9b","38a0263e.009312"]]},{"id":"823472de.2bb9b","type":"http request","z":"2f52681b.fb4b08","name":"","method":"use","ret":"txt","paytoqs":false,"url":"","tls":"","persist":false,"proxy":"","authType":"","x":1150,"y":1260,"wires":[[]]},{"id":"38a0263e.009312","type":"debug","z":"2f52681b.fb4b08","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1110,"y":1220,"wires":[]},{"id":"69d0cef3.b5acb8","type":"function","z":"2f52681b.fb4b08","name":"Power Command","func":"var ip = flow.get('marantz_ip')\nvar port = flow.get('marantz_port')\nvar method = \"POST\"\n\npower = msg.payload\n\n\n\nswitch (power) {\n case true:\n msg.url = 'http://' + ip + ':'+port+ '/goform/formiPhoneAppPower.xml?1+PowerOn';\n break;\n case false:\n msg.url = 'http://' + ip + ':'+port+ '/goform/formiPhoneAppPower.xml?1+PowerStandby';\n \n}\n\nmsg.method = method;\nmsg.payload = null;\nreturn msg;","outputs":1,"noerr":0,"x":770,"y":540,"wires":[["9010b14c.bfa9b","2ada3559.91a872"]]},{"id":"9010b14c.bfa9b","type":"http request","z":"2f52681b.fb4b08","name":"","method":"use","ret":"txt","paytoqs":false,"url":"","tls":"","persist":false,"proxy":"","authType":"","x":1170,"y":540,"wires":[[]]},{"id":"2ada3559.91a872","type":"debug","z":"2f52681b.fb4b08","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1130,"y":500,"wires":[]},{"id":"1357234c.73472d","type":"comment","z":"2f52681b.fb4b08","name":"Power Toggle","info":"toggles power. ;)","x":110,"y":500,"wires":[]},{"id":"f2b1ee0b.a79f98","type":"ui_switch","z":"2f52681b.fb4b08","name":"","label":"Power","tooltip":"","group":"dbd6c8f9.0c5338","order":2,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":290,"y":540,"wires":[["69d0cef3.b5acb8","7ffa602b.c5da7"]]},{"id":"5f4bc8c3.c0adc8","type":"switch","z":"2f52681b.fb4b08","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"},{"t":"eq","v":"OFF","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1090,"y":200,"wires":[["238f1205.cf6086"],["73330d35.a811a4"]]},{"id":"238f1205.cf6086","type":"change","z":"2f52681b.fb4b08","name":"set power true","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1260,"y":180,"wires":[["f32935a2.d6c1b8"]]},{"id":"73330d35.a811a4","type":"change","z":"2f52681b.fb4b08","name":"set power false","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1260,"y":220,"wires":[["f32935a2.d6c1b8"]]},{"id":"f32935a2.d6c1b8","type":"function","z":"2f52681b.fb4b08","name":"set power var","func":"var power\nflow.set('marantz_power', power);\n\nreturn msg;","outputs":1,"noerr":0,"x":1480,"y":200,"wires":[[]]},{"id":"3672f1e2.3c895e","type":"inject","z":"2f52681b.fb4b08","name":"Inject at Start","topic":"","payload":"marantz_power","payloadType":"flow","repeat":"","crontab":"","once":true,"onceDelay":"0.5","x":140,"y":540,"wires":[["f2b1ee0b.a79f98"]]},{"id":"e32af29.1d45e9","type":"inject","z":"2f52681b.fb4b08","name":"Inject at Start","topic":"","payload":"marantz_startvolume","payloadType":"flow","repeat":"","crontab":"","once":true,"onceDelay":"0.5","x":140,"y":840,"wires":[["a5c253f7.96314"]]},{"id":"7ddcb57c.125eb4","type":"function","z":"2f52681b.fb4b08","name":"Select Standard Volume","func":"\nvar startvolume = flow.get('marantz_startvolume')\nvar power = null\n\npower = msg.payload\n\n\n\nif(power===true){\n msg.payload = startvolume\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":790,"y":580,"wires":[["add84a0f.02ef"]]},{"id":"57c595d.3ec296c","type":"function","z":"2f52681b.fb4b08","name":"Select Standard Source","func":"var ip = flow.get('marantz_ip')\nvar port = flow.get('marantz_port')\nvar method = \"POST\"\n\nvar startsource = flow.get('marantz_startsource')\nvar power = null\n\npower = msg.payload\n\nif(power===true && startsource !== null){\n \n if(startsource==\"SATCBL\"){\n msg.url = 'http://' + ip + ':'+port+ '/goform/formiPhoneAppDirect.xml?SISAT%2FCBL';\n }\n else if(startsource==\"SAT/CBL\"){\n msg.url = 'http://' + ip + ':'+port+ '/goform/formiPhoneAppDirect.xml?SISAT%2FCBL';\n }\n else{\n msg.url = 'http://' + ip + ':'+port+ '/goform/formiPhoneAppDirect.xml?SI'+ startsource;\n }\n \n \n msg.method = method;\n msg.payload = null;\n}\nelse{\n msg.payload = null;\n}\n\n\nreturn msg;","outputs":1,"noerr":0,"x":790,"y":620,"wires":[["255a1e23.322182"]]},{"id":"7ffa602b.c5da7","type":"delay","z":"2f52681b.fb4b08","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":500,"y":600,"wires":[["57c595d.3ec296c","7ddcb57c.125eb4"]]},{"id":"4eb3067d.004568","type":"http request","z":"2f52681b.fb4b08","name":"","method":"use","ret":"txt","paytoqs":false,"url":"","tls":"","persist":false,"proxy":"","authType":"","x":1170,"y":620,"wires":[[]]},{"id":"75cf7b5d.58b4dc","type":"debug","z":"2f52681b.fb4b08","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1130,"y":660,"wires":[]},{"id":"b84078c1.bd282","type":"ui_text","z":"2f52681b.fb4b08","group":"dbd6c8f9.0c5338","order":3,"width":0,"height":0,"name":"","label":"Source","format":"{{msg.payload}}","layout":"row-spread","x":1460,"y":260,"wires":[]},{"id":"255a1e23.322182","type":"switch","z":"2f52681b.fb4b08","name":"","property":"url","propertyType":"msg","rules":[{"t":"nempty"}],"checkall":"true","repair":false,"outputs":1,"x":990,"y":620,"wires":[["4eb3067d.004568","75cf7b5d.58b4dc"]]},{"id":"add84a0f.02ef","type":"link out","z":"2f52681b.fb4b08","name":"OUT: Standard Volume Marantz","links":["be4ee4d3.00c908"],"x":955,"y":580,"wires":[]},{"id":"681f25ec.b7bbac","type":"function","z":"2f52681b.fb4b08","name":"Rename Sources","func":"var SATCBL = flow.get('marantz_SATCBL')\nvar DVD = flow.get('marantz_DVD')\nvar BD = flow.get('marantz_BD')\nvar GAME = flow.get('marantz_GAME')\nvar AUX1 = flow.get('marantz_AUX1')\nvar AUX2 = flow.get('marantz_AUX2')\nvar MPLAY = flow.get('marantz_MPLAY')\nvar CD = flow.get('marantz_CD')\nvar TUNER = flow.get('marantz_TUNER')\nvar NET = flow.get('marantz_NET')\nvar TV = flow.get('marantz_TV')\nvar BT = flow.get('marantz_BT')\nvar PHONO = flow.get('marantz_PHONO')\n\nsource = msg.payload\n\n\nswitch (source) {\n case \"SAT/CBL\":\n msg.payload = SATCBL;\n break;\n case \"DVD\":\n msg.payload = DVD;\n break; \n case \"BD\":\n msg.payload = BD;\n break;\n case \"GAME\":\n msg.payload = GAME;\n break;\n case \"AUX1\":\n msg.payload = AUX1;\n break;\n case \"AUX2\":\n msg.payload = AUX2;\n break;\n case \"MPLAY\":\n msg.payload = MPLAY;\n break;\n case \"CD\":\n msg.payload = CD;\n break;\n case \"TUNER\":\n msg.payload = TUNER;\n break;\n case \"NET\":\n msg.payload = NET;\n break;\n case \"TV\":\n msg.payload = TV;\n break;\n case \"BT\":\n msg.payload = BT;\n break;\n case \"PHONO\":\n msg.payload = PHONO;\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":1250,"y":260,"wires":[["b84078c1.bd282"]]},{"id":"967f548c.ffb2b8","type":"delay","z":"2f52681b.fb4b08","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"10","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":1430,"y":300,"wires":[["837042a3.69fda8"]]},{"id":"66c0fced.80aa9c","type":"comment","z":"2f52681b.fb4b08","name":"Get status","info":"Reads Marantz status page and constantly updates the values.\n\n\n\nThat allows a correct display of the volume for example,\nif you used a remote control or an app to adjust the volume.\nHowever, pushing the volume value is restricted to once every 10 seconds,\nsince the webinterface isn't keeping up causing stuttering when using\nthe IR remote.","x":100,"y":240,"wires":[]},{"id":"dbd6c8f9.0c5338","type":"ui_group","z":"","name":"Marantz Controls","tab":"91b223e6.caf208","order":1,"disp":false,"width":"6","collapse":false},{"id":"73907b42.e5392c","type":"ui_group","z":"","name":"Marantz Sources","tab":"91b223e6.caf208","order":2,"disp":true,"width":"6","collapse":true},{"id":"91b223e6.caf208","type":"ui_tab","z":"","name":"Media","icon":"dashboard","order":9,"disabled":false,"hidden":false}]
@houser42
Copy link

houser42 commented Feb 23, 2022

Hello,
Thanks for this flow! I am trying to use it with my Marantz SR 7013.
Your flow appears to work great, apart from the power on and off which just restarts the Marantz.
I also get this debug message after your power function node :
TypeError: Cannot read properties of null (reading 'hasOwnProperty')
If you are still using your code, is it still working for you? Many thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment