AndroidTV Binding [3.2.0;4.2.0)

Make sure you grab the upgraded one from androidtv, I reworked quite a bit when I did the move.

Yep, I grabbed it yesterday directly from your PR. :wink:

1 Like

Anyone having issues with the thing not coming online? I just noticed my things are staying in an offline state even when the whole thing is working.

Hmm. Yes. Mine is showing Offline Initializing. Even after a restart of the binding.

Shouldn’t it be marking the thing ONLINE at the end of the connect method?

No we wait for successful login. Just because we connect doesnt mean we had a successful pin login. It should go to setLoggedIn in the connection manager and then checkThingStatus in the handler.

Found the bug. Order of operations issue. We set isLoggedIn after checking for status. We need to do that first. I’ll fix and drop a new update tomorrow.

Mine states is offline too. However I think I have found another bug.
I disinstalled the binding and Shield TV thing and have redone the whole process. I had to restart openhab to get it to advertise the Shield in the INBOX. Once connected the and configured the keys I was able to operate the Shield without having to repeat the login process. Even sending the request for the pin did not result in a new pin being deisplayed.

I am new to openhab and still getting the grips with it not to mention that having installed in a container on a NAS most of the tutorials do not work. Any idea how to access the logs?

Never mind, I found it and it was not all that difficult.

2023-02-02 06:58:03.223 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘SHIELD_TV_Key_Press’ received command KEY_BACK
2023-02-02 06:58:03.224 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item ‘SHIELD_TV_Key_Press’ predicted to become NULL
2023-02-02 06:58:11.454 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘SHIELD_TV_Key_Press’ received command KEY_BACK
2023-02-02 06:58:11.455 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item ‘SHIELD_TV_Key_Press’ predicted to become NULL
2023-02-02 06:58:15.473 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘SHIELD_TV_Key_Press’ received command KEY_ENTER
2023-02-02 06:58:15.474 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item ‘SHIELD_TV_Key_Press’ predicted to become NULL
2023-02-02 06:58:26.645 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘SHIELD_TV_Key_Press’ received command KEY_RIGHT
2023-02-02 06:58:26.646 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item ‘SHIELD_TV_Key_Press’ predicted to become NULL
2023-02-02 06:58:30.151 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘SHIELD_TV_Key_Press’ received command KEY_ENTER
2023-02-02 06:58:30.152 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item ‘SHIELD_TV_Key_Press’ predicted to become NULL
2023-02-02 06:58:39.784 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘SHIELD_TV_Key_Press’ received command KEY_MENU
2023-02-02 06:58:39.785 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item ‘SHIELD_TV_Key_Press’ predicted to become NULL

Another thing. I have input the names of the apps in the app channel. I seem not to be able to start Kodi. Any ideas?

Uploaded version 0.03 to fix the thing online issue. @Norixone give this version of the binding a test to see if it fixes the buttons going to null.

As for your issue with kodi, what are you sending to the app channel to try to start it?

Are you sure that fixed the problem with the thing not coming online?

I see the “Login Successful” message in my log, but now it’s not even pulling the app list.

Yeah i messed that up lol. Not enough coffee. I put the line on the wrong side of the if statement. Ill fix shortly. Sorry!

This uncovered an issue I had not considered in the handler where the thing status may not be properly set when we add the googletv protocol. I’m going to try to hit two birds with one stone and fix that as well. Please standby while I work through that. Thanks!

Ok, let’s try this one. 53740f7 is now uploaded. That should fix the thing status issues. @mhilbush since you said you had recently used the handler, check out what I did on the ThingHandler for monitoring status on the protocols. It works much better now.

This is what you should see in your logs now:

2023-02-02 12:58:25.292 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'androidtv:shieldtv:livingroom' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
2023-02-02 12:58:25.295 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'androidtv:shieldtv:livingroom' changed from INITIALIZING to OFFLINE: Protocols Starting
2023-02-02 12:58:25.340 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'androidtv:shieldtv:livingroom' changed from OFFLINE: Protocols Starting to OFFLINE: ShieldTV: Initializing
2023-02-02 12:58:25.424 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'androidtv:shieldtv:livingroom' changed from OFFLINE: ShieldTV: Initializing to ONLINE

I’m working on creating the JSON APP channel to give the users access to what we’re getting back from the shield so it’s less guess work. This is a rough example of the format I’m using.

{“org.openhab”:{“name”:“OpenHab”,“url”:“http”},“org.google”:{“name”:“Google”,“url”:“http”}}

Each entry is basically “appdn”:{“name”:“appname”,“url”,“appurl”}

Thoughts?

Yep. It’s online, and that’s what I see. :+1:

Sorry, it’s not clear to me what the objective is. You want to make it easy for the user to access the AppName and AppDN? Can’t you just create dynamic state options or command options on the existing app channel? That way the app list will be available automatically in the UI (e.g. through the Selection widget in sitemap and HABpanel; not sure about how to do it in Main UI).

And it’s probably just my lack of knowledge, but how would the user use the AppURL?

Dynamic state is also on my list. This is more for folks who want the raw data for rules. Or just for folks that want to see what’s available. I guess I’m still old school, i do most of my configuration on cli, I’m rarely in the UI.

And I have no idea on the appurl. My theory is that it allows access to the app apis. I know some Android TV apps allow for remote control of the app itself, I’m assuming this could be the way in.

Hi morph166955. This is the command line I am using for Kodi org.xbmc.kodi

Just to be sure I am doing things right here. In order to get the KEY_PRESS channel working I usually add a link and in the link to the channel and use the Command Options in the metadata field. There I copy all the available commands. Is this the right procedure or is there another way?