johnbrodie / pyjector Goto Github PK
View Code? Open in Web Editor NEWLibrary to help control your projector over a serial connection
License: MIT License
Library to help control your projector over a serial connection
License: MIT License
Hi, i have issue on 10.11 (El Capitan), i can figure to which port is connected projector (its connected via thunderbolt port - i have thunderbolt -> vga cable). And i have question, will i be able to show with pyjector image or some text on the projector?
Hi I 'm trying to get your awesome project to work with my Benq MP626. But I bet this errors:
./pyjector_controller benq "/dev/ttyUSB0" power on
Traceback (most recent call last):
File "./pyjector_controller", line 18, in
pyjector = Pyjector(port=args.port, device_id=args.device)
File "/root/pyjector/pyjector/pyjector.py", line 92, in init
self.get_config(device_id, kwargs)
File "/root/pyjector/pyjector/pyjector.py", line 110, in get_config
self.available_configs = self._populate_configs()
File "/root/pyjector/pyjector/pyjector.py", line 142, in _populate_configs
json_data = json.loads(data.read())
File "/usr/lib/python2.7/json/init.py", line 339, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 380, in raw_decode
obj, end = self.scan_once(s, idx)
ValueError: Expecting object: line 356 column 6 (char 9289)
I don't have that much experience with python. Du you know if I'm missing something?
I get the following error:
carsten@ubuntu:~/$ python3 pyjector_test.py
dict_keys(['computer', 'computer_22', 'component', 'dvi_a', 'dvi_d', 'hdmi', 'hdmi_2', 'composite', 's_video', 'network', 'usb_display', 'usb_reader', 'status'])
ERROR:root:unexpected response to handshake b'>'
Traceback (most recent call last):
File "pyjector_test.py", line 24, in <module>
pyjector.source('hdmi')
File "/home/carsten/home-assistant/lib/python3.6/site-packages/pyjector/pyjector.py", line 298, in handler
return self._command_handler(command, action)
File "/home/carsten/home-assistant/lib/python3.6/site-packages/pyjector/pyjector.py", line 255, in _command_handler
response = self.get_response()
File "/home/carsten/home-assistant/lib/python3.6/site-packages/pyjector/pyjector.py", line 311, in get_response
response += self._recv(1)
TypeError: must be str, not bytes
I use the following test script under python 3.6:
from pyjector.pyjector import Pyjector
# Look up what port your projector is connected to, using something
# like `dmesg` if you're on linux.
port = '/dev/ttyUSB0'
# The only valid device id at the moment is `benq`. This is used
# to figure out what commands are supported, and the format needed.
device_id = 'benq'
pyjector = Pyjector(port=port, device_id=device_id)
# Let's check what commands claim to be supported by our device.
#print(pyjector.command_list)
# Let's check the actions associated with each command
#print(pyjector.command_spec)
# Turn the projector on
#pyjector.power('on')
# We need to change the source, which are supported?
print(pyjector.get_actions_for_command('source'))
# Change the source to hdmi-2
pyjector.source('hdmi')
So unlike everybody else i dont have a USB Converter to go from USB to Serial Connection, im simply using the connector on the back of an old DELL laptop, (It has no other use to me currently)
It is loaded with Ubuntu Server 16.04 and has no outstanding issues to my knowledge, the Com Ports show up without any issues under dmesg
as shown below:
root@DELL-COM-PORT:~/pyjector# dmesg | grep tty
[ 0.000000] console [tty0] enabled
[ 2.340164] 00:07: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[ 4.754379] tty tty20: hash matches
But when i try and send anything to the Projector i get this error:
Traceback (most recent call last):
File "./pyjector_controller", line 21, in <module>
command(args.action)
File "/root/pyjector/pyjector/pyjector.py", line 298, in handler
return self._command_handler(command, action)
File "/root/pyjector/pyjector/pyjector.py", line 257, in _command_handler
self._check_response(response)
File "/root/pyjector/pyjector/pyjector.py", line 278, in _check_response
response
pyjector.pyjector.CommandFailedError: ('Received an unknown response', u'')
The projector is a Optoma H183X too
Any help would be great!
The command for high altitude mode has a syntax error:
"high_altitude_mode": {
"command": "Highaltitude",
"on": "on",
"off": "off",
"status": "?"
}
},
This is missing the line
"actions": {
from what i have gathered my serial connection is established and minicom verifies that its talking (i think, like you said kind of a weird program to understand) and i can do the ./pyjector_controller benq "/dev/ttyUSB0" power on , the termianl pauses for a sec like its sending the command but the projector still stays off. Also have tried to turn it off from an "on" state , but no luck either. Any help would be greatly appeciated!
I'm building a config for my epson projector but I have an issue the commands for status are without a separator. For example:
PWR ON\r -> powers the projector on
PWR OFF\r -> powers the projector off
PWR?\r -> gets the status
There is no space between PWR and ?.
Have you had this problem previously?
./pyjector_controller -d benq "/dev/ttyAMA0" power on
1452431094.313401 INFO send: '*pow=on#\r'
1452431094.315722 DEBUG _send: u'\r'
Traceback (most recent call last):
File "./pyjector_controller", line 21, in <module>
command(args.action)
File "/root/pyjector/pyjector/pyjector.py", line 298, in handler
return self._command_handler(command, action)
File "/root/pyjector/pyjector/pyjector.py", line 252, in _command_handler
self._do_handshake()
File "/root/pyjector/pyjector/pyjector.py", line 227, in _do_handshake
self._send(h['send'])
File "/root/pyjector/pyjector/pyjector.py", line 215, in _send
self.serial.write(data)
File "/usr/lib/python2.7/site-packages/serial/serialposix.py", line 491, in write
d = to_bytes(data)
File "/usr/lib/python2.7/site-packages/serial/serialutil.py", line 76, in to_bytes
b.append(item) # this one handles int and str for our emulation and ints for Python 3.x
TypeError: an integer or string of size 1 is required
When I inserted .encode('ascii')
it started working.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.