Page 2 of 2
Re: LG TV Plugin: Serial (RS-232)
Posted: Sat Apr 30, 2011 9:41 pm
by woggy
Scope wrote:Thank you for a wonderful plugin!
There are some bugs in it though

When you send a command, the plugin does not wait for the ACK. This means that if you send two commands after eachother, the plugin will not work correctly.
I am like you a newbie in python, but I will look into the problem if you don't have time.
Kind regards,
Torbj├Ârn Westerlund.
If I understand your problem correctly it should be fixed now in V1.0
Re: LG TV Plugin: Serial (RS-232)
Posted: Tue May 03, 2011 12:11 pm
by woggy
New Update V1.2 on first page!
Re: LG TV Plugin: Serial (RS-232)
Posted: Mon May 16, 2011 9:45 pm
by Scope
woggy wrote:Scope wrote:Thank you for a wonderful plugin!
There are some bugs in it though

When you send a command, the plugin does not wait for the ACK. This means that if you send two commands after eachother, the plugin will not work correctly.
I am like you a newbie in python, but I will look into the problem if you don't have time.
Kind regards,
Torbj├Ârn Westerlund.
If I understand your problem correctly it should be fixed now in V1.0
Thanks for the update! But the bug is not fixed. The problem is that the implementation is asynchronous.
There is no lock-mechanism after writing to the serialport. When you send a command (write to the serialport) you have to wait for the reader-thread to handle the
acknowledge of that command. For instance you send "ka 01 01" (Power on, 3 bytes) to the serialport. The reader-thread reads two bytes of the acknowledge "OK/NG". And then you send another command while there is still data to read from the current acknowledgment. This will screw up the communication with the TV.
The flow must be like this:
>Lock read and write
* Write command to serialport
* Wait for acknowledgment
* Read and handle complete acknowledgment
< Release read and write lock
If you don't want to lock up Eventghost by sending alot of commands which are waiting for the lock, then you have to create some sort of work-queue with a dedicated thread where you queue all commands which are about to be sent, and handle them one at a time when the lock is released.
But I don't think that will be necessary. For instance, the irblaster USBUIRT works that way, it will block Eventghost until it has sent it's IRCode (even though there is no ack).
But again thanks for the update! And as I said before, if you don't have time to fix this I will try to have a look at it myself (haven't had the time yet though

)
/ Torbj├Ârn Westerlund
Re: LG TV Plugin: Serial (RS-232)
Posted: Thu Jun 23, 2011 7:26 am
by v!rus
I get this error message each time i start EG. Any way to fix it?
Code: Select all
09:18:26 Fehler beim Laden der Plugin-Datei C:\Program Files (x86)\EventGhost\plugins\LGSerial.
09:18:26 Traceback (most recent call last) (1529):
09:18:26 File "C:\Program Files (x86)\EventGhost\eg\Classes\PluginModuleInfo.py", line 70, in __init__
09:18:26 __import__(moduleName, None, None, [''])
09:18:26 File "C:\Program Files (x86)\EventGhost\plugins\LGSerial\__init__.py", line 27, in <module>
09:18:26 url = "http://www.eventghost.net/forum/viewtopic.php?f=9&t=3041",
09:18:26 File "C:\Program Files (x86)\EventGhost\eg\Classes\PluginModuleInfo.py", line 119, in RegisterPlugin
09:18:26 self.author = unicode(author)
09:18:26 UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 8: ordinal not in range(128)
09:18:26 Fehler beim Laden der Plugin-Datei C:\Program Files (x86)\EventGhost\plugins\LGSerial.
09:18:26 Traceback (most recent call last) (1529):
09:18:26 File "C:\Program Files (x86)\EventGhost\eg\Classes\PluginModuleInfo.py", line 70, in __init__
09:18:26 __import__(moduleName, None, None, [''])
09:18:26 File "C:\Program Files (x86)\EventGhost\plugins\LGSerial\__init__.py", line 27, in <module>
09:18:26 url = "http://www.eventghost.net/forum/viewtopic.php?f=9&t=3041",
09:18:26 File "C:\Program Files (x86)\EventGhost\eg\Classes\PluginModuleInfo.py", line 119, in RegisterPlugin
09:18:26 self.author = unicode(author)
09:18:26 UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 8: ordinal not in range(128)
Re: LG TV Plugin: Serial (RS-232)
Posted: Thu Jun 23, 2011 11:23 am
by Pako
1. You must add to the top of plugin the line:
# -*- coding: utf-8 -*-
2. You must modify the line with the name of the author as follows:
author = u"Niclas H\xe5kansson",
3. Missing
required parameter guid
4. In the plugin is a
serious mistake. If there is this plugin in the folder
plugins, can not run EventGhost with the parameter
-translate .
Pako
Re: LG TV Plugin: Serial (RS-232)
Posted: Fri Jun 24, 2011 10:12 am
by v!rus
Thx a lot, Pako. It works fine!

