merdok / homebridge-webos-tv

Homebridge plugin for LG webOS TVs
MIT License
663 stars 89 forks source link

[Feature Request] Device Type TV #87

Closed vmax77 closed 5 years ago

vmax77 commented 5 years ago

Hi

I know this is early, but it would nice if the TV was detected as type TV

image

Thank you

Hiddecollee commented 5 years ago

Are you on iOS 12.2 Beta? channelButtons, notificationButtons, remoteControlButtons and volumeControl will still appear as switches if enabled since there is no way in the current iOS beta to control them from the remote control.

Could I get rid of the switches? I don't really use them. And you can already control the volumeControl with the Remote in control center.

Hiddecollee commented 5 years ago

And what about the inputs, I only use HDMI 1 and Live TV, how can I get rid of the rest of them?

merdok commented 5 years ago

Please read the README, you can disable whichever services you want... Most probably in some later iOS betas you will be able to hide the inputs from the list which you don't use.

Ben305 commented 5 years ago

I can't get rid of two switches even with
"mediaControl": false set

creinhart commented 5 years ago

Works perfectly! Thank you! I have 2 LG TVs running with the new TV service now. As a side note, make sure to get rid of the appswitch if you don't want other switches. I have no spare switches at all. Just the TVs themselves.

merdok commented 5 years ago

@Ben305 you have to manually disable the services that you do not want. "mediaControl": false will just disable the media control service.

@creinhart Good to hear 👍 The appSwitch is completely ignored when using the new tv services. It is basically replaced by inputs.

m11rphy commented 5 years ago

@creinhaet could I see your config for 2 TVs please

m11rphy commented 5 years ago

Works perfectly! Thank you! I have 2 LG TVs running with the new TV service now. As a side note, make sure to get rid of the appswitch if you don't want other switches. I have no spare switches at all. Just the TVs themselves.

Could I see your config for 2 TVs please?

lboue commented 5 years ago

Hello @merdok,

I upgraded the plugin with you latest commit. I have an issue with the inputslist for additionnal apps. There are not added to the defaultInputslist. It creates two buttons in HomeKit as "unknown accessory".

img_1666

Here is my config.json snippet:

    {
      "accessory": "webostv",
      "name": "Tv Salon",
      "ip": "192.168.1.100",
      "mac": "C8:08:E9:11:**:**",
      "keyFile": "/home/pi/.homebridge/lgtvKeyFile",
      "pollingInterval": 10,
      "tvService": true,
      "inputs": [
          {
            "appId": "youtube.leanback.v4",
            "name": "YouTube"
          },
          {
            "appId": "com.webos.netflix",
            "name": "Netflix"
          }
      ],
      "volumeControl": "switch",
      "mediaControl": false,
      "appSwitch":[
         "com.webos.app.tvguide",
         "com.webos.app.livetv",
         "com.webos.app.hdmi1",
         "com.webos.app.hdmi2",
         "com.webos.netflix",
         "amazon.row",
         "googleplaymovieswebos",
         "youtube.leanback.v4"
      ],
      "channelButtons": [3,5],
      "notificationButtons": [
         "Motion detected - living room",
         "Motion detected - kitchen"
      ],
      "remoteControlButtons": [
         "HOME",
         "LIST",
         "EXIT"
      ]
    }

I also tried to edit index.json as following. I restarted homebridge and now I have the Amazon Prime in the TV input list. Also it works fine if I select it :

