AndroidTV Binding [3.2.0;4.2.0)

For anyone having the current issue, can you plesse confirm version numbers on your device for the following… (this is what my Shield currently has)

Sorry for the spam. There IS a breaking update for 4.39 which will require a change on our side. Please avoid updating your devices beyond 4.38 until I can make changes, test, and publish an update.

1 Like

I’ve uploaded a new version (8b79ccc) that may fix the issue with the upgraded GoogleTV code. I have no way to test here as I’m still on the older code. I can say that I’m having issues with my shield and the PIN process not connecting properly. It finally worked after a few power cycles. If someone who has the error message can try to upgrade their binding and test the new login that would be appreciated.

I uploaded one small update this morning (7d7ce37) to add some additional logging with the PIN process. I had several issues with my shield last night (which turned out to be entirely the shield, not the binding). This logging will help debugging PIN issues in the future. If you aren’t having PIN issues, you can skip this update, it doesn’t do anything that the update from last night did in respect to actual interaction with the device.

That all said, if you are having PIN issues, my suggestion is to try the following:

  1. uninstall the binding
  2. find your userdata folder (/var/lib/openhab or /userdata if on docker normally), find the androidtv folder in it, and delete all of the .keystore files
  3. reinstall the binding
  4. rerun the PIN process

It’s unclear to me, because of the issues I had, if PIN needs to be rerun now that we’ve adapted for GoogleTV 4.39.

Hi everyone.

If interested, I would like to give you this widget to request and send the PIN to connect the TV easily.

uid: androidtv_pairingtool
tags:
  - androidtv
  - pairing tool
props:
  parameters:
    - description: Title of the card
      label: Title
      name: set_card_title
      required: false
      type: TEXT
      groupName: grp_card_parameters
      advanced: false
    - default: "true"
      description: Show/Hide icon for the widget card
      label: Widget icon
      name: set_card_icon_show
      required: false
      type: BOOLEAN
      groupName: grp_card_parameters
      advanced: true
    - default: "true"
      description: Show border of the widget card
      label: Widget border
      name: set_card_border_show
      required: false
      type: BOOLEAN
      groupName: grp_card_parameters
      advanced: true
    - context: item
      description: Item to manage pairing using a PIN code. Plase select tv PIN CODE item!
      label: Item
      name: set_tv_pin_item
      required: true
      type: TEXT
      groupName: grp_item_parameters
      advanced: false
  parameterGroups:
    - name: grp_card_parameters
      label: Card parameters
    - name: grp_item_parameters
      label: Android TV items parameters
timestamp: May 28, 2023, 7:10:05 PM
component: f7-card
config:
  style:
    border-radius: 5px
    box-shadow: "=props.set_card_border_show ? 1px 1px 1px 1px rgba(0,0,0,0.1) : 0px 0px 0px 0px rgba(0,0,0,0.0)"
    noShadow: =props.set_card_border_show
    padding: false
    position: relative
slots:
  default:
    - component: f7-card-header
      config:
        visible: "=props.set_card_icon_show ? true : props.set_card_title ? true : false"
      slots:
        default:
          - component: oh-icon
            config:
              height: 19px
              icon: lock
              visible: =props.set_card_icon_show
          - component: Label
            config:
              style:
                color: "=themeOptions.dark === 'dark' ? set_color_dark_theme : set_color_light_theme"
                margin-left: "=props.set_card_icon_show ? '30px' : '0px'"
                position: absolute
              text: =props.set_card_title
    - component: f7-block
      config:
        class:
          - padding
        style:
          --f7-button-bg-color: var(--f7-card-bg-color)
          --f7-button-text-color: var(--f7-text-color)
          --f7-theme-color-rgb: var(--f7-color-blue-rgb)
      slots:
        default:
          - component: oh-label-card
            config:
              class:
                - margin-bottom
              label: =vars.pincode
              outline: true
          - component: f7-row
            config:
              class:
                - margin
            slots:
              default:
                - component: oh-repeater
                  config:
                    for: digit
                    fragment: true
                    in:
                      - "1"
                      - "2"
                      - "3"
                      - "4"
                      - "5"
                      - "6"
                      - "7"
                      - "8"
                      - "9"
                      - "0"
                      - A
                      - B
                      - C
                      - D
                      - E
                      - F
                  slots:
                    default:
                      - component: f7-col
                        config:
                          class:
                            - margin-vertical-half
                          width: "25"
                        slots:
                          default:
                            - component: oh-button
                              config:
                                action: variable
                                actionVariable: pincode
                                actionVariableValue: "=(vars.pincode) ? vars.pincode + loop.digit : loop.digit"
                                large: true
                                raised: true
                                text: =loop.digit
          - component: f7-row
            config:
              class:
                - margin
              style:
                --f7-button-bg-color: transparent
            slots:
              default:
                - component: f7-col
                  slots:
                    default:
                      - component: oh-button
                        config:
                          action: command
                          actionCommand: REQUEST
                          actionItem: =props.set_tv_pin_item
                          class: []
                          disabled: =!props.set_tv_pin_item
                          fill: true
                          large: true
                          style:
                            --f7-button-hover-bg-color: var(--f7-color-blue-tint)
                            --f7-button-pressed-bg-color: var(--f7-color-blue-tint)
                            --f7-theme-color: var(--f7-color-blue)
                          text: Request
                - component: f7-col
                  slots:
                    default:
                      - component: oh-button
                        config:
                          action: variable
                          actionVariable: pincode
                          actionVariableValue: ""
                          disabled: =!vars.pincode
                          large: true
                          text: Clear
                - component: f7-col
                  slots:
                    default:
                      - component: oh-button
                        config:
                          action: command
                          actionCommand: =vars.pincode
                          actionItem: =props.set_tv_pin_item
                          class: []
                          clearVariable: pincode
                          disabled: =!vars.pincode || !props.set_tv_pin_item
                          fill: true
                          large: true
                          style:
                            --f7-button-hover-bg-color: var(--f7-color-green-tint)
                            --f7-button-pressed-bg-color: var(--f7-color-green-tint)
                            --f7-theme-color: var(--f7-color-green)
                          text: Send

