Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tv remote control does not skip repeated values #200

Closed
daddvok opened this issue Jan 22, 2020 · 50 comments
Closed

tv remote control does not skip repeated values #200

daddvok opened this issue Jan 22, 2020 · 50 comments
Labels
bug 🐛 There is at least high chance that it is a bug!

Comments

@daddvok
Copy link

daddvok commented Jan 22, 2020

please correct the bug with skipping repeated values.
if i press the same key two or more times value of msg.payload.RemoteKey does not come more than once.
изображение

node-red-contrib-homekit-bridged@1.0.0-dev.2

@daddvok daddvok added the bug 🐛 There is at least high chance that it is a bug! label Jan 22, 2020
@crxporter
Copy link
Member

See related issue #129 - especially this comment

Have you ever had this working? Another thing to try would be upgrade to version 1.0.0-dev.5 - there have been a few updates to hap-nodejs since dev.2.

@crxporter
Copy link
Member

PS: I'll put together a quick test of this today and see if I can get something started for the wiki page.

@Shaquu
Copy link
Member

Shaquu commented Jan 22, 2020

And what about allow message pass through option?

@daddvok
Copy link
Author

daddvok commented Jan 22, 2020

And what about allow message pass through option?

изображение
this option is on

@Shaquu
Copy link
Member

Shaquu commented Jan 22, 2020

Please share your flow (code).
It used to work but maybe something broke.

@crxporter
Copy link
Member

@Shaquu it looks like something broke - I just tried it and got the same behavior as @daddvok is seeing.

Important part of the flow:

[{"id":"7dc8b341.b7ef34","type":"homekit-service","z":"19f98beb.6fa5c4","isParent":true,"bridge":"345c6ca1.3760dc","parentService":"","name":"Television","serviceName":"Television","topic":"","filter":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{\n    \"RemoteKey\" : {\n        \"minValue\": 0\n    }\n}","x":320,"y":1100,"wires":[["d160fe04.9e7c48"],["9acb40f1.6e22e8"]]},{"id":"d160fe04.9e7c48","type":"debug","z":"19f98beb.6fa5c4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":510,"y":1080,"wires":[]},{"id":"9acb40f1.6e22e8","type":"debug","z":"19f98beb.6fa5c4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":510,"y":1120,"wires":[]},{"id":"345c6ca1.3760dc","type":"homekit-bridge","z":"","bridgeName":"Dev","pinCode":"111-11-111","port":"","allowInsecureRequest":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true,"allowMessagePassthrough":true}]

And a screenshot of the output, showing all keys working but no repeats even though I tried repeats:
Screen Shot 2020-01-22 at 6 50 19 AM

@daddvok
Copy link
Author

daddvok commented Jan 22, 2020

Please share your flow (code).
It used to work but maybe something broke.

[{"id":"a740cf0e.1cfa9","type":"homekit-service","z":"36b3e7c8.a1a878","isParent":true,"bridge":"406f0f02.7cb3a","accessoryCategory":"TELEVISION","parentService":"","name":"TV Кухня","serviceName":"Television","topic":"","filter":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","cameraConfigVideoProcessor":"","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":"","cameraConfigMaxWidth":"","cameraConfigMaxHeight":"","cameraConfigMaxFPS":"","cameraConfigMaxBitrate":"","cameraConfigVideoCodec":"","cameraConfigAudioCodec":"","cameraConfigAudio":false,"cameraConfigPacketSize":"","cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"","cameraConfigMapAudio":"","cameraConfigVideoFilter":"","cameraConfigAdditionalCommandLine":"","cameraConfigDebug":false,"cameraConfigInterfaceName":"","characteristicProperties":"{\n \"RemoteKey\":true,\n \"PowerModeSelection\":true\n}","x":1621.5001220703125,"y":1263.333251953125,"wires":[["9065a2df.c7f","615079bf.e9047","3eb00cf9.37743c","30c0739b.c91dd4"],[]]},{"id":"406f0f02.7cb3a","type":"homekit-bridge","z":"","bridgeName":"NR","pinCode":"533-44-678","port":"","allowInsecureRequest":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true,"allowMessagePassthrough":true}]

@daddvok
Copy link
Author

daddvok commented Jan 22, 2020

See related issue #129 - especially this comment

Have you ever had this working? Another thing to try would be upgrade to version 1.0.0-dev.5 - there have been a few updates to hap-nodejs since dev.2.

never worked, but just now got around to write about the problem.
I don’t want to update, as many complain about problems with moving devices to the default room, now everything works for me good, only bug with remote

@crxporter
Copy link
Member

many complain about problems with moving devices to the default room

Just want to be clear, this is a one-time issue when you update. After updating you'll need to reconfigure once then things will stay the same (hopefully through many subsequent updates).

It's likely that the fix for your issue will be dev.6 - do you run on a raspberry pi? I suggest running tests on a development system (extra pi, separate docker container, separate VM, etc) so you don't break your main system... Don't tell anyone but my main use of this plugin still runs the very old 0.6.2 version! I play with and test new features on a separate raspberry pi.

@daddvok
Copy link
Author

daddvok commented Jan 22, 2020

It's likely that the fix for your issue will be dev.6 - do you run on a raspberry pi?

Yes, RPi 3b. I don’t have another raspberry, but I’m too lazy to run in containers)

