7 Commits
v0.1.2 ... main

Author SHA1 Message Date
d63ed10d44 Add sentry 2023-06-03 21:26:15 +02:00
a53ab8e209 Add py.typed 2023-02-28 23:13:41 +01:00
f69939f783 Add pre-commit 2023-02-28 22:51:50 +01:00
ce1d881c84 Add pre commit 2023-02-28 22:45:14 +01:00
0cb91e268d Version bump 2023-02-28 21:19:17 +01:00
2ece5d2bee Added method for projector sleep 2023-02-28 21:18:12 +01:00
24ef94cce9 Add Done badge 2022-11-12 21:52:27 +01:00
12 changed files with 897 additions and 696 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
.vscode/
### Generated by gibo (https://github.com/simonwhitaker/gibo) ### Generated by gibo (https://github.com/simonwhitaker/gibo)
### https://raw.github.com/github/gitignore/e5323759e387ba347a9d50f8b0ddd16502eb71d4/Python.gitignore ### https://raw.github.com/github/gitignore/e5323759e387ba347a9d50f8b0ddd16502eb71d4/Python.gitignore

View File

@@ -2,22 +2,20 @@
# See https://pre-commit.com/hooks.html for more hooks # See https://pre-commit.com/hooks.html for more hooks
repos: repos:
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0 rev: v3.2.0
hooks: hooks:
- id: trailing-whitespace - id: trailing-whitespace
- id: end-of-file-fixer - id: end-of-file-fixer
- id: check-yaml - id: check-yaml
- id: check-toml
- id: check-added-large-files - 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 - repo: https://github.com/python-poetry/poetry
rev: 1.2.0b2 rev: 1.4.0 # add version here
hooks: hooks:
- id: poetry-check - id: poetry-check
- id: poetry-lock - id: poetry-lock
- id: poetry-export - id: poetry-export
args: ["-f", "requirements.txt", "-o", "requirements.txt"] args: ["-f", "requirements.txt", "-o", "requirements.txt"]
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black

View File

@@ -1,3 +1,5 @@
[![Build Status](https://drone.marijndoeve.nl/api/badges/Marijn/ProjectorPi/status.svg)](https://drone.marijndoeve.nl/Marijn/ProjectorPi)
# 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. 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.

1516
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "ProjectorPi" name = "ProjectorPi"
version = "0.1.2" version = "0.3.0"
description = "" description = ""
authors = ["Marijn Doeve <marijn@doeve.me>"] authors = ["Marijn Doeve <marijn@doeve.me>"]
license = "GPL-3.0-or-later" license = "GPL-3.0-or-later"
@@ -11,6 +11,7 @@ projectorpi = "projectorpi.cli:main"
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.9" python = "^3.9"
pyserial = "^3.5" pyserial = "^3.5"
sentry-sdk = "^1.25.0"
[tool.poetry.dev-dependencies] [tool.poetry.dev-dependencies]
black = "*" black = "*"

View File

@@ -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" \ pyserial==3.5 ; python_version >= "3.9" and python_version < "4.0" \
--hash=sha256:3c77e014170dfffbd816e6ffc205e9842efb10be9f58ec16d3e8675b4925cddb \ --hash=sha256:3c77e014170dfffbd816e6ffc205e9842efb10be9f58ec16d3e8675b4925cddb \
--hash=sha256:c4451db6ba391ca6ca299fb3ec7bae67a5c55dde170964c7a14ceefec02f2cf0 --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

View File

@@ -5,6 +5,16 @@ from time import sleep
from .projector import ProjectorSerial from .projector import ProjectorSerial
from .extron import ExtronSerial 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 verbose = False

View File

@@ -46,7 +46,7 @@ class ExtronSerial(SerialDevice):
return response return response
def check_sleep(self) -> str: def _check_sleep(self) -> str:
return self.send_command(C("PSAV")) return self.send_command(C("PSAV"))
def sleep(self) -> None: def sleep(self) -> None:
@@ -59,7 +59,7 @@ class ExtronSerial(SerialDevice):
self.send_command(f"{input}!") self.send_command(f"{input}!")
def is_sleeping(self) -> bool: def is_sleeping(self) -> bool:
response = self.check_sleep response = self._check_sleep()
return bool(int(response)) return bool(int(response))

View File

@@ -25,3 +25,6 @@ class ProjectorSerial(SerialDevice):
def power_off(self) -> None: def power_off(self) -> None:
self.send_command("POF") self.send_command("POF")
def is_on(self) -> bool:
return self.send_command("QPW") == "001"

0
src/projectorpi/py.typed Normal file
View File

View File

@@ -12,7 +12,6 @@ class SerialDevice:
self.prefix = "" self.prefix = ""
def send_command(self, command: str) -> str: def send_command(self, command: str) -> str:
with Serial(self.serial_port, self.baudrate, timeout=3) as s: with Serial(self.serial_port, self.baudrate, timeout=3) as s:
if self.verbose: if self.verbose:
print(self.prefix, "send:", command) print(self.prefix, "send:", command)