Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
d63ed10d44
|
|||
|
a53ab8e209
|
|||
|
f69939f783
|
|||
|
ce1d881c84
|
|||
|
0cb91e268d
|
|||
|
2ece5d2bee
|
|||
| 24ef94cce9 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
.vscode/
|
||||
### Generated by gibo (https://github.com/simonwhitaker/gibo)
|
||||
### https://raw.github.com/github/gitignore/e5323759e387ba347a9d50f8b0ddd16502eb71d4/Python.gitignore
|
||||
|
||||
|
||||
@@ -1,23 +1,21 @@
|
||||
# See https://pre-commit.com for more information
|
||||
# See https://pre-commit.com/hooks.html for more hooks
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.3.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
- id: check-yaml
|
||||
- id: check-toml
|
||||
- id: check-added-large-files
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 22.3.0
|
||||
hooks:
|
||||
- id: black
|
||||
language_version: python3.9
|
||||
- repo: https://github.com/python-poetry/poetry
|
||||
rev: 1.2.0b2
|
||||
hooks:
|
||||
- id: poetry-check
|
||||
- id: poetry-lock
|
||||
- id: poetry-export
|
||||
args: ["-f", "requirements.txt", "-o", "requirements.txt"]
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v3.2.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
- id: check-yaml
|
||||
- id: check-added-large-files
|
||||
- repo: https://github.com/python-poetry/poetry
|
||||
rev: 1.4.0 # add version here
|
||||
hooks:
|
||||
- id: poetry-check
|
||||
- id: poetry-lock
|
||||
- id: poetry-export
|
||||
args: ["-f", "requirements.txt", "-o", "requirements.txt"]
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 23.1.0
|
||||
hooks:
|
||||
- id: black
|
||||
|
||||
2
Makefile
2
Makefile
@@ -2,4 +2,4 @@
|
||||
publish:
|
||||
poetry publish --build --repository gitea
|
||||
clean:
|
||||
find . -type f -name "*.py[co]" -delete -or -type d -name "__pycache__" -delete -or -type -name "dist" -delete
|
||||
find . -type f -name "*.py[co]" -delete -or -type d -name "__pycache__" -delete -or -type -name "dist" -delete
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
[](https://drone.marijndoeve.nl/Marijn/ProjectorPi)
|
||||
|
||||
# ProjectorPi
|
||||
|
||||
Projector is a personal tool I user to control my _Panasonic PT-RW330_ projector and _Extron IN1604 DTP_ scalar over serial using a Raspberry Pi.
|
||||
|
||||
## Build wheels
|
||||
|
||||
Building the project can be done using poetry.
|
||||
Building the project can be done using poetry.
|
||||
|
||||
```shell
|
||||
$ poetry build
|
||||
@@ -30,4 +32,4 @@ Put projector and scalar in sleep mode:
|
||||
|
||||
```shell
|
||||
$ projectorpi --sleep
|
||||
```
|
||||
```
|
||||
|
||||
1516
poetry.lock
generated
1516
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "ProjectorPi"
|
||||
version = "0.1.2"
|
||||
version = "0.3.0"
|
||||
description = ""
|
||||
authors = ["Marijn Doeve <marijn@doeve.me>"]
|
||||
license = "GPL-3.0-or-later"
|
||||
@@ -11,6 +11,7 @@ projectorpi = "projectorpi.cli:main"
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.9"
|
||||
pyserial = "^3.5"
|
||||
sentry-sdk = "^1.25.0"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
black = "*"
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
certifi==2023.5.7 ; python_version >= "3.9" and python_version < "4.0" \
|
||||
--hash=sha256:0f0d56dc5a6ad56fd4ba36484d6cc34451e1c6548c61daad8c320169f91eddc7 \
|
||||
--hash=sha256:c6c2e98f5c7869efca1f8916fed228dd91539f9f1b444c314c06eef02980c716
|
||||
pyserial==3.5 ; python_version >= "3.9" and python_version < "4.0" \
|
||||
--hash=sha256:3c77e014170dfffbd816e6ffc205e9842efb10be9f58ec16d3e8675b4925cddb \
|
||||
--hash=sha256:c4451db6ba391ca6ca299fb3ec7bae67a5c55dde170964c7a14ceefec02f2cf0
|
||||
sentry-sdk==1.25.0 ; python_version >= "3.9" and python_version < "4.0" \
|
||||
--hash=sha256:5be3296fc574fa8a4d9b213b4dcf8c8d0246c08f8bd78315c6286f386c37555a \
|
||||
--hash=sha256:fe85cf5d0b3d0aa3480df689f9f6dc487de783defb0a95043368375dc893645e
|
||||
urllib3==2.0.2 ; python_version >= "3.9" and python_version < "4.0" \
|
||||
--hash=sha256:61717a1095d7e155cdb737ac7bb2f4324a858a1e2e6466f6d03ff630ca68d3cc \
|
||||
--hash=sha256:d055c2f9d38dc53c808f6fdc8eab7360b6fdbbde02340ed25cfbcd817c62469e
|
||||
|
||||
@@ -5,6 +5,16 @@ from time import sleep
|
||||
from .projector import ProjectorSerial
|
||||
from .extron import ExtronSerial
|
||||
|
||||
import sentry_sdk
|
||||
|
||||
sentry_sdk.init(
|
||||
dsn="https://4a9c016c11074639a16778c78709e402@sentry.marijndoeve.nl/2",
|
||||
# Set traces_sample_rate to 1.0 to capture 100%
|
||||
# of transactions for performance monitoring.
|
||||
# We recommend adjusting this value in production.
|
||||
traces_sample_rate=1.0,
|
||||
)
|
||||
|
||||
verbose = False
|
||||
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class ExtronSerial(SerialDevice):
|
||||
|
||||
return response
|
||||
|
||||
def check_sleep(self) -> str:
|
||||
def _check_sleep(self) -> str:
|
||||
return self.send_command(C("PSAV"))
|
||||
|
||||
def sleep(self) -> None:
|
||||
@@ -59,7 +59,7 @@ class ExtronSerial(SerialDevice):
|
||||
self.send_command(f"{input}!")
|
||||
|
||||
def is_sleeping(self) -> bool:
|
||||
response = self.check_sleep
|
||||
response = self._check_sleep()
|
||||
|
||||
return bool(int(response))
|
||||
|
||||
|
||||
@@ -25,3 +25,6 @@ class ProjectorSerial(SerialDevice):
|
||||
|
||||
def power_off(self) -> None:
|
||||
self.send_command("POF")
|
||||
|
||||
def is_on(self) -> bool:
|
||||
return self.send_command("QPW") == "001"
|
||||
|
||||
0
src/projectorpi/py.typed
Normal file
0
src/projectorpi/py.typed
Normal file
@@ -12,7 +12,6 @@ class SerialDevice:
|
||||
self.prefix = ""
|
||||
|
||||
def send_command(self, command: str) -> str:
|
||||
|
||||
with Serial(self.serial_port, self.baudrate, timeout=3) as s:
|
||||
if self.verbose:
|
||||
print(self.prefix, "send:", command)
|
||||
|
||||
Reference in New Issue
Block a user