Asynchronous Implementation of the Frontier Silicon API
Project description
python-afsapi
Asynchronous Python implementation of the Frontier Silicon API
- This project was started in order to embed Frontier Silicon devices in Home Assistant (https://home-assistant.io/)
- Inspired by:
- https://github.com/flammy/fsapi/
- https://github.com/tiwilliam/fsapi
- https://github.com/p2baron/fsapi
Required python libs:
- requests
Usage
import asyncio
from afsapi import AFSAPI
URL = 'http://192.168.1.XYZ:80/device'
PIN = 1234
TIMEOUT = 1 # in seconds
async def test():
afsapi = await AFSAPI.create(URL, PIN, TIMEOUT)
print(f'Set power succeeded? - {await afsapi.set_power(True)}' )
print(f'Power on: {await afsapi.get_power()}')
print(f'Friendly name: {await afsapi.get_friendly_name()}')
for mode in await afsapi.get_modes():
print(f'Available Mode: {mode}')
print(f'Current Mode: {await afsapi.get_mode()}')
for equaliser in await afsapi.get_equalisers():
print(f'Equaliser: {equaliser}')
print(f'EQ Preset: {await afsapi.get_eq_preset()}' )
for preset in await afsapi.get_presets():
print(f"Preset: {preset}")
print(f'Set power succeeded? - {await afsapi.set_power(False)}')
print(f'Set sleep succeeded? - {await afsapi.set_sleep(10)}')
print(f'Sleep: {await afsapi.get_sleep()}')
print(f'Get power {await afsapi.get_power()}' )
loop = asyncio.new_event_loop()
loop.run_until_complete(test())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
afsapi-0.2.8.tar.gz
(17.3 kB
view details)
Built Distribution
File details
Details for the file afsapi-0.2.8.tar.gz
.
File metadata
- Download URL: afsapi-0.2.8.tar.gz
- Upload date:
- Size: 17.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5366628cf606f1cd484f0d811e07008e00156d84e01a594a2a4270bb727c5c4 |
|
MD5 | 8d25e8ab7d9f397e5eed1dbc0d5d3887 |
|
BLAKE2b-256 | 56e2caf1b30e0b06460fe326978525c2b82274eabf8953c76aa24e8b6e6e7adb |
File details
Details for the file afsapi-0.2.8-py2.py3-none-any.whl
.
File metadata
- Download URL: afsapi-0.2.8-py2.py3-none-any.whl
- Upload date:
- Size: 15.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0cf57b2b99cc3ff9f0bb516d72a79e09833976a8933ecec16961001378486aa5 |
|
MD5 | 24946d9942fcfb2d5f11f1fa1e22ea69 |
|
BLAKE2b-256 | a1c73073066f8af44e35d4df316e51db3ebb7e1ada484fb4a27eb76b1138d2c2 |