Closed djiwondee closed 4 years ago
Well I will have to look at it closer. Someone mentioned that Speaker is not we think it is here.
@djiwondee let's get this figured out! Should be a fun project for the week.
Any reason you are using a python script instead of the native node-red Onkyo binding? I put together a quick test with node-red-contrib-eiscp and it connected, received commands, and pushed updates into Node-RED... Might be "old" by open-source standards but the EISCP commands are mostly unchanged for over 10 years now.
Which AVR do you have? I have TX-NR676. I only use one input on my main zone and one input on zone 2. Also downloaded the Onkyo EISCP document to have references to look at.
My plan was to parse the output from eiscp-in
to filter the states I'm looking for (on/zone/volume/etc) then use the eiscp-out
to send commands over to the Onkyo. Initial commands will be power, input, and volume. From there I'm not sure what are the capabilities of the HomeKit AVR so we will just have to play with it.
@crxporter. Interesting, I've as well Onkyo "TX-NR676 E" and was not able to connect with node-red-contrib-eiscp. I don't now whether the "E" makes a difference in the protocol. But based on your tests I will give it a second attempt.
I did also a deeper review of the EISCP docs and the supported models. I found out only a smaller set of interesting command is supported for NR676.
The python library I use a layer below Node-red is very simple to use extracting the responses from the commands w/o any overhead but the price you pay for is the latency.
Btw.: I'm on a business trip this week, but I can share a flow for a wake up with a favourite radio station (soft volume increase up to a particular level) end of this week as a use case.
Last but not least, I don't know whether Support for speaker devices in HomeKit is not just a marketing message see Apple homepage and especially for Speaker devices. As far as I understand the compatibility list is almost refers to AirPlay 2 protocol support of those accessory
There are various "speaker" items from Apple these days.
Let's focus on official "certified by apple" devices for a moment.
Apple TV: this is not actually a "speaker" but it shows in Home app and has a corresponding Node in our plugin
Airport Express: similar to Apple TV. Shows playing state, allows volume control in the iTunes app.
3rd party TV: brand new, only out for "beta" currently. These are expected to be controllable in the Home app, control input, volume (via iPhone hardware buttons), menus, play/pause etc.
3rd party AVR: these are actually available. Denon makes the one I've seen in person. Same control as 3rd party TV - inputs, volume, menus, play/pause etc.
Now we go look at our plugin. You put a screenshot of the speaker service up above. I'm under the impression that's not what you actually want to use for Apple TV / AVR. That speaker seems to be purposed as a linked item for a camera that has 2-way audio. See Arlo baby camera for an official example.
Looking at the HAP television service document, it looks like they are using TelevisionSpeaker (available in our plugin) to control volume. I believe homebridge bravia has the volume thing figured out but I don't have a bravia tv to test with...
BUT we don't have the ability to see repeated presses according to this comment. @myozcam was working on this a while ago, did you figure anything out apart from your HAP wrapper rewrite? Sorry I never got around to testing your fork any more yet...
There is no reason all of this stuff can't be applied to a receiver. I'm not sure how to change the little picture to "receiver" though. Others are using the TV service to run this setup. Onkyo version here with discussion here and PR here - interesting comment that there is only one "TV" per bridge so be aware of that.
It's all very new and totally understandable that nobody's figured it out yet with our plugin. The television service just got added to HAP-NodeJS in January
@shaquu any comments on the repeated button press messages for volume and menus?
Lots to work on this week. Awesome.
Hello @crxporter , just made some exercises with node-red-contrib-eiscp. I don't know what I made wrong last time but it works quite nice for me as well now.
Right now I'm dealing with simplify the output of eiscp and to standardize message structure for reuse later with the HomeKit node
[{"id":"d3a2a74b.d49308","type":"eiscp-in","z":"755d7c8e.995f8c","name":"eiscp output","controller":"bee2672a.e41b18","x":650,"y":560,"wires":[["1a1676f5.7c3979","7b47b53d.a0610c"]]},{"id":"36d068e.4cd4918","type":"eiscp-out","z":"755d7c8e.995f8c","name":"eiscp Inject","controller":"bee2672a.e41b18","x":650,"y":660,"wires":[]},{"id":"7891493.e1ed638","type":"inject","z":"755d7c8e.995f8c","name":"","topic":"","payload":"system-power=query","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":500,"wires":[["36d068e.4cd4918"]]},{"id":"b9a4d15a.61808","type":"inject","z":"755d7c8e.995f8c","name":"","topic":"","payload":"preset=query","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":580,"wires":[["36d068e.4cd4918"]]},{"id":"295151c.577452e","type":"change","z":"755d7c8e.995f8c","name":"Current power status","rules":[{"t":"set","p":"topic","pt":"msg","to":"system-power","tot":"str"},{"t":"move","p":"payload.argument","pt":"msg","to":"payload","tot":"msg"},{"t":"delete","p":"payload.command","pt":"msg"},{"t":"delete","p":"payload.argument","pt":"msg"},{"t":"delete","p":"payload.iscp_command","pt":"msg"},{"t":"delete","p":"payload.host","pt":"msg"},{"t":"delete","p":"payload.port","pt":"msg"},{"t":"delete","p":"payload.model","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1140,"y":500,"wires":[["8561141f.1d07f"]]},{"id":"1a1676f5.7c3979","type":"switch","z":"755d7c8e.995f8c","name":"Split system status","property":"payload.command","propertyType":"msg","rules":[{"t":"eq","v":"system-power","vt":"str"},{"t":"eq","v":"audio-muting","vt":"str"},{"t":"eq","v":"input-selector","vt":"str"},{"t":"eq","v":"preset","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":890,"y":560,"wires":[["295151c.577452e"],["793c203c.1464a8"],["e1882455.277bf"],["7f4ddb23.dd9c44"]]},{"id":"793c203c.1464a8","type":"change","z":"755d7c8e.995f8c","name":"Current audio-muting status","rules":[{"t":"set","p":"topic","pt":"msg","to":"audio-muting","tot":"str"},{"t":"move","p":"payload.argument","pt":"msg","to":"payload","tot":"msg"},{"t":"delete","p":"payload.command","pt":"msg"},{"t":"delete","p":"payload.argument","pt":"msg"},{"t":"delete","p":"payload.iscp_command","pt":"msg"},{"t":"delete","p":"payload.host","pt":"msg"},{"t":"delete","p":"payload.port","pt":"msg"},{"t":"delete","p":"payload.model","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1160,"y":540,"wires":[["8561141f.1d07f"]]},{"id":"bc1875f5.6183a","type":"inject","z":"755d7c8e.995f8c","name":"","topic":"","payload":"audio-muting=query","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":540,"wires":[["36d068e.4cd4918"]]},{"id":"7f4ddb23.dd9c44","type":"change","z":"755d7c8e.995f8c","name":"Current station preset","rules":[{"t":"set","p":"topic","pt":"msg","to":"preset","tot":"str"},{"t":"move","p":"payload.iscp_command","pt":"msg","to":"payload","tot":"msg"},{"t":"delete","p":"payload.command","pt":"msg"},{"t":"delete","p":"payload.iscp_command","pt":"msg"},{"t":"delete","p":"payload.host","pt":"msg"},{"t":"delete","p":"payload.port","pt":"msg"},{"t":"delete","p":"payload.model","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1140,"y":620,"wires":[["8561141f.1d07f"]]},{"id":"29f695eb.3ef29a","type":"inject","z":"755d7c8e.995f8c","name":"","topic":"","payload":"master-volume=query","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":660,"wires":[["36d068e.4cd4918"]]},{"id":"ba79c6af.3aed48","type":"change","z":"755d7c8e.995f8c","name":"Current master volume-status","rules":[{"t":"set","p":"topic","pt":"msg","to":"master-volume","tot":"str"},{"t":"move","p":"payload.argument","pt":"msg","to":"payload","tot":"msg"},{"t":"delete","p":"payload.command","pt":"msg"},{"t":"delete","p":"payload.argument","pt":"msg"},{"t":"delete","p":"payload.iscp_command","pt":"msg"},{"t":"delete","p":"payload.host","pt":"msg"},{"t":"delete","p":"payload.port","pt":"msg"},{"t":"delete","p":"payload.model","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1170,"y":660,"wires":[["8561141f.1d07f"]]},{"id":"7b47b53d.a0610c","type":"switch","z":"755d7c8e.995f8c","name":"Split volume status","property":"payload.command[0]","propertyType":"msg","rules":[{"t":"eq","v":"master-volume","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":890,"y":660,"wires":[["ba79c6af.3aed48"]]},{"id":"8561141f.1d07f","type":"join","z":"755d7c8e.995f8c","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"1","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1430,"y":580,"wires":[["75c151fb.91e6c"]]},{"id":"fdd6d5a5.f7ab58","type":"inject","z":"755d7c8e.995f8c","name":"","topic":"","payload":"input-selector=query","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":620,"wires":[["36d068e.4cd4918"]]},{"id":"e1882455.277bf","type":"change","z":"755d7c8e.995f8c","name":"Current input-selector status","rules":[{"t":"set","p":"topic","pt":"msg","to":"input-selector","tot":"str"},{"t":"move","p":"payload.iscp_command","pt":"msg","to":"payload","tot":"msg"},{"t":"delete","p":"payload.command","pt":"msg"},{"t":"delete","p":"payload.iscp_command","pt":"msg"},{"t":"delete","p":"payload.host","pt":"msg"},{"t":"delete","p":"payload.port","pt":"msg"},{"t":"delete","p":"payload.model","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1160,"y":580,"wires":[["8561141f.1d07f"]]},{"id":"75c151fb.91e6c","type":"debug","z":"755d7c8e.995f8c","name":"Onkyo Status Summary","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1490,"y":660,"wires":[]},{"id":"bee2672a.e41b18","type":"eiscp-controller","z":"","name":"Onkyo Receiver","host":"192.168.178.46","port":"60128","model":"TX-NR676E"}]
Is there a way to do this much more simpler? e. g. JSONata using a template...? But in general it seems to me good way to update status later on HomeKit nodes and initiate inject into eiscp node in one place. What do you think?
My preference is to use function nodes for everything...
I would likely attempt to have my flow look like:
I would use msg.topic in the function on the right to filter between the homekit nodes. This is how I've done my sprinkler system and it works quite well... Take a look at that wiki page - most important the Sprinkler -> HK
and HK -> OS
nodes. That's where I'm parsing the JSON from opensprinkler then building my outputs to send back out.
The setup like you have certainly works - but is very cumbersome as you've pointed out. It's likely all the same amount of processing since in the end it's all just JSON processing... I've just tended to use function nodes as much as possible, I'm most comfortable there.
As commented above:
The television service just got added to HAP-NodeJS in January
What about AVR in that? In addition to that I guess the HAP-NodeJS as of January is not right now used in version 0.6.2
of node-red-contrib-homekit-bridged
?
What about AVR in that? In addition to that I guess the HAP-NodeJS as of January is not right now used in version 0.6.2 of node-red-contrib-homekit-bridged?
See here for your answer to the receiver question.
As for the 0.6.2
version and the HAP-NodeJS Television service - that's what we (you) are using, just Television
from the service menu. So yes, it's in our plugin.
that's what we (you) are using, just Television from the service menu. So yes, it's in our plugin.
What I try to use is service type speaker
as it is provided in the property of the HomeKite node
Will do some test with service type Television speaker
. Thanks!
@djiwondee I'm finally getting into node-red eiscp setup! That node looks long abandoned but is still very functional. I've upgraded to a new receiver and the 3 year old code still works well.
My question: have you figured out how to send JSON commands into the eiscp node? As much fun as it is to concatenate strings in my functions... I'd prefer JSON.
Hello @crxporter
have you figured out how to send JSON commands into the eiscp node?
No, I don't. I believe it is only possible to push EISCP-Command's into the node.
I also moving forward with that nodes, but let this interact with node-red-contrib-homekit-bridged is hard since all the new services for television/speaker/input source not working reliably right now.
The EISCP node have also some bugs (e. g. switching to input source TV doesn't work since there are parsing problems in the internal eiscp-commands.json
. So right now I'm only on the level of the node-red-ui for testing purposes.
I believe it is only possible to push EISCP-Command's into the node.
@djiwondee I'm looking for a way to push newer commands than what are included in the eiscp node we are using. For example the "raw" commands instead of the simplified commands in the JSON...
I have my automations mostly working but that code is using over 3 years old version of EISCP... I found this code which allows raw commands to be sent - I guess now I need a node.js course to learn how to package it and build my first node-red plugin... Does anyone have a good crash course to get started on my path to node.js programming?
@crxporter
I'm looking for a way to push newer commands than what are included in the eiscp node we are using
I think a possible option to embed newer commands ist to modify that file:
I did it to remove a bug with the command for enabling TV
as an input channel. Accoring to SIL11 is missing issue for estbeetoo/node-red-contrib-eiscp
there are obviously some bugs in parsing the eiscp-commands.json
file. In case you have more than one expression/string the first match found by the parser will be selected. In addition to that it was possible to add channels, not already implemented. As far as I understand the author of that particular node-red-module, the eiscp-commands.json
-file was created by an automated conversion of the excel-sheets.
My first thought when I saw Issue referenced by @djiwondee was get me some device to work on this and I can takeover the project and will fix all problems.
How is going on here? What is this Issue really about? Speaker or somewhat else? :)
What are question to be answered here?
This has kind of become a discussion between myself and @djiwondee about onkyo.
The outstanding question and need is if we can figure out how to have the television service output remote commands (control center remote and volume) into node red.
I’ve never been able to get the control center remote to work with television service node.
Television service works fine.
See control center remote screenshot on this comment
For my real life Apple TVs, hitting volume buttons, remote arrows, etc will control the tv. For a node red television service, the control center remote appears just fine but nothing is output when pressing the volume, arrows, menu buttons.
Have you managed to change tv source in control centre though?
I’ve never tried changing inputs in control center. I imagine it works, it’s worked fine in home app during my tests with television service
Okay. I have found an Issue in a code.
We have something like this in CharacteristicUtils
if (
characteristic.props.perms.indexOf("pr") +
characteristic.props.perms.indexOf("ev") >
-2
) {
supported.write.push(cKey);
// Subscribe to 'set' event of writable characteristic
characteristic.on("set", ServiceUtils.onCharacteristicChange);
}
Remote Key characteristic has only prop perm pw so NRCHKB is not listening for a change here...
It looks like it's related to #53 and will not come so soon I expected. Persist data #53 and working remote will possibly come in version 1.0. There is a huge chance it will break some compatibility.
Why? Legacy code as seen in my previous post was wrong. But was it really? It was wrong from logic side but is good from functional side.
For example Characteristic.Identifier is READ only but NRCHKB allows to WRITE on it. And thanks to twisted logic in current code we can actually send message with Characteristic.Identifier set to some value so thanks to it we can create Input Source for TV.
In 1.0.0 (possibly) it will be longer not allowed. Characteristic.Identifier will be READ only again and it will be set by persist table.
UPDATE: There could be an option to keep compatibility but code will become too much unreadable some day with those all bad logic ;/
This has kind of become a discussion between myself and @djiwondee about onkyo.
The outstanding question and need is if we can figure out how to have the television service output remote commands (control center remote and volume) into node red.
@Shaquu @crxporter to be honest I've stopped so far working on this together with HomeKit/NRCHKB for several reasons. My simple objectives were two things using my Onkyo AVR:
Controlling this (all) using this would be an addition benefit.
I stopped the work on that for investigation on the EISCP node and it required manual fixing for proper recognition of EISCP commands in the payload. Guess will wrap up it later on if I have some more time.
Personally I have no plans to actually use this part of homekit, I’ve been trying to figure it out for the good of the group so I could write a new wiki example.
Feel free to close it or flag it for future work or whatever else. Once it’s ready I’ll get back to it and build an example. As both myself and @djiwondee have commented, the feature request is getting the control center remote to work.
All right, let's leave it how it is so I won't miss it. Like I said, it requires some work to do but it's possible.
Update. Remote controller works now. But we still need some more work to allow "Television Speaker" I believe.
@djiwondee remember this? I believe the latest dev branch can now accomplish everything we were trying to do here.
Related #200
@crxporter #200 is exactly what I would start with testing dev.7 :-)
@Shaquu lets close this one
Hello,
since I now how HomeKit deal with some Service Types, I add this as a feature request and not as a bug. I try to make my AVR receiver usable with Home.app. It is easy to switch on/off using the switch service type:
But when it comes to more complex things I'm facing again the "Non Certified Messsage" in the Home.app. I have started to play with
Speaker
service type.and have set up the characteristics according to the HAP specification:
[{"id":"e70fd45a.ebab8","type":"homekit-service","z":"f3a7ae7c.82d138","isParent":true,"bridge":"890aedc6.d0b418","parentService":"","name":"AVR Speaker Level","serviceName":"Speaker","topic":"","filter":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","characteristicProperties":"{\n \"Mute\" : {\n \"validValues\": [false, true]\n },\n \"Volume\" : {\n \"minValue\": 0,\n \"maxValue\": 100\n }\n}\n","x":1350,"y":960,"wires":[["d3701c11.c53d6"]]},{"id":"eae54c14.6c1098","type":"change","z":"f3a7ae7c.82d138","name":"Set AVR-Receiver Mute On","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.Mute","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1060,"y":920,"wires":[["e70fd45a.ebab8"]]},{"id":"f3276729.ffc028","type":"change","z":"f3a7ae7c.82d138","name":"Set AVR-Receiver Mute Off","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.Mute","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1060,"y":960,"wires":[["e70fd45a.ebab8"]]},{"id":"f90d0f17.35cf28","type":"change","z":"f3a7ae7c.82d138","name":"Set AVR-Receiver Volume","rules":[{"t":"move","p":"payload","pt":"msg","to":"payload.Volume","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":1000,"wires":[["e70fd45a.ebab8"]]},{"id":"23dbf854.fe75b8","type":"ui_slider","z":"f3a7ae7c.82d138","name":"","label":"Speaker Level","tooltip":"Lautstärke einstellen","group":"766cf6ba.decb48","order":2,"width":0,"height":0,"passthru":true,"outs":"all","topic":"","min":0,"max":"100","step":1,"x":600,"y":1000,"wires":[["f90d0f17.35cf28"]]},{"id":"7707dcc8.9d2384","type":"inject","z":"f3a7ae7c.82d138","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":590,"y":920,"wires":[["eae54c14.6c1098"]]},{"id":"f6967d08.f22d88","type":"inject","z":"f3a7ae7c.82d138","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":590,"y":960,"wires":[["f3276729.ffc028"]]},{"id":"d3701c11.c53d6","type":"debug","z":"f3a7ae7c.82d138","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1540,"y":960,"wires":[]},{"id":"890aedc6.d0b418","type":"homekit-bridge","z":"","bridgeName":"Node-Red-HAP-Bridge-02","pinCode":"222-22-222","port":"","allowInsecureRequest":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number"},{"id":"766cf6ba.decb48","type":"ui_group","z":"","name":"Szenen","tab":"cd505ce4.cea31","order":6,"disp":true,"width":"6","collapse":false},{"id":"cd505ce4.cea31","type":"ui_tab","z":"","name":"Wohnen","icon":"event_seat","order":2}]
As a result in Home.App I can't do anything:
Using 3rd party app like EVE, interaction works as expected:
All message has been passed through Node-red from the interaction in the EVE-app Probably the same issues as with
doorbell
.Another service type Apple seems not to fully support equipment that could be used as accessory available on the market. See [here].(https://github.com/NRCHKB/node-red-contrib-homekit-bridged/issues/38#issuecomment-472134260)
Support for Speaker has been promised on WWDC2018