Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new features #5

Open
wants to merge 34 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
5b382f6
feat: add new features
iloveicedgreentea Aug 27, 2024
96f5d91
feat: implement nz800 protocol
iloveicedgreentea Aug 27, 2024
345cd34
feat: use consts for commands and values, send command
iloveicedgreentea Aug 27, 2024
c094768
feat: add functional test
iloveicedgreentea Aug 28, 2024
8c15f39
fix: comments
iloveicedgreentea Aug 28, 2024
f879209
fix: check for none also
iloveicedgreentea Oct 1, 2024
8d1a952
rebase, fix tests
iloveicedgreentea Oct 1, 2024
9fa474b
catch index error
iloveicedgreentea Oct 1, 2024
6048cbb
fix: address comments
iloveicedgreentea Oct 17, 2024
4b46f58
Update jvcprojector/device.py
iloveicedgreentea Oct 17, 2024
396e696
Update jvcprojector/projector.py
iloveicedgreentea Oct 17, 2024
7bdfb13
Update jvcprojector/projector.py
iloveicedgreentea Oct 17, 2024
5d1e03b
fix: dead code
iloveicedgreentea Oct 17, 2024
8d917a9
fix: unused import
iloveicedgreentea Oct 17, 2024
00121f1
fix: error on mac
iloveicedgreentea Oct 17, 2024
e3820d9
fix: improve info command
iloveicedgreentea Oct 30, 2024
d2535f5
dont use none values, remove unused
iloveicedgreentea Nov 22, 2024
61faf5e
support human commands for HA support
iloveicedgreentea Nov 22, 2024
289b4cf
dynamically generate commands and values
iloveicedgreentea Nov 24, 2024
8f46697
use more consts
iloveicedgreentea Nov 24, 2024
dddd8b3
process model code
iloveicedgreentea Nov 24, 2024
b3b2e03
process version
iloveicedgreentea Nov 24, 2024
e4529ae
add test to make
iloveicedgreentea Nov 24, 2024
bc42841
add dev setup
iloveicedgreentea Nov 24, 2024
faa50f0
add mypy, fix all ruff and mypy issues, tests passing
iloveicedgreentea Nov 24, 2024
84ed194
fix imports
iloveicedgreentea Nov 24, 2024
788be2c
fix imports
iloveicedgreentea Nov 24, 2024
9925091
revert name change
iloveicedgreentea Nov 24, 2024
4ac978c
try fix for timeouts warning
iloveicedgreentea Nov 28, 2024
45cdab3
fix hidden bug with is_refresh
iloveicedgreentea Nov 28, 2024
2cbb857
fix the fix
iloveicedgreentea Nov 28, 2024
7a8c20e
fix display of options
iloveicedgreentea Nov 28, 2024
f32646d
actually this order cant change
iloveicedgreentea Nov 28, 2024
cd5a9e8
add missing graphic mode, add const for hdr values
iloveicedgreentea Dec 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.7
hooks:
- id: ruff
- id: ruff-format
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.7
hooks:
- id: ruff
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0 # Use the latest version
hooks:
- id: mypy
files: ^jvcprojector/
args: [--namespace-packages, --explicit-package-bases, --ignore-missing-imports ]
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
all: clean build

build:
rm -rf dist
python3 -m build
python -m twine upload -u __token__ dist/*

dev-setup:
python -m venv .venv && \
. .venv/bin/activate && \
pip install -r requirements_dev.txt && \
pip install -r requirements.txt && \
echo "Dev setup complete. Run 'source .venv/bin/activate' to activate the virtual environment and pre-commit install."

clean:
rm -rf dist
rm -rf dist

test:
coverage run --source jvcprojector --module pytest && coverage report --show-missing
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,23 @@ https://pypi.org/project/pyjvcprojector/
A full reference to the available commands is available from JVC here
http://pro.jvc.com/pro/attributes/PRESENT/Manual/External%20Command%20Spec%20for%20D-ILA%20projector_V3.0.pdf.

### Commands
* `JvcCommandHelpers.get_available_commands()` return an object containing all available commands.
* `JvcCommandHelpers.get_command_help("picture_mode")` return human readable help for a given command.

### Convenience functions:
* `JvcProjector::power_on()` turns on power.
* `JvcProjector::power_off()` turns off power.
* `JvcProjector::get_power()` gets power state (_standby, on, cooling, warming, error_)
* `JvcProjector::is_on()` returns True if the power is on and ready
* `JvcProjector::get_input()` get current input (_hdmi1, hdmi2_).
* `JvcProjector::get_signal()` get signal state (_signal, nosignal_).
* `JvcProjector::get_state()` returns {_power, input, signal_}.
* `JvcProjector::get_info()` returns {_model, mac address_}.

### Send supported commands
* `JvcProjector::send_command(cmd, val)` where cmd is a top level key from `JvcCommandHelpers.get_available_commands()` such as `laser_power` and val is a valid option found in the `values` key. For example, `clear_motion_drive, low`.

### Send remote control codes
A wrapper for calling `JvcProjector::op(f"RC{code}")`
* `JvcProjector::remote(code)` sends remote control command.
Expand Down Expand Up @@ -48,10 +56,10 @@ async def main():
print("Projector info:")
print(await jp.get_info())

if await jp.get_power() != const.ON:
if not await jp.is_on():
await jp.power_on()
print("Waiting for projector to warmup...")
while await jp.get_power() != const.ON:
while not await jp.is_on():
await asyncio.sleep(3)

print("Current state:")
Expand All @@ -74,9 +82,9 @@ async def main():
print(await jp.ref("PMPM"))

#
# Example sending operation command (writes value to function)
# Example sending operation command
#
# await jp.ref("PMPM01") # Sets picture mode to Film
await jp.send_command(const.CMD_PICTURE_MODE_LASER_POWER, const.VAL_LASER_POWER[1])

await jp.disconnect()
```
Expand Down
1 change: 1 addition & 0 deletions examples/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# type: ignore
7 changes: 5 additions & 2 deletions examples/simple.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# type: ignore
"""simple example"""

import asyncio
import logging

Expand All @@ -14,10 +17,10 @@ async def main():
print("Projector info:")
print(await jp.get_info())

if await jp.get_power() != const.ON:
if not await jp.is_on():
await jp.power_on()
print("Waiting for projector to warmup...")
while await jp.get_power() != const.ON:
while not await jp.is_on():
await asyncio.sleep(3)

print("Current state:")
Expand Down
8 changes: 0 additions & 8 deletions jvcprojector/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,4 @@

# ruff: noqa: F401

from .error import (
JvcProjectorAuthError,
JvcProjectorCommandError,
JvcProjectorConnectError,
JvcProjectorError,
)
from .projector import JvcProjector

__version__ = "1.1.2"
Loading