# \[SOLVED\] LG TV binding Netcast 3.0 issue connecting with TV

**URL:** <https://community.openhab.org/t/solved-lg-tv-binding-netcast-3-0-issue-connecting-with-tv/59071>\
**Category:** Items & Sitemaps\
**Tags:** sitemap1, lgtv, items\
**Created:** [December 7, 2018, 5:14pm UTC](https://community.openhab.org/t/solved-lg-tv-binding-netcast-3-0-issue-connecting-with-tv/59071 "2018-12-07T17:14:08Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![andy31](https://community.openhab.org/user_avatar/community.openhab.org/andy31/32/30662_2.png) [@andy31](https://community.openhab.org/u/andy31)\
**Post date:** [December 7, 2018, 5:14pm UTC](https://community.openhab.org/t/solved-lg-tv-binding-netcast-3-0-issue-connecting-with-tv/59071/1 "2018-12-07T17:14:08Z")

</div>

Evening everyone,

I am trying to integrate my LG smart tv with openhab (version 2.3.0). From the LG website I got information that TV model has Netcast 3.0 platform (not WebOS) so I installed the correct LG TV binding.

lgtv.cfg was amended as per manual:

```csv
# The ip address of the lgtv (required)
#<lgtvId1>.host=
lgtv:lg.host=192.168.1.200

# The TCP port to use (optional, defaults to 8080)
#<lgtvId1>.port=
lgtv:lg.port=8080

# The the pairkey / if it's wrong the device shows the right pairkey
# at every connection attempt
#<lgtvId1>.pairkey=
lgtv:lg.pairkey=

# The TCP port address of the openhab system to receive lgtv status messages
# (only first occurrence is used for all TVs)
#<lgtvId1>.serverport=
lgtv:lg.serverport=8080

# The location to put XML files with the information of availiable
# channels and apps (optional)
#<lgtvId1>.xmldatafiles=./
lgtv:lg.xmldatafiles=./

# The check alive interval (optional, defaults to 60secs)
#<lgtvId1>.checkalive=
lgtv:lg.checkalive=60

```

Then I used the sitemap and items from manual:

sitemap

```csv
}
		Frame label="Tv" {
        Switch item=LgTvConnStatus
        Switch item=LgTvPower mappings=[ON="Power Off"]
        Setpoint item=LgTvChannel minValue=0 maxValue=300 step=1.0
        Setpoint item=LgTvVolume minValue=0 maxValue=100 step=1.0
        Switch item=LgTvMute mappings=[ON="Mute", OFF="Mute"]
        Text item=LgTvChannelName
        Selection item=LgTvChannel mappings=[1="ORF1",2="ORF2"]
        Switch item=LgTvAppExecute label="AppExecute" mappings=[Skype=Skype, Spotify=Spotify]
        Switch item=LgTvAppTerminate label="AppTerminate" mappings=[Skype=Skype, Spotify=Spotify]
    }
    }

```

items

```csv
/* LGTV
Switch LgTvPower "Power Command" (GF_Living) {lgtv="ON:lg:POWER"}
Switch LgTvMute "Mute" (GF_Living) {lgtv="ON:lg:KEY_MUTE, OFF:lg:KEY_MUTE"}
Number LgTvVolume "lgVolume [%.1f]" (GF_Living) {lgtv="INIT:lg:VOLUME_CURRENT, INCREASE:lg:VOLUME_UP, DECREASE:lg:VOLUME_DOWN, *:lg:VOLUME_SET"}
Number LgTvChannel "Channel [%.1f]" (GF_Living) {lgtv="INIT:lg:CHANNEL_CURRENTNUMBER, INCREASE:lg:CHANNEL_UP, DECREASE:lg:CHANNEL_DOWN, *:lg:CHANNEL_SET" }
String LgTvChannelName "Channelname [%s]" (GF_Living) {lgtv="INIT:lg:CHANNEL_CURRENTNAME"}
String LgTvGetChannels "getchannels [%s]" (GF_Living) {lgtv="INIT:lg:GET_CHANNELS, ON:lg:GET_CHANNELS"}
String LgTvGetApps "getapps [%s]" (GF_Living) {lgtv="INIT:lg:GET_APPS, ON:lg:GET_APPS"}
String LgTvAppExecute "excuteapp" (GF_Living) {lgtv="*:lg:APP_EXECUTE"}
String LgTvAppTerminate "terminateapp" (GF_Living) {lgtv="*:lg:APP_TERMINATE"}
Switch LgTvConnStatus "connstatus " (GF_Living) {lgtv="*:lg:CONNECTION_STATUS"} 

```

I haven`t restarted my RPI at this point yet - not sure if this should be performed right now or this step is not required.

On openhab app I can`t see any items listed under TV, there is only empty “TV” frame. Not sure exactly where this problem is lying, checking syntax everything appears to be correct.

![TV](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/0/c/0ce8bb78b0e36cc5ef474d7243c25f85d09266d7.png)

Checking openhab log I can see the following errors. How do I get per key ?

 ![openhab%20log](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/4/d/4dcfb44141330f8068c4c967ce837c4324e61cfa.png)

Searching for an answer on community, I can`t find anyone who would have success with this binding so if we could find solution this would be great tutorial for anyone who is trying to use it. I hope I can find someone who already experienced similar issues before.

Many thanks

---

<div class="post-metadata">

**Author:** ![Dim](https://community.openhab.org/user_avatar/community.openhab.org/dim/32/4568_2.png) [@Dim](https://community.openhab.org/u/Dim)\
**Post date:** [December 7, 2018, 5:24pm UTC](https://community.openhab.org/t/solved-lg-tv-binding-netcast-3-0-issue-connecting-with-tv/59071/2 "2018-12-07T17:24:44Z")

</div>

> [@andy31](#):
>
> lgtv.cfg was amended as per manual:

try to use this one:

```auto
pid:org.openhab.lgtv
lgtv.host=192.168.1.200
lgtv.port=8080
lgtv.pairkey=
lgtv.serverport=8080
lgtv.xmldatafiles=./
lgtv.checkalive=60

```

you will need the pairkey according to my understanding

Configurations in `*.cfg` files for legacy (1x) bindings on openHAB2 do not require the binding name prefix (since each legacy binding is using its own `*.cfg` file)

Also: your alias was `lg` (not `lgtv` as in your Items file)

```auto
lgtv:lg:...
^^^^:xx
bind:alias

```

The first line (pid) is used temporarily in order to “clean up” any previous configurations (e.g. the `lg` alias).  
After all is ok, you can remove it from lgtv.cfg

edit: found a typo (`mgtv`) in: [LG TV - Bindings | openHAB](https://www.openhab.org/addons/bindings/lgtv1/#example) 🙂

---

<div class="post-metadata">

**Author:** ![Dim](https://community.openhab.org/user_avatar/community.openhab.org/dim/32/4568_2.png) [@Dim](https://community.openhab.org/u/Dim)\
**Post date:** [December 7, 2018, 5:35pm UTC](https://community.openhab.org/t/solved-lg-tv-binding-netcast-3-0-issue-connecting-with-tv/59071/3 "2018-12-07T17:35:31Z")

</div>

correction: .port should default to 60128 (not 8080) according to the docs.  
change it in `lgtv.port=`

---

<div class="post-metadata">

**Author:** ![Dim](https://community.openhab.org/user_avatar/community.openhab.org/dim/32/4568_2.png) [@Dim](https://community.openhab.org/u/Dim)\
**Post date:** [December 7, 2018, 5:55pm UTC](https://community.openhab.org/t/solved-lg-tv-binding-netcast-3-0-issue-connecting-with-tv/59071/4 "2018-12-07T17:55:06Z")

</div>

> [@andy31](#):
>
> /\* LGTV

close the comment 🙂 (otherwise your Items are not loaded)

```auto
/* LGTV */

```

> [@andy31](#):
>
> How do I get per key ?

According to the docs: “if it’s wrong the device shows the right pairkey at every connection attempt”

---

<div class="post-metadata">

**Author:** ![andy31](https://community.openhab.org/user_avatar/community.openhab.org/andy31/32/30662_2.png) [@andy31](https://community.openhab.org/u/andy31)\
**Post date:** [December 7, 2018, 6:02pm UTC](https://community.openhab.org/t/solved-lg-tv-binding-netcast-3-0-issue-connecting-with-tv/59071/5 "2018-12-07T18:02:30Z")

</div>

Thank you Angelos,

I changed my lgtv.cfg content as follow:

```csv
pid:org.openhab.lgtv

# The ip address of the lgtv (required)
#<lgtvId1>.host=
lgtv.host=192.168.1.200

# The TCP port to use (optional, defaults to 8080)
#<lgtvId1>.port=
lgtv.port=60128

# The the pairkey / if it's wrong the device shows the right pairkey
# at every connection attempt
#<lgtvId1>.pairkey=
lgtv.pairkey=548567

# The TCP port address of the openhab system to receive lgtv status messages
# (only first occurrence is used for all TVs)
#<lgtvId1>.serverport=
lgtv.serverport=8080

# The location to put XML files with the information of availiable
# channels and apps (optional)
#<lgtvId1>.xmldatafiles=./
lgtv.xmldatafiles=./

# The check alive interval (optional, defaults to 60secs)
#<lgtvId1>.checkalive=
lgtv.checkalive=60

```

Since changing tv port number to 60128 I now get pop up message on my TV with pairing key. The number displayed on TV is shown with spaces every two digits , assuming I have to enter it without any spaces between them. So I done that but I still seen the same pop up few times every few minutes.

You mentioned about possible error in items , what exactly I need to change there, sorry I didn`t get that.

---

<div class="post-metadata">

**Author:** ![andy31](https://community.openhab.org/user_avatar/community.openhab.org/andy31/32/30662_2.png) [@andy31](https://community.openhab.org/u/andy31)\
**Post date:** [December 7, 2018, 6:04pm UTC](https://community.openhab.org/t/solved-lg-tv-binding-netcast-3-0-issue-connecting-with-tv/59071/6 "2018-12-07T18:04:21Z")

</div>

Just updated picture from the openhab log

 ![openhag%20log%202](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/7/b/7b5e3d2746e80803fe5f55dd38e8b0f525fd2300.png)

---

<div class="post-metadata">

**Author:** ![Dim](https://community.openhab.org/user_avatar/community.openhab.org/dim/32/4568_2.png) [@Dim](https://community.openhab.org/u/Dim)\
**Post date:** [December 7, 2018, 6:06pm UTC](https://community.openhab.org/t/solved-lg-tv-binding-netcast-3-0-issue-connecting-with-tv/59071/7 "2018-12-07T18:06:01Z")

</div>

> [@andy31](#):
>
> You mentioned about possible error in items , what exactly I need to change there, sorry I didn`t get that.

Your Items file needs a small correction:  
You started a comment line `/* LGTV` but never closed the comment (with `*/`)  
this means that the entire file is considered as a big comment 🙂

close the comment at the first line to allow OH2 to read the Items

```auto
/* LGTV */
^^ ^^
open close

```

---

<div class="post-metadata">

**Author:** ![H102](https://community.openhab.org/user_avatar/community.openhab.org/h102/32/25595_2.png) [@H102](https://community.openhab.org/u/H102)\
**Post date:** [December 7, 2018, 6:08pm UTC](https://community.openhab.org/t/solved-lg-tv-binding-netcast-3-0-issue-connecting-with-tv/59071/8 "2018-12-07T18:08:20Z")

</div>

Or use two forward slashes.😉

// LGTV

---

<div class="post-metadata">

**Author:** ![andy31](https://community.openhab.org/user_avatar/community.openhab.org/andy31/32/30662_2.png) [@andy31](https://community.openhab.org/u/andy31)\
**Post date:** [December 7, 2018, 6:08pm UTC](https://community.openhab.org/t/solved-lg-tv-binding-netcast-3-0-issue-connecting-with-tv/59071/9 "2018-12-07T18:08:29Z")

</div>

Sorry, I got that , just closed the comment, still no items shown.

---

<div class="post-metadata">

**Author:** ![Dim](https://community.openhab.org/user_avatar/community.openhab.org/dim/32/4568_2.png) [@Dim](https://community.openhab.org/u/Dim)\
**Post date:** [December 7, 2018, 6:09pm UTC](https://community.openhab.org/t/solved-lg-tv-binding-netcast-3-0-issue-connecting-with-tv/59071/10 "2018-12-07T18:09:38Z")

</div>

does the log file still complain about “cannot retrieve item…” ?

---

<div class="post-metadata">

**Author:** ![andy31](https://community.openhab.org/user_avatar/community.openhab.org/andy31/32/30662_2.png) [@andy31](https://community.openhab.org/u/andy31)\
**Post date:** [December 7, 2018, 6:25pm UTC](https://community.openhab.org/t/solved-lg-tv-binding-netcast-3-0-issue-connecting-with-tv/59071/11 "2018-12-07T18:25:06Z")

</div>

Currently log is displaying error with pair key so still cant connect to tv.

 ![log%201](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/a/4/a488afb384274a864999a3129a2ccfe2f9066b30.png)

It`s throwing this error every 10 seconds.

Just to mention , I restarted RPI few minutes ago but made no difference.

---

<div class="post-metadata">

**Author:** ![Dim](https://community.openhab.org/user_avatar/community.openhab.org/dim/32/4568_2.png) [@Dim](https://community.openhab.org/u/Dim)\
**Post date:** [December 7, 2018, 6:29pm UTC](https://community.openhab.org/t/solved-lg-tv-binding-netcast-3-0-issue-connecting-with-tv/59071/12 "2018-12-07T18:29:15Z")

</div>

did you get the pairkey from your TV?  
can you post the updated lgtv.cfg file?

---

<div class="post-metadata">

**Author:** ![andy31](https://community.openhab.org/user_avatar/community.openhab.org/andy31/32/30662_2.png) [@andy31](https://community.openhab.org/u/andy31)\
**Post date:** [December 7, 2018, 6:35pm UTC](https://community.openhab.org/t/solved-lg-tv-binding-netcast-3-0-issue-connecting-with-tv/59071/13 "2018-12-07T18:35:11Z")

</div>

lgtv.cfg file looks as follow

```csv
pid:org.openhab.lgtv

# The ip address of the lgtv (required)
#<lgtvId1>.host=
lgtv.host=192.168.1.200

# The TCP port to use (optional, defaults to 8080)
#<lgtvId1>.port=
lgtv.port=60128

# The the pairkey / if it's wrong the device shows the right pairkey
# at every connection attempt
#<lgtvId1>.pairkey=
lgtv.pairkey=548567

# The TCP port address of the openhab system to receive lgtv status messages
# (only first occurrence is used for all TVs)
#<lgtvId1>.serverport=
lgtv.serverport=8080

# The location to put XML files with the information of availiable
# channels and apps (optional)
#<lgtvId1>.xmldatafiles=./
lgtv.xmldatafiles=./

# The check alive interval (optional, defaults to 60secs)
#<lgtvId1>.checkalive=
lgtv.checkalive=60

```

Tv was displaying this key 548567 which I entered in the lgtv.cgf file but still not connecting.

Edit:  
Key was shown in three blocks 54 85 67 but assuming no spaces are needed.

---

<div class="post-metadata">

**Author:** ![Dim](https://community.openhab.org/user_avatar/community.openhab.org/dim/32/4568_2.png) [@Dim](https://community.openhab.org/u/Dim)\
**Post date:** [December 7, 2018, 6:40pm UTC](https://community.openhab.org/t/solved-lg-tv-binding-netcast-3-0-issue-connecting-with-tv/59071/14 "2018-12-07T18:40:39Z")

</div>

why does your log scream about another IP (.19) than the one configured in your lgtv.cfg (.200)?

check the contents of:  
`/var/lib/openhab2/config/org/openhab/lgtv.config` and post them here

---

<div class="post-metadata">

**Author:** ![andy31](https://community.openhab.org/user_avatar/community.openhab.org/andy31/32/30662_2.png) [@andy31](https://community.openhab.org/u/andy31)\
**Post date:** [December 7, 2018, 6:46pm UTC](https://community.openhab.org/t/solved-lg-tv-binding-netcast-3-0-issue-connecting-with-tv/59071/15 "2018-12-07T18:46:15Z")

</div>

Sorry my bad , copied from notepad device ip is correct as per log .19  
Corrected content of lgtv.cfg and looks like follow.

```csv
pid:org.openhab.lgtv

# The ip address of the lgtv (required)
#<lgtvId1>.host=
lgtv.host=192.168.1.19

# The TCP port to use (optional, defaults to 8080)
#<lgtvId1>.port=
lgtv.port=60128

# The the pairkey / if it's wrong the device shows the right pairkey
# at every connection attempt
#<lgtvId1>.pairkey=
lgtv.pairkey=548567

# The TCP port address of the openhab system to receive lgtv status messages
# (only first occurrence is used for all TVs)
#<lgtvId1>.serverport=
lgtv.serverport=8080

# The location to put XML files with the information of availiable
# channels and apps (optional)
#<lgtvId1>.xmldatafiles=./
lgtv.xmldatafiles=./

# The check alive interval (optional, defaults to 60secs)
#<lgtvId1>.checkalive=
lgtv.checkalive=60

```

---

<div class="post-metadata">

**Author:** ![Dim](https://community.openhab.org/user_avatar/community.openhab.org/dim/32/4568_2.png) [@Dim](https://community.openhab.org/u/Dim)\
**Post date:** [December 7, 2018, 6:48pm UTC](https://community.openhab.org/t/solved-lg-tv-binding-netcast-3-0-issue-connecting-with-tv/59071/16 "2018-12-07T18:48:08Z")

</div>

try to access the following 4 URLs from a web browser and report back 🙂

```auto
http://192.168.1.19:60128/
http://192.168.1.19:60128/udap/api/pairing
http://192.168.1.19:8080/
http://192.168.1.19:8080/udap/api/pairing

```

---

<div class="post-metadata">

**Author:** ![andy31](https://community.openhab.org/user_avatar/community.openhab.org/andy31/32/30662_2.png) [@andy31](https://community.openhab.org/u/andy31)\
**Post date:** [December 7, 2018, 6:56pm UTC](https://community.openhab.org/t/solved-lg-tv-binding-netcast-3-0-issue-connecting-with-tv/59071/17 "2018-12-07T18:56:29Z")

</div>

I tried all 4 URL`s but none of them I can access - I tried on two different browsers Internet Explorer and Mozilla Firefox

 ![web1](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/e/0/e0b00345ce33aa4895bb9dca755afc0aab81e134.png)

 ![web2](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/a/7/a7a868b730ffd516fe4683dc7a7376ffa743a482.png)

---

<div class="post-metadata">

**Author:** ![vzorglub](https://community.openhab.org/user_avatar/community.openhab.org/vzorglub/32/17166_2.png) [@vzorglub](https://community.openhab.org/u/vzorglub)\
**Post date:** [December 7, 2018, 7:04pm UTC](https://community.openhab.org/t/solved-lg-tv-binding-netcast-3-0-issue-connecting-with-tv/59071/18 "2018-12-07T19:04:14Z")

</div>

> [@Dim](#):
>
> edit: found a typo ( `mgtv` ) in: [LG TV - Bindings | openHAB](https://www.openhab.org/addons/bindings/lgtv1/#example) 🙂

Pull request created

---

<div class="post-metadata">

**Author:** ![Dim](https://community.openhab.org/user_avatar/community.openhab.org/dim/32/4568_2.png) [@Dim](https://community.openhab.org/u/Dim)\
**Post date:** [December 7, 2018, 7:06pm UTC](https://community.openhab.org/t/solved-lg-tv-binding-netcast-3-0-issue-connecting-with-tv/59071/19 "2018-12-07T19:06:08Z")

</div>

we may need to do some more changes.. it is not clear to me what is the correct TCP `lgtv.port=`  
to be used wrt to connecting to the TV

Is it 8080 as described in the comments of the distributed lgtv.cfg (and defaults to 8080 also in the ConfigAdmin with pid:org.openhab.org if not set) or is it 60128 as described in the docs ?

I have no clue 🙂

It looks like it is 60128 (since the TV reacted to this and generated/displayed the 6 digit pairkey) (also missing from docs the fact that the `Pair Key` (or `pairkey` ???) is a 6 digit number that should be introduced in the lgtv.cfg without spaces 😛

---

<div class="post-metadata">

**Author:** ![andy31](https://community.openhab.org/user_avatar/community.openhab.org/andy31/32/30662_2.png) [@andy31](https://community.openhab.org/u/andy31)\
**Post date:** [December 7, 2018, 7:09pm UTC](https://community.openhab.org/t/solved-lg-tv-binding-netcast-3-0-issue-connecting-with-tv/59071/20 "2018-12-07T19:09:07Z")

</div>

I understand. Do I need to restart openhab after changing port number from 60128 to 8080 ?

[Next page](https://community.openhab.org/t/solved-lg-tv-binding-netcast-3-0-issue-connecting-with-tv/59071.md?page=2)