In the Set Props section, simply select the PINCODE item.

2 Likes

Thanks for creating the AndroidTV binding!
It works as a charm on my Philips 43PUS8545/12.
It has Android version 9 and I am running openHAB 3.4.4.
I am using it together with the Philips TV (2016+) Binding to control the Ambilight as well.
Keep up the excellent work! :smiley:

1 Like

Someone has a working sitemap example ?
Thank you

Sitemaps are really “depending on use case” for this, which is why I didn’t include one. There are probably a few like power that would be a no brainer, but when you start to use keycodes it becimes far more complicated to have a set example.

@OMR were you able to get your thing online with the new code release or are you still having the issue?

Thank You for this binding… I love it. It works great for onscreen remotes.

Haven’t been able to try yet.
The TV is at my cabin. Could be a few more weeks …

@morph166955 i have a Sony Bravia KDX running Android TV, i am not able to make this work:

14:44:24.370 [INFO ] [ol.googletv.GoogleTVConnectionManager] - 9C305B768D04 - Error opening GoogleTV SSL connection to bravia01:6466 Connection reset by peer
14:44:31.751 [INFO ] [ol.googletv.GoogleTVConnectionManager] - 9C305B768D04 - Error opening GoogleTV SSL connection to 192.168.1.14:6467 Connection reset

Seems like port 6466 is not open, this is my NMAP:

PORT     STATE    SERVICE
53/tcp   open     domain
80/tcp   filtered http
8008/tcp filtered http
8009/tcp filtered ajp13
8443/tcp filtered https-alt
9000/tcp filtered cslistener
9080/tcp filtered glrpc

I tried to use 8443 and it times out, ideas?

It looks like you dont have the google video app installed.

Google TV is installed

Edit: actually port is open, still debugging the connection, cant get the PIN request to work

Is the binding now working?

I can get the pin code show up, then when i send it:

16:32:07.725 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'TV_soggiorno_9C305B768D04_Pin_Code' received command 5EC3C0
16:32:07.730 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item 'TV_soggiorno_9C305B768D04_Pin_Code' predicted to become NULL
16:32:20.338 [WARN ] [se.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: undefined
16:32:32.864 [WARN ] [se.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: undefined
16:32:51.736 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'TV_soggiorno_9C305B768D04_Pin_Code' received command 5EC3C0
16:32:51.742 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item 'TV_soggiorno_9C305B768D04_Pin_Code' predicted to become NULL

And it never binds, but its something!!
@Fabrizio_Valtorta thanks for your widget, quite useful

It looks like something is wrong with your item configuration.

Let me try from scratch (item was automatically discovered)

Edit: it worked! thanks @morph166955 this is awesome! so i had to:

  • Remove the binding
  • Add it again, logs are showing SSL error, ignored that
  • Sent the REQUEST command when TV was on and not in TV mode
  • Waited for PIN (which might take a while)
  • Entered

Nice!!

Everything seems to work fine except volume, i now have to understand how to use the app channel to properly map a few buttons to open netflix… but everything else just awesome

1 Like

Hello.

I have the following problem. When my TV goes to standby, the Thing goes offline. So far so good. Yet, after a day or two the Thing seems to fail to reconnect. I have to disable and reenable it to make it work again.

My configuration:

UID: androidtv:googletv:tv
label: GoogleTV
thingTypeUID: androidtv:googletv
configuration:
  ipAddress: 192.168.178.44
  reconnect: 60

How long are you giving it to reconnect once it comes out of standby? Theres a backoff to prevent flooding.