@daddvok
Copy link
Author

daddvok commented Jan 22, 2020

Maybe you can complement the wiki about TV? How to create a remote and volume buttons, because now you can achieve this only by trying everything in sequence

@Shaquu
Copy link
Member

Shaquu commented Jan 22, 2020

It's funny that it used to be an issue before :)

OK, should we expect the necessary improvements in 0.9.0?
Without them, the remote control is essentially inoperative because the node does not skip repeating events.

Originally posted by @cacherocks in #84 (comment)

Anyway. Calling @gotofoo because he is an author of last significant change in our code (except hap-nodejs dependency update).

I will look at it when I am back home.

@Shaquu
Copy link
Member

Shaquu commented Jan 22, 2020

I see a problem. I have an idea what we should do but again have no idea if we will break something or not.

ServiceUtils: here and here change from characteristic.updateValue to characteristic.setValue

ServiceUtils: here add node.send(msg) - problem is that we have different context and we don't have old value.

Latest discussion on hap-nodejs setValue vs updateValue: KhaosT/HAP-NodeJS#629
Calling @NorthernMan54 as he has some experience in this matter.

@Shaquu
Copy link
Member

Shaquu commented Jan 22, 2020

I did a change I proposed before but didn't pushed to dev yet.
How do you feel about message being posted twice when value is not repeated?

So first time when we click key 5 we receive key 5 twice in node-red (posted by onSet and onUpdate).
Second time we click key 5 we receive key 5 once (posted by onSet only).

If we click key 5 and then key 6 then we receive 4 messages, two for each key (if not repeated).

Another thing is that message posted by onSet will not contain oldValue (it will be undefined).

PS. 1.0.0-dev.6 pushed contains latest hap-nodejs 0.5.6 but there are no breaking changes I think.

@crxporter
Copy link
Member

So first time when we click key 5 we receive key 5 twice in node-red (posted by onSet and onUpdate).
Second time we click key 5 we receive key 5 once (posted by onSet only).

This wouldn't work unless there can be a check for remote items something like if (msg.hap.onUpdate != undefined)...

Then we could easily make a flow that only passes "onUpdate" messages and ignores "onSet", leaving us one message per button click.

Think of the case someone is trying to navigate a menu. They want to go to item 1 to 3 so they click down twice - it would send the message 3 times and end up at item 4. Then they click "up" - end up at item 2. Item 3 would seem impossible to get to unless you can filter out the extra presses.

@Shaquu
Copy link
Member

Shaquu commented Jan 22, 2020

Well, so solution to pass onUpdate/onSet in msg.hap is fine except we would force people to make another guards in scripts.
So maybe we should indeed add another checkbox in service config for it so duplication will not be a default behaviour?
Or we can join those two so add a checkbox and add event source to msg.hap (for example msg.hap.messageInitiatior=onSet/onUpdate)

@crxporter
Copy link
Member

What about an output for onSet and an output for onUpdate?

Can this be added for certain services only? I think Television and TelevisionSpeaker are the only ones I know of that need repeated messages.

