Closed NissarAK84 closed 7 months ago
what worked for me was changing the SSL command and removing MyTV name. Backup your init file before trying this. Reload config and set lockscreen to 1min. if should shutdown your LG TV. If you have issues waking the TV up. in your TV settings enable Always Ready.
command = command.." ssl"
change that to
command = command.." --ssl"
another one you might wanna try with that if that command doesn't work is local tv_name = "MyTV" change to local tv_name = ""
what worked for me was changing the SSL command and removing MyTV name. Backup your init file before trying this. Reload config and set lockscreen to 1min. if should shutdown your LG TV. If you have issues waking the TV up. in your TV settings enable Always Ready.
command = command.." ssl" change that to command = command.." --ssl"
another one you might wanna try with that if that command doesn't work is local tv_name = "MyTV" change to local tv_name = ""
Hi @Krizid, Thanks for your response, I thought I would never hear from anyone :(
I tried first with changing the part of the code that says:
function exec_command(command)
if lgtv_ssl then
space_loc = command:find(" ")
--- "ssl" must be the first argument for commands like 'startApp'. Advance it to the expected position.
if space_loc then
command = command:sub(1,space_loc).."ssl "..command:sub(space_loc+1)
else
command = command.." --ssl"
end
end
command = lgtv_cmd.." "..command
log_d("Executing command: "..command)
response = hs.execute(command)
log_d(response)
return response
end
to:
function exec_command(command)
if lgtv_ssl then
space_loc = command:find(" ")
--- "ssl" must be the first argument for commands like 'startApp'. Advance it to the expected position.
if space_loc then
command = command:sub(1,space_loc).."ssl "..command:sub(space_loc+1)
else
command = command.." --ssl"
end
Basically added the two dashes before command.." ssl".
It didn't work. Then I changed this part:
local tv_name = "MyTV" -- Name of your TV, set when you run `lgtv auth``
to:
local tv_name = "" -- Name of your TV, set when you run `lgtv auth``
Basically removed MyTV.
This didn't work either.
I also tried with only changing the MyTV part and leaving the ssl without the dashes, no luck.
With the " --ssl" I get this output in the log:
2023-12-07 14:06:40: Executing command: ~/opt/lgtv/bin/lgtv getForegroundAppInfo --ssl
2023-12-07 14:06:40: Error: '--ssl'
LGTV Controller
Author: Karl Lattimer <karl@qdh.org.uk>
Usage: lgtv <command> [parameter]
Available Commands:
-i interactive mode
scan
auth <host> <tv_name>
<tv_name> audioStatus <>
<tv_name> audioVolume <>
<tv_name> closeAlert <alertId>
<tv_name> closeApp <appid>
<tv_name> createAlert <message> <button>
<tv_name> execute <command>
<tv_name> getCursorSocket <>
<tv_name> getForegroundAppInfo <>
<tv_name> getPictureSettings <>
<tv_name> getPowerState <>
<tv_name> getSoundOutput <>
<tv_name> getSystemInfo <>
<tv_name> getTVChannel <>
<tv_name> input3DOff <>
<tv_name> input3DOn <>
<tv_name> inputChannelDown <>
<tv_name> inputChannelUp <>
<tv_name> inputMediaFastForward <>
<tv_name> inputMediaPause <>
<tv_name> inputMediaPlay <>
<tv_name> inputMediaRewind <>
<tv_name> inputMediaStop <>
<tv_name> listApps <>
<tv_name> listChannels <>
<tv_name> listInputs <>
<tv_name> listLaunchPoints <>
<tv_name> listServices <>
<tv_name> mute <muted>
<tv_name> notification <message>
<tv_name> notificationWithIcon <message> <url>
<tv_name> off
<tv_name> on
<tv_name> openAppWithPayload <payload>
<tv_name> openBrowserAt <url>
<tv_name> openYoutubeId <videoid>
<tv_name> openYoutubeLegacyId <videoid>
<tv_name> openYoutubeLegacyURL <url>
<tv_name> openYoutubeURL <url>
<tv_name> screenOff
<tv_name> screenOn
<tv_name> serialise
<tv_name> setInput <input_id>
<tv_name> setSoundOutput <output>
<tv_name> setTVChannel <channel>
<tv_name> setVolume <level>
<tv_name> startApp <appid>
<tv_name> swInfo <>
<tv_name> volumeDown <>
<tv_name> volumeUp <>
2023-12-07 14:06:40: -- Loading extension: screen
2023-12-07 14:06:40: Connected screens: { [1] = hs.screen: LG TV SSCR2 (0x6000012efd78),[2] = hs.screen: Built-in Retina Display (0x6000012efd38),}
2023-12-07 14:06:40: LG TV is connected
2023-12-07 14:06:40: TV is connected? true
2023-12-07 14:06:40: -- Loading extension: caffeinate
2023-12-07 14:06:40: -- Loading extension: eventtap
2023-12-07 14:06:40: -- Done.
2023-12-07 14:06:53: -- Loading extension: audiodevice
2023-12-07 14:06:53: LG TV SSCR2 (eqMac) is the current audio device.
Finally, I don't know what you mean with Lockscreen should be changed to 1 minute:
@cmer Do you have an idea what is wrong here?
I just updated the script to work with the latest version of LGWebOSRemote. Reinstall everything by following the new instructions in README.md. It should solve your problem.
I just updated the script to work with the latest version of LGWebOSRemote. Reinstall everything by following the new instructions in README.md. It should solve your problem.
Hi @cmer I ended up doing a clean install on my Mac (it is relatively new, so I didn't mind). Now it all works perfectly.
I read your post on Reddit, and just want to make sure, this tweak does not apply when the MacBook is shut down, and only applies when you put the laptop to sleep, right?
Hi, I am having issues.
I followed the guidelines in the Readme section, and eventually got it to work, where the TV would turn off when my MacBook is put to sleep and would turn on again when the MacBook is woken. But it didn't work when I turned off my MacBook or on. I would have to turn the TV off / on manually on the remote.
After 1 day, even that stopped working.
I have been able to run the commands to turn the TV off / on through terminal however.
See my lgtv_init.lua code below. The only thing I added was my TV's actual name "TV Kontor", however, on the macOS Display Settings it is shown as "LG TV SSCR2":
Here is the log from Hammerspoon Console:
Can anybody please advise on what is wrong? Currently nothing works at all.