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
importasynciofromafsapiimportAFSAPIURL='http://192.168.1.XYZ:80/device'PIN=1234TIMEOUT=1# in secondsasyncdeftest():
afsapi=awaitAFSAPI.create(URL, PIN, TIMEOUT)
print(f'Set power succeeded? - {awaitafsapi.set_power(True)}' )
print(f'Power on: {awaitafsapi.get_power()}')
print(f'Friendly name: {awaitafsapi.get_friendly_name()}')
formodeinawaitafsapi.get_modes():
print(f'Available Mode: {mode}')
print(f'Current Mode: {awaitafsapi.get_mode()}')
forequaliserinawaitafsapi.get_equalisers():
print(f'Equaliser: {equaliser}')
print(f'EQ Preset: {awaitafsapi.get_eq_preset()}' )
forpresetinawaitafsapi.get_presets():
print(f"Preset: {preset}")
print(f'Set power succeeded? - {awaitafsapi.set_power(False)}')
print(f'Set sleep succeeded? - {awaitafsapi.set_sleep(10)}')
print(f'Sleep: {awaitafsapi.get_sleep()}')
print(f'Get power {awaitafsapi.get_power()}' )
loop=asyncio.new_event_loop()
loop.run_until_complete(test())