webosTvAccessory.prototype.prepareInputSourcesService = function() {

    let defaultInputs = [{
            appId: 'com.webos.app.livetv',
            name: 'Live TV',
            type: Characteristic.InputSourceType.TUNER
        },
        {
            appId: 'com.webos.app.hdmi1',
            name: 'HDMI 1',
            type: Characteristic.InputSourceType.HDMI
        },
        {
            appId: 'com.webos.app.hdmi2',
            name: 'HDMI 2',
            type: Characteristic.InputSourceType.HDMI
        },
        {
            appId: 'com.webos.app.hdmi3',
            name: 'HDMI 3',
            type: Characteristic.InputSourceType.HDMI
        },
        {
            appId: 'amazon.row',
            name: 'Amazon Prime',
            type: Characteristic.InputSourceType.APPLICATION
        },
        {
            appId: 'com.webos.app.externalinput.component',
            name: 'Component',
            type: Characteristic.InputSourceType.COMPONENT_VIDEO
        },
        {
            appId: 'com.webos.app.externalinput.av1',
            name: 'AV',
            type: Characteristic.InputSourceType.COMPOSITE_VIDEO
        }
    ];

img_1669

Here is the debug log:

[2019-1-27 13:25:51] [Tv Salon] webOS - connected to TV
[2019-1-27 13:25:51] [Tv Salon] webOS - subscribing to TV services
[2019-1-27 13:25:52] [Tv Salon] webOS - requesting TV information
[2019-1-27 13:25:52] [Tv Salon] webOS - app launched, current appId: com.webos.app.hdmi1
[2019-1-27 13:25:52] [Tv Salon] webOS - audio status changed
[2019-1-27 13:25:52] [Tv Salon] webOS - current volume: -1
[2019-1-27 13:25:52] [Tv Salon] webOS - muted: No
[2019-1-27 13:25:52] [Tv Salon] webOS - current channel status changed
[2019-1-27 13:25:52] [Tv Salon] webOS - current channel: 0, 
[2019-1-27 13:25:52] [Tv Salon] webOS - TV current channel: 0, 
[2019-1-27 13:25:52] [Tv Salon] webOS - system info:
{
  "features": {
    "3d": false,
    "dvr": true
  },
  "receiverType": "dvb",
  "modelName": "47LB630V-ZA"
}
[2019-1-27 13:25:52] [Tv Salon] webOS - sw information:
{
  "product_name": "webOS",
  "model_name": "HE_DTV_WT1M_AFAAABAA",
  "sw_type": "FIRMWARE",
  "major_ver": "05",
  "minor_ver": "05.35",
  "country": "FR",
  "device_id": "c8:08:e9:11:**:**",
  "auth_flag": "N",
  "ignore_disable": "N",
  "eco_info": "01",
  "config_key": "00",
  "language_code": "fr-FR"
}
[2019-1-27 13:25:52] [Tv Salon] webOS - service list:
{
  "services": [
    {
      "name": "api",
      "version": 1
    },
    {
      "name": "audio",
      "version": 1
    },
    {
      "name": "media.controls",
      "version": 1
    },
    {
      "name": "media.viewer",
      "version": 1
    },
    {
      "name": "pairing",
      "version": 1
    },
    {
      "name": "system",
      "version": 1
    },
    {
      "name": "system.launcher",
      "version": 1
    },
    {
      "name": "system.notifications",
      "version": 1
    },
    {
      "name": "tv",
      "version": 1
    },
    {
      "name": "webapp",
      "version": 2
    }
  ]
}

Regards,

creinhart commented 5 years ago

Works perfectly! Thank you! I have 2 LG TVs running with the new TV service now. As a side note, make sure to get rid of the appswitch if you don't want other switches. I have no spare switches at all. Just the TVs themselves.

Could I see your config for 2 TVs please?

`"accessories": [ { "accessory": "webostv", "name": "LGTV", "ip": "192.168.0.148", "mac": "00:51:ED:35:xx:xx", "keyFile": "/Users/xx/.homebridge/persist/lgtvKeyFile", "pollingInterval": 10, "tvService": true, "inputs": [

  ],
  "volumeControl": false,
  "channelControl": false,
  "mediaControl": false
},

{ "accessory": "webostv", "name": "LGTV2", "ip": "192.168.0.112", "mac": "20:3D:BD:FA:xx:xx "keyFile": "/Users/xx/.homebridge/persist/lgtvKeyFile2", "pollingInterval": 10, "tvService": true, "inputs": [

  ],
  "volumeControl": false,
  "channelControl": false,
  "mediaControl": false
}

]

}`

merdok commented 5 years ago

@lboue this is most probably a bug in the current iOS beta. You just need to force close the Home app if that happens and reopen it again, also restarting homebridge does help. Has the same issues...

m11rphy commented 5 years ago

hi guys, can you help with this error please?

TypeError: Service.Television is not a constructor at webosTvAccessory.prepareNewTvService (/usr/local/lib/node_modules/homebridge-webos-tv/index.js:270:22) at new webosTvAccessory (/usr/local/lib/node_modules/homebridge-webos-tv/index.js:120:14) at Server._loadAccessories (/usr/local/lib/node_modules/homebridge/lib/server.js:297:29) at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:87:38) at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:45:10) at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22) at Module._compile (internal/modules/cjs/loader.js:689:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12)