@Shaquu
Copy link
Member

Shaquu commented Jan 22, 2020

Well good idea to use outputs.
From what I know we cannot make conditional amount of outputs.
So as now we have 2 outputs (payload and camera snapshot data) we would have to add another one and all services would have 3 outputs.

@crxporter
Copy link
Member

crxporter commented Jan 22, 2020

Function nodes, switch nodes, etc are built in and change number of outputs based on the function or switch. Perhaps there is a check box to enable/disable both camera snapshot and onUpdate outputs?

I’m not sure it’s possible but it could be a cool solution. Otherwise my vote goes for an additional output that outputs updates only to go along with the current outputting set (changes?) only.

@crxporter
Copy link
Member

A quick read of blocky readme seems like that node can add/remove outputs as it wants.

@Shaquu
Copy link
Member

Shaquu commented Jan 23, 2020 via email

@crxporter
Copy link
Member

Maybe all services should have 2 and camera should have 3?

This is probably good until we come up with reasons to change it. I believe most services send “onUpdate” Or similar whenever the Home app is opened, could be useful for some?

@Shaquu
Copy link
Member

Shaquu commented Jan 23, 2020

So I will try to to make it like:
Output 1: onUpdate
Output 2: onSet
(for Camera Service) Output 3: camera snapshot

Output 1 is onUpdate since right now it is default source.

@crxporter
Copy link
Member

Oh I had it confused I thought set was the one-time message.

Sounds great to me, good luck!!

Shaquu added a commit that referenced this issue Jan 23, 2020
Now first output is for onChange, second for onSet and third for camera snapshot #200
@Shaquu Shaquu mentioned this issue Jan 23, 2020
@Shaquu
Copy link
Member

Shaquu commented Jan 23, 2020