Re: LG TV Plugin: Serial (RS-232)
Posted: Thu Jul 07, 2011 7:38 pm
by woggy
Pako wrote:1. You must add to the top of plugin the line:
# -*- coding: utf-8 -*-
2. You must modify the line with the name of the author as follows:
author = u"Niclas H\xe5kansson",
3. Missing
required parameter guid
4. In the plugin is a
serious mistake. If there is this plugin in the folder
plugins, can not run EventGhost with the parameter
-translate .
Pako
I have added bugfix 1,2,3 and Cleaned up / changed the code in V1.3 but I can't find the
serious mistake =(
woggy
Re: LG TV Plugin: Serial (RS-232)
Posted: Thu Jul 07, 2011 7:44 pm
by woggy
Scope wrote:woggy wrote:Scope wrote:Thank you for a wonderful plugin!
There are some bugs in it though

When you send a command, the plugin does not wait for the ACK. This means that if you send two commands after eachother, the plugin will not work correctly.
I am like you a newbie in python, but I will look into the problem if you don't have time.
Kind regards,
Torbj├Ârn Westerlund.
If I understand your problem correctly it should be fixed now in V1.0
Thanks for the update! But the bug is not fixed. The problem is that the implementation is asynchronous.
There is no lock-mechanism after writing to the serialport. When you send a command (write to the serialport) you have to wait for the reader-thread to handle the
acknowledge of that command. For instance you send "ka 01 01" (Power on, 3 bytes) to the serialport. The reader-thread reads two bytes of the acknowledge "OK/NG". And then you send another command while there is still data to read from the current acknowledgment. This will screw up the communication with the TV.
The flow must be like this:
>Lock read and write
* Write command to serialport
* Wait for acknowledgment
* Read and handle complete acknowledgment
< Release read and write lock
If you don't want to lock up Eventghost by sending alot of commands which are waiting for the lock, then you have to create some sort of work-queue with a dedicated thread where you queue all commands which are about to be sent, and handle them one at a time when the lock is released.
But I don't think that will be necessary. For instance, the irblaster USBUIRT works that way, it will block Eventghost until it has sent it's IRCode (even though there is no ack).
But again thanks for the update! And as I said before, if you don't have time to fix this I will try to have a look at it myself (haven't had the time yet though

)
/ Torbj├Ârn Westerlund
Now you can 10 commands in a row and all of them will work, but you won't get the acks untill all of them is sent!
Re: LG TV Plugin: Serial (RS-232)
Posted: Fri Jan 06, 2012 9:56 pm
by woggy
Pako wrote:1. You must add to the top of plugin the line:
# -*- coding: utf-8 -*-
2. You must modify the line with the name of the author as follows:
author = u"Niclas H\xe5kansson",
3. Missing
required parameter guid
4. In the plugin is a
serious mistake. If there is this plugin in the folder
plugins, can not run EventGhost with the parameter
-translate .
Pako
I have found the
serious mistake. Actionnames can't have + - and : in their names, and they can't start with numbers. =)
Fixed now in V1.4
Re: LG TV Plugin: Serial (RS-232)
Posted: Sat Oct 06, 2012 7:28 am
by brotbuexe
Nice work thanks.
Using On/Off and Screen Saver commands without issues.
I have a little problem with the aspect ratio switch.
I think there is something wrong with the Cinema Zoom and the value.
It says I should enter a value of 1-16.
If I set 7, it switches to 14:9. It should do Cinema Zoom Level 7.
If I set 10 it does switch to Cinema Zoom Level 10.
16 switches to Cinema Zoom Level 1.
22 switches to Cinema Zoom Level 7. (this is the zoom level I wanted, so its "fixed" for me
The LG manual says:
Data 01 : Normal screen
(4:3)
02 : Wide screen (16:9)
04 : Zoom
06 : Original
07 : 14:9
09 : Just Scan
0B : Full Wide
10 to 1F : Cinema Zoom 1 to 16
Re: LG TV Plugin: Serial (RS-232)
Posted: Sun Oct 07, 2012 9:08 pm
by woggy
brotbuexe wrote:Nice work thanks.
Using On/Off and Screen Saver commands without issues.
I have a little problem with the aspect ratio switch.
I think there is something wrong with the Cinema Zoom and the value.
It says I should enter a value of 1-16.
If I set 7, it switches to 14:9. It should do Cinema Zoom Level 7.
If I set 10 it does switch to Cinema Zoom Level 10.
16 switches to Cinema Zoom Level 1.
22 switches to Cinema Zoom Level 7. (this is the zoom level I wanted, so its "fixed" for me
The LG manual says:
Data 01 : Normal screen
(4:3)
02 : Wide screen (16:9)
04 : Zoom
06 : Original
07 : 14:9
09 : Just Scan
0B : Full Wide
10 to 1F : Cinema Zoom 1 to 16
Fixed it in V1.5 on first page.
Re: LG TV Plugin: Serial (RS-232)
Posted: Tue Dec 25, 2012 8:58 am
by v!rus
Hi Woggy,
is it possible to change the output of events with your plugin?
Because, if i request the backlight status i get the following event, as example:
LG.Backlight '30'. But for an action i can only use
LG.Backlight, because EG does not recognize the value behind.
If the output were something like
LG.Backilight.30, EG could use the different valuesand my Macro does work.
regards,
v!
Re: LG TV Plugin: Serial (RS-232)
Posted: Tue Dec 25, 2012 1:56 pm
by woggy
if you listen for the event LG.Backlight
you will find the value with:
eg.event.payload
Try this:
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1582">
<Macro Name="New Event" Expanded="True">
<Event Name="LG.Backlight" />
<Action>
EventGhost.PythonScript(u'eg.TriggerEvent(str(eg.event.payload), prefix ="LG.Backlight")\n')
</Action>
</Macro>
</EventGhost>
Re: LG TV Plugin: Serial (RS-232)
Posted: Wed Dec 26, 2012 9:26 am
by v!rus
Oh, it seems i have to learn Python Script!
With your script i get the following event:
LG.Backlight.none
But the value should be: 30
Re: LG TV Plugin: Serial (RS-232)
Posted: Wed Dec 26, 2012 9:37 am
by woggy
True, for eg.event.payload to work you need an event (and a payload)
try to call Backlight Status.