pszafer / epson_projector Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Hello,
In const.py, BUSY is defined as integer 2 and not as string “02” like for instance PWR_OFF_STATE (“04”). This makes tests fail when comparing to that state. I can do a pull request for this but might be faster if it is directly fixed in the source code.
L.
This is when using the testing
branch on HA 0.113.3.
HA Traceback:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 272, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 463, in async_device_update
await self.async_update() # type: ignore
File "/usr/src/homeassistant/homeassistant/components/epson/media_player.py", line 142, in async_update
is_turned_on = await self._projector.get_property(POWER)
File "/usr/local/lib/python3.8/site-packages/epson_projector/main.py", line 53, in get_property
if self._lock.checkLock():
File "/usr/local/lib/python3.8/site-packages/epson_projector/lock.py", line 40, in checkLock
self.__unLock()
AttributeError: 'Lock' object has no attribute '_Lock__unLock'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 125, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1281, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1316, in _execute_service
await handler.func(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 208, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 454, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 595, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 485, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/epson/media_player.py", line 181, in async_turn_off
await self._projector.send_command(TURN_OFF)
File "/usr/local/lib/python3.8/site-packages/epson_projector/main.py", line 61, in send_command
if self._lock.checkLock():
File "/usr/local/lib/python3.8/site-packages/epson_projector/lock.py", line 40, in checkLock
self.__unLock()
AttributeError: 'Lock' object has no attribute '_Lock__unLock'
Basically LUMINANCE indicates the light "emit power" and at least on my projector has two modes: Eco(01) and Normal(00) .
Something in the lines of seems to be working, though not sure of the const.py structure
diff --git a/epson_projector/const.py b/epson_projector/const.py
index 17f2330..e0be19f 100644
--- a/epson_projector/const.py
+++ b/epson_projector/const.py
@@ -18,6 +18,7 @@ GET_CR = "?"+CR
POWER = "PWR"
CMODE = "CMODE"
+LUMINANCE = "LUMINANCE"
SOURCE = "SOURCE"
VOLUME = "VOLUME"
MUTE = "MUTE"
@@ -57,6 +58,7 @@ EPSON_KEY_COMMANDS = {
"PWR": [('jsoncallback', 'PWR?')],
"SOURCE": [('jsoncallback', 'SOURCE?')],
"CMODE": [('jsoncallback', 'CMODE?')],
+ "LUMINANCE": [('jsoncallback', 'LUMINANCE?')],
"VOLUME": [('jsoncallback', 'VOL?')],
"CMODE_AUTO": [('CMODE', '00')],
"CMODE_CINEMA": [('CMODE', '15')],
@@ -77,6 +79,8 @@ EPSON_KEY_COMMANDS = {
"CMODE_THEATRE": [('CMODE', '05')],
"CMODE_THEATREBLACK": [('CMODE', '09')],
"CMODE_THEATREBLACK2": [('CMODE', '0A')],
+ "LUMINANCE_ECO": [('LUMINANCE', '01')],
+ "LUMINANCE_NORMAL": [('LUMINANCE', '00')],
"VOL_UP": [('KEY', '56')],
"VOL_DOWN": [('KEY', '57')],
"MUTE": [('KEY', 'D8')],
Hey first of all thanks for making this in the first place and now for the integration.
Super easy to set it up now.
Unfortunately it still seems to timeout after 10 seconds and does not retry so I am still forced to edit the code by hand after any hass updates.
I know the kodi media player supports this configurable timeout value since I had problems with the 5 second default there. Once I set 30 seconds as the timeout it always connects.
"version": 1,
"domain": "kodi",
"title": "Kodi",
"data": {
"name": "kodi",
"host": "kodi.local",
"port": 8080,
"ws_port": 9090,
"username": null,
"password": null,
"ssl": false,
"timeout": 30
To workaround this I now edit 2 files. I changed main and it worked but then it didn't so I changed projector_tcp as well and it seems to work.
epson_projector/main.py - timeout_scale=1.0 -> timeout_scale=3.0
epson_projector/projector_tcp.py - async_timeout.timeout(10) -> async_timeout.timeout(30)
Restart hass and my projector is back.
Would it be possible to add support for the older Epson projectors that have a serial connection instead of network (e.g. EH-TW3200) ?
The protocol is the same otherwise (also ESC/VP21).
It seems that Epson chose to disable the HTTP interface on their newer models, and so the default HA integration doesn't work at all. I hacked it to use the TCP mode and that somewhat works, but there are a few other weird things going on, that I don't fully understand. Like why does the serial fetch happen on a different port than the rest of the TCP connection? My projector does not have it open:
nmap -p 0-5000 projector
Starting Nmap 7.80 ( https://nmap.org ) at 2022-07-16 00:14 EDT
Nmap scan report for projector (10.x.x.x)
Host is up (0.00092s latency).
Not shown: 4999 closed ports
PORT STATE SERVICE
3629/tcp open escvpnet
4352/tcp open pjlink
It seems to respond fine on the regular port (3629) to the SNO command, even when power is off -- so that check seems unnecessary as well.
My LS500 doesn't seem to show all the available features, namely color mode. It's correctly able to turn it off/on, manipulate the volume and it's able to "get" source but not able to "set" source.
Color Mode is changeable in the iProjection app, and openHAB is also playing ball with it so I don't think it's a particularly funky control on my end.
I'm just using what's in core on HassOS so uh, if you think it should go in that issues register happy to copy it over.
@Icexist can you test new integration -> this branch https://github.com/pszafer/core/tree/epson_integration
I'd be grateful if you could do a release with the Serial & TCP support that appears to have been present in the code for some time. :) Are there any remaining issues with it? Can I help test it?
I was looking into adding support for it to the Home Assistant integration, but then found that the version 0.4.2 release doesn't have it yet. My older projector (EH-TW3200) doesn't yet have a LAN port.
Seems like the implementation is polling based, reading data only after sending a request and closing the connection after the timeout. I would like to see an option for an implementation that keeps the connection open to get pushes for changes.
Not sure if that's possible over HTTP, but definitely should be possible using TCP sockets for the latest home cinema series epson projectors. I implemented this successfully in hubitat https://github.com/amosyuen/hubitat/blob/main/epson/Epson%20Projector.groovy.
Happy to help with code, but am unfamiliar with python async code.
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.