All right. #202 added new output to node.
output 1 is for onChange (old output 1, it's returned when oldValue is different then newValue)
output 2 is for onSet (new, it's returned when value is set, event when it's the same)
output 3 is for camera snapshot (old output 2, it appears only when service is Camera Control, it returns camera snapshot)

@crxporter @daddvok please test on dev

About update/set, previously we used characteristic.updateValue which fired onChange if value changed. Now we use characteristic.setValue and it fires onSet and onChange if value changed.

@crxporter
Copy link
Member

I’ll be testing first thing tomorrow morning.

Sounds pretty awesome, thanks!

@daddvok
Copy link
Author

daddvok commented Jan 24, 2020

updated, tested - it works fine, thanks to everyone!

@Shaquu
Copy link
Member

Shaquu commented Jan 24, 2020

If anyone have a time and would like to help.
Please test all features to check if anything broke:

  • creating new services
  • creating new bridges
  • editing services
  • editing bridges
  • removing service from bridge
  • allowMessagePassthrough feature
  • CameraService (and if camera snapshot output is working correctly?)
  • hap.context guard used by many

@daddvok
Copy link
Author

daddvok commented Jan 24, 2020

* creating new services
* creating new bridges
* CameraService
* hap.context guard used by many

After update I created 3 new bridges - fine, camera is working too (tested on codec h264_omx, but i don't know what about sound in camera, it should work?), hap.context is used in few cases, works fine.

@djiwondee
Copy link

@Shaquu

If anyone have a time and would like to help.

Would do this but I would need some guidance how to build (or get) the NPM installable package from the dev branch to deploy this on my DEV env based on RPi 3B+

@crxporter
Copy link
Member

@djiwondee - I just updated on my dev pi 4 running raspbian. Install should be the same.

1- install node-red
2- run this command:

sudo npm i -g node-red-contrib-homekit-bridged@1.0.0-dev.7

3- restart node-red using your favorite method

I tried without the -g flag last week and it didn't load up in my node-red environment automatically.

My comments:
-my remote works great! First time I've seen repeated commands come through. I want to try television speaker next.
-update was easy from dev.5 or dev.6 (can't remember)

I'll be going through more testing today and next week as I have time. Thanks for the quick turnaround as always, @Shaquu !

@Shaquu
Copy link
Member

Shaquu commented Jan 24, 2020

@djiwondee sure!

Installing with npm

To install a node module from the command-line, you can use the following command from within your user data directory (by default, $HOME/.node-red):

npm install
You will then need to restart Node-RED for it to pick-up the new nodes.

Recent versions of npm will automatically add the module to the dependencies section of the package.json file in your user directory.

So it will be npm i node-red-contrib-homekit-bridged@1.0.0-dev.7 or to install latest dev npm i node-red-contrib-homekit-bridged@dev

@crxporter
Copy link
Member

@Shaquu good morning/evening!

I prefer the -g tag for global install, then I don't have to remember where things are installed!

@Shaquu
Copy link
Member

Shaquu commented Jan 24, 2020

@crxporter its 2:30pm, so I guess good afternoon to me and good morning to you!

Global is not always good if you need specific package to be used in different versions. Without global you could test different versions on one device but I agree it’s easier :)

I would be very grateful if you all try to test it as much as possible. When I publish new version as official release and there is a bug then people will strike our Issues section 🗡

@crxporter
Copy link
Member

crxporter commented Jan 24, 2020

Let's move the 1.0.0 discussion to #163 so it's all together?

That being said, I'll keep this discussion here since it's directly related to TV item.

I just tested a TelevisionSpeaker item and I'm actually getting volume output from the control center remote! It seems like I've tried this before but with little/no success.

Configuration: Parent node is Television service. Linked node is TelevisionSpeaker service. Characteristic Properties are:

{
    "VolumeControlType":1,
    "VolumeSelector":true
}

With this, I get messages (repeated from the 2nd output) of VolumeSelector where 1 is volume down and 0 is volume up. I am guessing there are more configuration options for this to change over to a slider or other options.

Debug shows the following message when injecting {"Foo":"bar"}:

"Try one of these characteristics: Name, Mute, VolumeControlType, VolumeSelector, Active, Volume, VolumeControlType, VolumeSelector, Name"

Anyway this seems like progress! I have tried (unsuccessfully) a few times to get volume control to do anything.

@Shaquu - can you point me to any documentation on how to use this feature? It's not in the Spec R13...

@crxporter
Copy link
Member

Update - found the documentation.

here

Starting around line 412. If anyone's interested we can start building out some functional volume controls!

@Shaquu
Copy link
Member

Shaquu commented Jan 24, 2020

First thing. R13 might be older then R2.
R2 is half year old for non commercial.
R13 is year or more old leaked commercial specification.

This you found on hap-nodejs is generated by contributors and should comply to R2 I guess.

@crxporter
Copy link
Member

The HAP spec documents don't ever include the television or television service... I think guess-and-check is going to be the only option for this one.

@djiwondee
Copy link

@Shaquu @crxporter I don't know whether it makes sense to open a new issue fo my specific testings related to above would make sense here?

However, first of all I spend some time to test dev.7 with a switch and temperature service by adding a complete new bridge. What I've tested works so far :-) w/o any problems. So great work once again!!! I've not seen older error requiring restart node-red nor error message in debug node. Adding/removing services were always successful w/o making the bridge corrupt more breaking HomeKit.

After that I tried to wrap up the work on Support for service type Speaker
#94
with no success. The services I've intended to use are:

  • Television
  • Volume (linked to Television)
  • Input Source (linked to Television)
[{"id":"c1ca337b.bf952","type":"inject","z":"a2e28d89.2cea3","name":"Init Service Characterstics","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":"5","x":1920,"y":1480,"wires":[["96d2c60.582bb38"]]},{"id":"26691a10.99ccd6","type":"function","z":"a2e28d89.2cea3","name":"Init Hk Input Source TV","func":"msg.payload = {\n    \"Identifier\": 0,\n    \"IsConfigured\" : 1,\n    \"ConfiguredName\": \"Television\",\n    \"InputSourceType\": 1\n};\nreturn msg;","outputs":1,"noerr":0,"x":2190,"y":1600,"wires":[["d4a1ddfb.3ea7e"]]},{"id":"219095f0.ee4282","type":"function","z":"a2e28d89.2cea3","name":"Init Hk Input Source SWR3","func":"msg.payload = {\n    \"Identifier\": 1,\n    \"IsConfigured\" : 1,\n    \"ConfiguredName\": \"Radio SWR3\",\n    \"InputSourceType\": 2\n};\nreturn msg;","outputs":1,"noerr":0,"x":2200,"y":1640,"wires":[["5aa20a47.30d4c4"]]},{"id":"3340e62a.d77df2","type":"function","z":"a2e28d89.2cea3","name":"Init Hk Input Source HR3","func":"msg.payload = {\n    \"Identifier\": 2,\n    \"IsConfigured\" : 1,\n    \"ConfiguredName\": \"Radio HR3\",\n    \"InputSourceType\": 2\n};\nreturn msg;","outputs":1,"noerr":0,"x":2190,"y":1680,"wires":[["e30c9782.6ede6"]]},{"id":"a3be1207.daa5c8","type":"function","z":"a2e28d89.2cea3","name":"Init Hk Input Source Amazon","func":"msg.payload = {\n    \"Identifier\": 3,\n    \"IsConfigured\" : 1,\n    \"ConfiguredName\" : \"Amazon Music\",\n    \"InputSourceType\" : 0\n};\nreturn msg;","outputs":1,"noerr":0,"x":2200,"y":1720,"wires":[["79e3ecf9.2fc834"]]},{"id":"43e2b22b.7ddc74","type":"function","z":"a2e28d89.2cea3","name":"Init Hk Volume Service","func":"msg.payload = {\n \"Mute\": 0,\n \"Volume\" : {\n        \"minValue\":0,\n        \"maxValue\":100\n    }\n};\nreturn msg;","outputs":1,"noerr":0,"x":2180,"y":1560,"wires":[["dc32c496.c8e378"]]},{"id":"5afca437.3fbd74","type":"inject","z":"a2e28d89.2cea3","name":"Init Service Characteristics","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":"6","x":1900,"y":1560,"wires":[["43e2b22b.7ddc74","26691a10.99ccd6","219095f0.ee4282","3340e62a.d77df2","a3be1207.daa5c8"]]},{"id":"96d2c60.582bb38","type":"function","z":"a2e28d89.2cea3","name":"Init Hk TV Service","func":"msg.payload = {\n \"ConfiguredName\": \"Onkyo-AVR\",\n \"ActiveIdentifier\" : 0,\n \"SleepDiscoveryMode\" : 0,\n \"Active\" : 0\n};\nreturn msg;","outputs":1,"noerr":0,"x":2170,"y":1480,"wires":[["77e68443.66a7ec"]]},{"id":"77e68443.66a7ec","type":"homekit-service","z":"a2e28d89.2cea3","isParent":true,"bridge":"e933973b.f891d","parentService":"","name":"Onkyo-AVR","serviceName":"Television","topic":"","filter":false,"manufacturer":"Onkyo","model":"TX-NR676E","serialNo":"Default Serial Number","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{}","x":2450,"y":1480,"wires":[["8782034e.ea05c8"],[]]},{"id":"dc32c496.c8e378","type":"homekit-service","z":"a2e28d89.2cea3","isParent":false,"bridge":"","parentService":"77e68443.66a7ec","name":"Onkyo-AVR Volume","serviceName":"Speaker","topic":"","filter":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{\n    \"Mute\" : 0,\n    \"Volume\" : {\n        \"minValue\":0,\n        \"maxValue\":100\n    },\n    \"Name\" : \"Onkyo-AVR Volume\"\n}","x":2470,"y":1560,"wires":[["8782034e.ea05c8"],[]]},{"id":"8782034e.ea05c8","type":"debug","z":"a2e28d89.2cea3","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":2760,"y":1520,"wires":[]},{"id":"d4a1ddfb.3ea7e","type":"homekit-service","z":"a2e28d89.2cea3","isParent":false,"bridge":"","parentService":"77e68443.66a7ec","name":"Onkyo Input Source TV","serviceName":"InputSource","topic":"","filter":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{\n    \"Identifier\": 0,\n    \"IsConfigured\" : 1,\n    \"ConfiguredName\": \"Television\",\n    \"InputSourceType\": 1\n}","x":2490,"y":1600,"wires":[["8782034e.ea05c8"],[]]},{"id":"5aa20a47.30d4c4","type":"homekit-service","z":"a2e28d89.2cea3","isParent":false,"bridge":"","parentService":"77e68443.66a7ec","name":"Onkyo Input Source SWR3","serviceName":"InputSource","topic":"","filter":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{\n    \"Identifier\": 1,\n    \"IsConfigured\" : 1,\n    \"ConfiguredName\": \"Radio SWR3\",\n    \"InputSourceType\": 2\n}","x":2500,"y":1640,"wires":[[],[]]},{"id":"e30c9782.6ede6","type":"homekit-service","z":"a2e28d89.2cea3","isParent":false,"bridge":"","parentService":"77e68443.66a7ec","name":"Onkyo Input Source HR3","serviceName":"InputSource","topic":"","filter":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{\n    \"Identifier\": 2,\n    \"IsConfigured\" : 1,\n    \"ConfiguredName\": \"Radio HR3\",\n    \"InputSourceType\": 2\n}","x":2490,"y":1680,"wires":[[],[]]},{"id":"79e3ecf9.2fc834","type":"homekit-service","z":"a2e28d89.2cea3","isParent":false,"bridge":"","parentService":"77e68443.66a7ec","name":"Onkyo Input Source Amazon Music","serviceName":"InputSource","topic":"","filter":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{\n    \"Identifier\": 3,\n    \"IsConfigured\" : 1,\n    \"ConfiguredName\" : \"Amazon Music\",\n    \"InputSourceType\" : 0\n}","x":2520,"y":1720,"wires":[[],[]]},{"id":"e933973b.f891d","type":"homekit-bridge","z":"","bridgeName":"NRCHKBR","pinCode":"111-11-111","port":"","allowInsecureRequest":false,"manufacturer":"NRCHKBR","model":"Default Model","serialNo":"Dev.7","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true,"allowMessagePassthrough":true}]

image

The On/Off switch is working,

image

The control showing 'Television' seems to be like a slide, because you can swipe with that, but I just get one input source.
image

I also have a remote on my iPhone:
image

But there is now output while tapping on that. Maybe because I haven't set any characteristic properties for remote keys.

For verification of services and characteristics, once again I was dealing with the recent Apple HomeKit Simulator
image
There is no category "Television". Try to add characteristics with that tool, you can't find a characteristic 'Input Source' nor 'Volume'
image
Finally I was reading the related pages for characteristics of Apple Doc for HomeKit. There is no characteristics for Volume or Input Source defined anymore.

My Fazit: What ever for HAP-node has implemented here, I come to the point where I don't believe in a successful setup of these services with NRCHKB.
I'm not a specialist for HomeKit and Node-JS.Please, so don't understand me wrong! Your work is very good and I really appreciate this. I'm using NRCHKB more than a year now in a larger setup in production. But implementing a remote for my AVR seems not really possible.

@crxporter
Copy link
Member

@djiwondee you need to use the service TelevisionSpeaker to have volume control on the tv item. Look at my post up a couple for the characteristic properties that worked for me.

@Shaquu
Copy link
Member

Shaquu commented Jan 25, 2020

@crxporter are you really getting volume value or just 0/1?

@crxporter
Copy link
Member

I’m getting the 1/0 from the volume buttons on the phone. I haven’t investigated more than that to try to get a slider type or relay an actual volume number (0-100 is the available range). Some more fiddling is needed to get the config just right.

A good option may be to look at homebridge setups to see what they’ve figured out? That helped with cameras, could help figure out config on mimicking the full tv setup.

@Shaquu
Copy link
Member

Shaquu commented Jan 26, 2020 via email

@crxporter
Copy link
Member

Line 446 here looks like setup for volume control.

Line 120 here is another example. Interesting thing here might be setting VolumeControlType to ABSOLUTE?

I’m at home today and just on my phone so I haven’t read through the whole code or tried things. I also looked over onkyo, Denon, Marantz, etc but it seems homebridge development stopped once manufacturers started integrating with homekit. @Shaquu you might be able to make more of it than me...

@crxporter
Copy link
Member

I've been thinking and configuring this a bit more and I've realized - the controls we have access to with this plugin don't ever display a slider, do they?

In my native devices I can only get a slider type control for airplay devices, it doesn't ever show in the Home app or in the Control Center remote. So while {"VolumeControlType":3} may indeed be the slider type option, we might never actually SEE a slider.

Right?

@Shaquu
Copy link
Member

Shaquu commented Jan 28, 2020

@crxporter well I don't know yet :)
Would you mind to record how volume slider looks like and behave in native device in Home.app?
Where it shows?

Update. I couldn't make it to control volume from Control Center remote for TV + TV Speaker.
But like in example you provided I added Lightbulb as Linked to TV :)
So we have a way to control volume possibly? Not like the native way but still.

Screenshot from Home.app
You can see that Linked Lightbulb is displayed next to Active button IMG_55FCCD73EF52-1

@crxporter
Copy link
Member

The light bulb linked to a tv is - quite interesting.

Could be cool to set up like that with my tv backlights? Those are color leds though, even more interesting.

The only volume control slider I know of is in the control center like this:
DB98025A-35D4-4BA1-8280-B18C6BF230EC

Both of my official Apple TV’s show volume buttons like this:
FDC678C7-4A5F-43AB-8DD7-F82F3C16B947
B7807162-4F3C-411C-8EEA-9E105D324BB9

Each of these TVs shows volume as 1 through 100 on the television screen. Homekit does not seem to “see” this however.

I suppose the next test would be turn homekit on through my Vizio tv and see if it shows up as a slider...

Still this style remote only shows up when controlling airplay media. I don’t believe it’s available through the homekit protocol. At least I haven’t personally seen it anywhere else.

@Shaquu
Copy link
Member

Shaquu commented Jan 28, 2020

Indeed. We cannot add AirPlay support for our HomeKit NRCHKB TV.
So I guess we won't be able to add native volume support. I searched everywhere and no one mention this case (except some old beta versions of iOS but looks like it stoped to work).

About Lightbulb as Linked Service. Adding more (Hue, Colour) characteristics to Lightbulb caused slider to move down and appear in separate section under Lightbulb displayName but still grouped under TV accessory in Home.app. See here

@crxporter
Copy link
Member

So I guess we won't be able to add native volume support.

Agreed.

Let’s leave this thread open for a few more days please, if anyone is still trying to get this set up on dev branch, please speak up!

Shaquu added a commit that referenced this issue Feb 23, 2020
## [1.0.0] - 2020.02.23

Lost backward compatibility. In order to make it work read this [notice](#163 (comment)).

### Fixed

-   Node id macify algorithm changed [#170](#170)
-   Corrections regarding issue [#12](#12) so that changes can be deployed without restarting node-red
-   Automatically creating a new service and replacing the old one if the service type changed
-   Automatically replacing an accessory with a new one if the accessory information changes (e.g. Name, Manufacturer, ...)
-   Video Filter value in Camera Control is now optional [#194](#194) (can be empty, before it was generated if was empty)
-   Removed updateReachability as it is deprecated (and doesn't make a difference)

### Added

-   After Service selection in node configuration Category will be automatically set to default for Service
-   Interface Name for Camera Service configuration
-   Support for new TV Remote services
-   Now first output is for onChange, second for onSet and third for camera snapshot. [#200](#200)
-   Sponsor Button on repository page

### Changed

-   Accessory Category in node configuration moved under Service selection
-   Clarify NO_RESPONSE in README
-   Update node-red version in dependencies
-   Camera Service source code to match newest improvements in homebridge-camera-ffmpeg
-   Update to latest HAP-NodeJS
-   Removed unnecessary accessory category from service node
-   Removed fields Manufacturer, Serial Number and Model from linked service nodes
-   Moved eslint and prettier configuration to package.json
-   Added automatic linting on pre-commit


Thanks to all contributors!
@radokristof @NorthernMan54 @gotofoo 

And thanks to those who also helped in testing!
@crxporter @sjorge
@crxporter
Copy link
Member

@Shaquu, should be ready to close.

All- please open a new issue for version 1.0.0 or higher if you have more related issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 There is at least high chance that it is a bug!
Projects
None yet
Development

No branches or pull requests

4 participants