HunterJKirby commented 5 years ago

You need to update nodeJS

On Jan 27, 2019, at 11:36 AM, m11rphy notifications@github.com wrote:

hi guys, can you help with this error please?

TypeError: Service.Television is not a constructor at webosTvAccessory.prepareNewTvService (/usr/local/lib/node_modules/homebridge-webos-tv/index.js:270:22) at new webosTvAccessory (/usr/local/lib/node_modules/homebridge-webos-tv/index.js:120:14) at Server._loadAccessories (/usr/local/lib/node_modules/homebridge/lib/server.js:297:29) at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:87:38) at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:45:10) at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22) at Module._compile (internal/modules/cjs/loader.js:689:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

m11rphy commented 5 years ago

You need to update nodeJS

Thanks I've updated but now get this error

Error: The module '/usr/local/lib/node_modules/homebridge/node_modules/ed25519-hap/build/Release/ed25519.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 64. This version of Node.js requires NODE_MODULE_VERSION 67. Please try re-compiling or re-installing the module (for instance, using npm rebuild or npm install). at Object.Module._extensions..node (internal/modules/cjs/loader.js:777:18) at Module.load (internal/modules/cjs/loader.js:628:32) at tryModuleLoad (internal/modules/cjs/loader.js:568:12) at Function.Module._load (internal/modules/cjs/loader.js:560:3) at Module.require (internal/modules/cjs/loader.js:665:17) at require (internal/modules/cjs/helpers.js:20:18) at bindings (/usr/local/lib/node_modules/homebridge/node_modules/bindings/bindings.js:84:48) at Object. (/usr/local/lib/node_modules/homebridge/node_modules/ed25519-hap/index.js:1:99) at Module._compile (internal/modules/cjs/loader.js:736:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:747:10)

HunterJKirby commented 5 years ago

Uninstalling then reinstalling homebridge fixes this!

On Jan 27, 2019, at 11:41 AM, m11rphy notifications@github.com wrote:

You need to update nodeJS …

Thanks I've updated but now get this error

Error: The module '/usr/local/lib/node_modules/homebridge/node_modules/ed25519-hap/build/Release/ed25519.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 64. This version of Node.js requires NODE_MODULE_VERSION 67. Please try re-compiling or re-installing the module (for instance, using npm rebuild or npm install). at Object.Module._extensions..node (internal/modules/cjs/loader.js:777:18) at Module.load (internal/modules/cjs/loader.js:628:32) at tryModuleLoad (internal/modules/cjs/loader.js:568:12) at Function.Module._load (internal/modules/cjs/loader.js:560:3) at Module.require (internal/modules/cjs/loader.js:665:17) at require (internal/modules/cjs/helpers.js:20:18) at bindings (/usr/local/lib/node_modules/homebridge/node_modules/bindings/bindings.js:84:48) at Object. (/usr/local/lib/node_modules/homebridge/node_modules/ed25519-hap/index.js:1:99) at Module._compile (internal/modules/cjs/loader.js:736:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:747:10)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

m11rphy commented 5 years ago

Uninstalling then reinstalling homebridge fixes this!

now I'm getting this error

udo npm install -g homebridge /usr/local/bin/homebridge -> /usr/local/lib/node_modules/homebridge/bin/homebridge

curve25519-n@1.4.0 install /usr/local/lib/node_modules/homebridge/node_modules/curve25519-n node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/Users/chrismurphy/.node-gyp/11.8.0" gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/homebridge/node_modules/curve25519-n/.node-gyp" gyp WARN install got an error, rolling back install gyp WARN install got an error, rolling back install gyp ERR! configure error gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/homebridge/node_modules/curve25519-n/.node-gyp' gyp ERR! System Darwin 18.2.0 gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /usr/local/lib/node_modules/homebridge/node_modules/curve25519-n gyp ERR! node -v v11.8.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! curve25519-n@1.4.0 install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the curve25519-n@1.4.0 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /Users/chrismurphy/.npm/_logs/2019-01-27T17_43_34_717Z-debug.log

merdok commented 5 years ago

Just remove your node_modules directory and reinstall everything. This is I guess a dependency error.

m11rphy commented 5 years ago

Just remove your node_modules directory and reinstall everything. This is I guess a dependency error.

still an error

Last login: Sun Jan 27 18:05:08 on ttys000 Chriss-Mac-mini:~ chrismurphy$ sudo npm install -g homebridge Password: /usr/local/bin/homebridge -> /usr/local/lib/node_modules/homebridge/bin/homebridge

curve25519-n@1.4.0 install /usr/local/lib/node_modules/homebridge/node_modules/curve25519-n node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/Users/chrismurphy/.node-gyp/11.8.0" gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/homebridge/node_modules/curve25519-n/.node-gyp" gyp WARN install got an error, rolling back install gyp WARN install got an error, rolling back install gyp ERR! configure error gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/homebridge/node_modules/curve25519-n/.node-gyp' gyp ERR! System Darwin 18.2.0 gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /usr/local/lib/node_modules/homebridge/node_modules/curve25519-n gyp ERR! node -v v11.8.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! curve25519-n@1.4.0 install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the curve25519-n@1.4.0 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /Users/chrismurphy/.npm/_logs/2019-01-27T18_07_02_939Z-debug.log

merdok commented 5 years ago

Now you have some permission errors not related to this plugin. You would need to fix your environment.

KhaosT commented 5 years ago

@m11rphy try sudo npm install -g --unsafe-perm homebridge

m11rphy commented 5 years ago

Now you have some permission errors not related to this plugin. You would need to fix your environment.

@m11rphy try sudo npm install -g --unsafe-perm homebridge

Guys I'm reformatting my Mac mini and starting again,

To confirm I should install 11.8.0?

to install home bridge should I use: sudo npm install -g --unsafe-perm homebridge or sudo npm install -g homebridge?

im using MacOS Mojave

Ben305 commented 5 years ago

Best solution would be a node environment where sudo isn‘t needed for installation of globally installed packages.

m11rphy commented 5 years ago

Best solution would be a node environment where sudo isn‘t needed for installation of globally installed packages.

in English lol?

m11rphy commented 5 years ago

Guys I have whipped my Mac reinstalled everything but when I try and add home bridge to the home app, I get a error can not add accessory. Any ideas?

lboue commented 5 years ago

In my case closing the Home app and reopen it again fixed the issue. Thanks :)

