Interrogating COM3 from a script

Lapov Onor

New Member
Hi

I've been using OBS to stream snooker videos for a very long time. Whilst some of what I do utilises a specific bespoke software package for scoring, this isn't always available to me. For those occasions I do not have it, I use another package. However MANY referees have a particular type of electronic scoreboard with an RJ45 connector on it, which is in fact an RS232 port

Now, using "Serial Port Monitor", if I send a zero to the COM port (I have a USB to serial converter) the scoreboard replies with 10 or 11 hex pairs. I know which pair represents what: -

1st pair - Player 1 frames won
2nd pair - Player 2 frames won
3rd/4th - 4 hex digits, Player 1 score
5th/6th - 4 hex digits, Player 2 score
7th/8th - 4 hex digits, current break
9th pair - 01 if player 1 at table, 00 if player 2 at table

I have been given a python script to do this, but it won't work due to syntax in my install of Python (it doesn't see the serial command, I think I need to add serial support)

I notice that OBS scripts are Python (https://obsproject.com/docs/scripting.html) so, is it possible to script up: -

1. Send 0 to COM3
2. Retrieve and store the 10 or 11 hex pairs sent in reply
3. Convert each pair to decimal (if converting 3rd/4th and adding is hard, could just convert 4th as that would be up to 255 and more than enough for snooker)
4. Insert each retrieved value into an auto-text field (I know this can be done - https://www.youtube.com/watch?v=Rx9ZTBfSP18 shows a timer using scripts updating text fields - this bit I reckon I can do!)

Is this something that can be scripted in OBS or is it too much for the installed configuration?

Many thanks!
 
Top