-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change from bluepy to bleak + bugfixes (#13)
- Loading branch information
Showing
27 changed files
with
1,914 additions
and
320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Lint | ||
|
||
on: pull_request | ||
|
||
concurrency: | ||
group: ${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
run-linting: | ||
name: Run linting | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Install linting dependencies | ||
run: | | ||
pip install black flake8 | ||
- name: Run linters | ||
uses: wearerequired/lint-action@v2 | ||
with: | ||
black: true | ||
flake8: true | ||
|
||
- uses: actions/checkout@v3 | ||
- uses: isort/[email protected] | ||
|
||
run-tests: | ||
name: Run tests | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.7", "3.8", "3.9", "3.10"] | ||
|
||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
|
||
- name: Install project | ||
run: poetry install --no-interaction | ||
|
||
- name: Run tests | ||
run: poetry run pytest | ||
|
||
publish-package: | ||
name: Publish package | ||
runs-on: ubuntu-latest | ||
needs: [run-linting, run-tests] | ||
|
||
steps: | ||
- name: Publish package | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI_UPLOAD_PASSWORD }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,3 +136,6 @@ dmypy.json | |
|
||
# Cython debug symbols | ||
cython_debug/ | ||
|
||
# vscode | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# PyFreshSky | ||
# pyfreshintellivent | ||
Python interface for Fresh Intellivent Sky bathroom Fan using Bluetooth Low Energy. | ||
|
||
This is a work in progress repository. Need help testing! | ||
|
||
## Documentation | ||
Check out the [Characteristics file](characteristics.md) file to read more about known characteristics. | ||
# Features | ||
* Supports Windows 10, version 16299 (Fall Creators Update) or greater | ||
* Supports Linux distributions with BlueZ >= 5.43 | ||
* OS X/macOS support via Core Bluetooth API, from at least OS X version 10.11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import asyncio | ||
|
||
from pyfreshintellivent import scanner | ||
|
||
AUTHENTICATE_UUID = "4cad343a-209a-40b7-b911-4d9b3df569b2" | ||
SENSOR_UUID = "528b80e8-c47a-4c0a-bdf1-916a7748f412" | ||
|
||
|
||
async def main(): | ||
print("Scanning, please wait...") | ||
device = await scanner.scan() | ||
print(f"Found device: {device}") | ||
|
||
|
||
if __name__ == "__main__": | ||
asyncio.run(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import asyncio | ||
import sys | ||
|
||
from bleak import BleakClient, BleakScanner | ||
|
||
from pyfreshintellivent import FreshIntelliVent | ||
|
||
ADDRESS = "mac-address" | ||
|
||
|
||
async def main(): | ||
sky = FreshIntelliVent() | ||
try: | ||
device = await BleakScanner.find_device_by_address( | ||
device_identifier=ADDRESS, timeout=30.0 | ||
) | ||
|
||
if device is None: | ||
print("no matching device found, check the BLE address.") | ||
sys.exit(1) | ||
|
||
client = BleakClient(device) | ||
await client.connect() | ||
print("Connected") | ||
|
||
code = await sky.fetch_authentication_code(device=client) | ||
print(f"Authentication code: {bytes(code).hex()}") | ||
await client.disconnect() | ||
except Exception as e: | ||
print(e) | ||
finally: | ||
await sky.disconnect() | ||
|
||
|
||
asyncio.run(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import asyncio | ||
import platform | ||
|
||
from pyfreshintellivent import FreshIntelliVent | ||
|
||
ADDRESS = ( | ||
"mac-address" | ||
if platform.system() != "Darwin" | ||
else "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" | ||
) | ||
|
||
|
||
async def main(): | ||
sky = FreshIntelliVent() | ||
try: | ||
await sky.connect(address_or_ble_device=ADDRESS) | ||
await sky.authenticate(authentication_code="xxxxxxxx") | ||
|
||
sensors = await sky.get_sensor_data() | ||
print(f"Status: {sensors.as_dict()}") | ||
|
||
boost = await sky.get_boost() | ||
print(f"Boost: {boost}") | ||
|
||
constant_speed = await sky.get_constant_speed() | ||
print(f"Constant speed: {constant_speed}") | ||
|
||
humidity = await sky.get_humidity() | ||
print(f"Humidity: {humidity}") | ||
|
||
light_and_voc = await sky.get_light_and_voc() | ||
print(f"Light and VOC: {light_and_voc}") | ||
|
||
pause = await sky.get_pause() | ||
print(f"Pause: {pause}") | ||
|
||
timer = await sky.get_timer() | ||
print(f"Timer: {timer}") | ||
except Exception as e: | ||
print(e) | ||
finally: | ||
await sky.disconnect() | ||
|
||
|
||
asyncio.run(main()) |
Oops, something went wrong.