m11rphy commented 5 years ago

Guys please help, I restart my Mac and iPhone and I can't add home bridge to home now. Even tried to add on my iPad

KhaosT commented 5 years ago

@m11rphy can you file an issue at https://github.com/nfarina/homebridge/issues and provide logs from homebridge in there? The issue is unlikely plugin related, so there is no need to spam everyone in the thread 😅

m11rphy commented 5 years ago

Guys I got it working and sorry for being dumb lol

Now for the real issues, when I got to input I have each HDMI listed twice like below

HDMI 1 HDMI 1 HDMI 2 HDMI 2 HDMI 3 HDMI 3 Live TV

m11rphy commented 5 years ago

Config below

"accessories": [

   {
  "accessory": "webostv",
  "name": "TV",
  "ip": "192.168.1.39",
  "mac": "78:5D:C8:63:37:D0",
  "pollingInterval": 10,
  "tvService": true,
  "inputs":[
    {
     "appId": "com.webos.app.hdmi1",
     "name": "HDMI 1"
    },
    {
     "appId": "com.webos.app.hdmi2",
     "name": "HDMI 2"
     },
     {  
     "appId": "com.webos.app.hdmi3",
     "name": "HDMI 3"
     }
  ]

}
HunterJKirby commented 5 years ago

You do not need to list those inputs. By default they are added to your input list

On Jan 27, 2019, at 2:24 PM, m11rphy notifications@github.com wrote:

Config below

"accessories": [

{ "accessory": "webostv", "name": "TV", "ip": "192.168.1.39", "mac": "78:5D:C8:63:37:D0", "pollingInterval": 10, "tvService": true, "inputs":[ { "appId": "com.webos.app.hdmi1", "name": "HDMI 1" }, { "appId": "com.webos.app.hdmi2", "name": "HDMI 2" }, {
"appId": "com.webos.app.hdmi3", "name": "HDMI 3" } ]

} — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

merdok commented 5 years ago

@m11rphy HDMI1, HDMI2, HDMI3 are already preconfigured. You do not need to add them manually.

m11rphy commented 5 years ago

got it thanks working correctly now

m11rphy commented 5 years ago

is there away to remove all the additional switches for volume and rewind etc, are these needed?

2nm commented 5 years ago

Hey, just wondering did anyone have an issue where you can’t turn a TV on with the 12.2 service? Got Two OLED TVs identical with identical accessory declarations and setup (though not name, mac, IP, keyfile) one works one doesn’t.
And wondering when using the remote from control centre the back and exit buttons don’t seem to do anything, and is there meant to be a channel changer or is that not implemented?

Thanks :) x

2nm commented 5 years ago

Think I resolved the not turning on. But do people know about the other issues? X

2nm commented 5 years ago

And bizarrely only one TV appears in the remote in control centre

creinhart commented 5 years ago

I have the same issue of only one TV appearing in Remote in Control center. Perhaps a bug of the first beta?

2nm commented 5 years ago

I have the same issue of only one TV appearing in Remote in Control center. Perhaps a bug of the first beta?

@creinhart glad it’s not just me 🙏🏼

merdok commented 5 years ago

@m11rphy read the README, you can disable all other services if you do not want them

@2nm i do not have 2 TVs so i am not sure what the issue here is, maybe because of the beta? back and exit buttons work exactly the same as your back and exit buttons on your tv remote control. There is currently no channel changer, maybe Apple will add that in the next betas.

seanosullivanuk commented 5 years ago

Just a quick one, @merdok. I've set this up from scratch and it's working wonderfully already with my webOS TV. (2018 4k). Thanks for working on this.

2nm commented 5 years ago

@m11rphy read the README, you can disable all other services if you do not wat them ...

@merdok thank you

m11rphy commented 5 years ago

Hey guys sorry for all the questions, everything was perfect but I now have a error whereby if turn the tv off it shows as off, but 10 seconds later the home app shows the tv as on even tho its not

merdok commented 5 years ago

@m11rphy Most probably pixel refresher running on your TV (if you have an OLED), during that time (about 9 minutes) the TV appears to be ON (it is actually, just the screen is off). This is an OLED only issue and has nothing to do with this feature.

m11rphy commented 5 years ago

@m11rphy Most probably pixel refresher running on your TV (if you have an OLED), during that time (about 9 minutes) the TV appears to be ON (it is actually, just the screen is off). This is an OLED only issue and has nothing to do with this feature.

You was spot on, all back to working as before. Thank you so much for all your work on th plugin and all the help you have given us all. You have done an amazing job and you are a fantastic developer

kapps7 commented 5 years ago

Can I confirm that those of you who are seeing your TV as the new accessory type TV (running betas) with integrated inputs etc, are using the unmodified version of this plugin or is there a separate fork ?

betablon commented 5 years ago

I am having problems with turning the TV back on with the Home app on iOS.. it seems to disconnect. Also can I remove any of the pre-configured inputs as AV, Component and Live TV?

betablon commented 5 years ago

Can I confirm that those of you who are seeing your TV as the new accessory type TV (running betas) with integrated inputs etc, are using the unmodified version of this plugin or is there a separate fork ?

just the latest version of this plugin

epheterson commented 5 years ago

Can we add the ability to override input names, e.g. using "Apple TV" instead of "HDMI1"? Also, as th3cure was asking, can we remove inputs entirely?

And can the input list be sorted?

kapps7 commented 5 years ago

Is anyone able to change inputs using Siri ?

2nm commented 5 years ago

Can we add the ability to override input names, e.g. using "Apple TV" instead of "HDMI1"? Also, as th3cure was asking, can we remove inputs entirely? ...

@epheterson

Can just change them in the home app. Just hit edit and then the TV and then change the input names as you would an accessory input.