AndroidTV Binding [3.2.0;4.2.0)

Thanks again for staying with me.

I named them both just “SHIELD”. I dont get to choose the "androistv:[shield|google] part of it. This is how it looks like when I use a scan to discover them:

…when I add it:

then that part I can edit and turn it into “SHIELD” with both of the discovered bindings

Im using openhab-3.4.2

I see what you’re saying now. Ok, then the next question is, are you creating new items against the googletv thing once you create it?

yes new items for googletv.

So I have a set of items for shield. (all of them working and the thing shows online) and a set of items for googletv (not working and the thing shows offline)

of coiurse the names of the items are different because I cant have 2 items with the same name though

Can you send me the trace log of what happens when you do openhab:send GOOGLETV_PINCODE REQUEST (replace with whatever your googletv pincode channel is)? It’s odd that it’s doing nothing at all.

Jesus! now it actually worked…could it have to do with the fact that I started OH with start_debug.sh this time? that’s the only thing Ive done different

So now they are both online. And if I pause/disable the thing created with shield:

now it doesn mess up with the on screen keyboard any more and I can still control it using the items from the thing created with GoogleTV…this is exactky the set up I wanted

I would still love to debug the binding so if you have any hints for why Im getting those errors when loading the jar I created lemme know. But I dont wanna take more of your time with my issues and incompetence for java :rofl:

thanks for the help! Ill keep playing around and will share any interesting findings.

BTW if the googletv binding seems to work (now), why do we need two?

Yay! Glad to hear it’s working and this also identifies that it’s the shieldtv protocol which causes this issue. I’ll note a caveat somewhere for future reference.

So there are differences between shieldtv and googletv. Namely app control. GTV is read only and does not provide the database that shieldtv provides (appname and appurl are not used). Otherwise it’s basically the same as shieldtv builds on top of the googletv capabilities.

Does it still work if you don’t use start_debug.sh? I hate suggesting for you to mess around after you’ve got it working, but at some point you’re going to have to restart. Better to find out what’s going to happen now.

I’d also be curious as to what happens if you remove the binding you compiled and install from the Community Marketplace.

yeah. Im the kind of guy that rolls over in bed all night long for not having an explanation for things. more imortant like you said I wont sleep thinking I can not make it work again later. So I just tested this with my “production” OH set up …and…

(production was started with start.sh)

  1. I add the thing with googleTV binding, create items, and as I was expecting PINCODE doesnt work
  2. I delete evrything (equipment from semantic model, items, links, uninstall the binding which was installed from marketplace)
  3. restart OH
  4. Add everything again
  5. PINCODE works!

:man_shrugging: go figure, as long as I know how to restore it next time it breaks Im happy

1 Like

I think I missed this somewhere. Was the jar used the one posted above or one compiled separately?

All my tests were made with Community Market place version of the binding. On a sidetrack Im trying to compile and debug the binding too

So remember, this binding is written for 4.0.0. I have some extra bits in place on my side to compile the jar to also be backwards compatible with 3.4.0.

oooh gotcha. Ill try with 4.0.0 then. Thanks a whole bunch!

No problemo. See [androidtv] AndroidTV Binding initial contribution by morph166955 · Pull Request #14282 · openhab/openhab-addons · GitHub if you are curious as to the differences. I have since pulled it out of the git repo in anticipation of it merging into the main repo. If you apply that it should compile clean.

100% this. :wink:

I blame random caching gremlins.

From time to time I get this error:

2023-05-03 04:28:20.262 [ERROR] [y.mdns.internal.MDNSDiscoveryService] - Participant 'org.openhab.binding.androidtv.internal.discovery.GoogleTVDiscoveryParticipant' threw an exception
java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
	at org.openhab.binding.androidtv.internal.discovery.GoogleTVDiscoveryParticipant.createResult(GoogleTVDiscoveryParticipant.java:67) ~[?:?]
	at org.openhab.core.config.discovery.mdns.internal.MDNSDiscoveryService.createDiscoveryResult(MDNSDiscoveryService.java:222) ~[?:?]
	at org.openhab.core.config.discovery.mdns.internal.MDNSDiscoveryService.considerService(MDNSDiscoveryService.java:214) ~[?:?]
	at org.openhab.core.config.discovery.mdns.internal.MDNSDiscoveryService.serviceResolved(MDNSDiscoveryService.java:207) ~[?:?]
	at javax.jmdns.impl.ListenerStatus$ServiceListenerStatus.serviceResolved(ListenerStatus.java:106) ~[?:?]
	at javax.jmdns.impl.JmDNSImpl$1.run(JmDNSImpl.java:911) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]

Do you know the reason or is it possible to disable? Everything is working as expected.
It only happens when TV is switched off and Thing is Offline:

image

As soon as I trigger WOL or switch on TV manually the thing goes Online. All good :slightly_smiling_face:

Do you need a trace?

Ill go dig through the code later today and see what that is. Can you confirm you’re on the current build? I fixed a few things in discovery recently. Also just to confirm, you turn the TV off (not unplugged) and I assume the TV loses network connection because it goes into a sleep state?

I was getting that error message, but we unplug the TV at night. I figured it was unavoidable and not part of the Android TV binding I just used the Regex fiilter in the log4j2.xml add “Participant” to my other annoying messages. :slightly_smiling_face:

<RollingFile fileName="${sys:openhab.logdir}/openhab.log" filePattern="${sys:openhab.logdir}/openhab.log.%i" name="LOGFILE">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5.5p] [%-36.36c] - %m%n"/>
<RegexFilter onMatch="DENY" onMismatch="NEUTRAL" regex=".*(Unauthorized API request|Participant|openHAB Cloud|text/plain).*"/>

I just pushed a small update to fix the exception. Please let me know if there are any issues.

Updated yesterday evening and no errors until now. Looks good, thanks!

Perfect. Ive pushed the fix to the PR as well.