Update on: 07.03.2018
Updated version available on Twilio blog.
Published on: 01.11.2017
Conclusion
pip install nec-pd-sdk
My Story
I was responsible for maintenance of one spectacular 17 meters tall audio/video system on a cruise ship.
The system had 34 NEC X551UN screens among other components.
Behind each screen, there is a SDI-to-DVI converter.
If a picture on the screen was black, usually there was some problem with SDI-to-DVI converter, mostly power supply was broken.
Or NEC screen was broken, but I never had it in practice.
Special NEC screen
But, also there was one special screen, it was black from time to time.
After restart mostly fine, and SDI-to-DVI converter was fine.
After one month of troubleshooting, I have come to the conclusion that problem is with NEC screen.
It just got stuck every few days (sometimes every second day, some time was fine for a week), and simple restart (sometimes of 5 seconds and sometimes of 5 minutes) would solve issue till next time.
I also know that when there is a black picture on this screen, then screen diagnostic was “No signal.”
I have come to the conclusion that the following code could solve the problem:
1 2 3 4 |
if diagnostic_of_screen is "no_signal" is True; turn screen OFF wait 5 minutes turn screen ON |
And then to run this code on a schedule, like every hour.
Existing NEC software
NEC have two software applications for managing their products.
First is PD Comms Tool, you can remotely get and set all values to a screen.
It also has a scripting language.
I have used it for setting scheduler for all 34 screens and change of time.
It is much faster than manually doing it for each screen.
The second one is NaViSet Administrator 2 it is much more powerful than “PD Comms Tool”.
It can be used for monitoring all your NEC screens and also some additional equipment (like projectors and Windows PC)
It also has a visual scripting language where you can set and get multiple parameters according to some condition.
And then you also can set specific scheduler for each script.
I could have used this tool for my problem, but there was just one problem, it did not have sleep/pause command.
Design
I know that existing NEC software is communicating with the screen via TCP/IP.
Full protocol documentation is at http://www.necdisplay.com/documents/UserManuals/External_Control_P.V.X-series.pdf, but I was not so eager to write custom TCP/IP packets.
I wanted something more readable and simple.
I googled “NEC python” and found about nec-pd-sdk, what is python SDK for NEC screens.
There is no textual documentation, but there are few examples.
Most useful for me was test_routines_example.py, it is showing how to get every parameter.
The command for turning screen ON and OFF was found in source code.
Code for turning NEC screen ON and OFF
Here is the code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
from __future__ import print_function from nec_pd_sdk.nec_pd_sdk import NECPD from nec_pd_sdk.protocol import PDError from nec_pd_sdk.constants import PD_POWER_STATES import time # for sleep import sys def get_screen_state(pd): state = pd.command_power_status_read() text_list = pd.helper_self_diagnosis_status_text() return {'status': state, 'diagnosis': text_list} def main(): try: pd = NECPD.open('192.168.1.52') monitor_id = 1 pd.helper_set_destination_monitor_id(monitor_id) try: screen_state = get_screen_state(pd) # 'Normal; ' 'No signal; ' if screen_state['diagnosis'] == 'No signal; ': # OFF pd.command_power_status_set(PD_POWER_STATES['Off']) # pause time.sleep(5 * 60) # 5 minutes # ON pd.command_power_status_set(PD_POWER_STATES['On']) # 1 finally: # make sure to always close pd.close() except PDError as msg: print("PDError:", msg) return if __name__ == '__main__': main() # https://github.com/pyinstaller/pyinstaller/issues/1687 sys.exit() |
Last Words
When I was investigating NaViSet Administrator 2 for my use-case.
I contacted NEC support, to ask can them can I use it for this purpose.
They told me not and suggested to use TCP/IP External_Control.
So, even support from NEC does not know that they have NEC python SDK.
What is sad, considering that their NEC python SDK is useful software.
Questions and remarks, please leave in comments.