Skip to content
This repository has been archived by the owner on Sep 7, 2022. It is now read-only.

Latest commit

 

History

History
62 lines (39 loc) · 1.38 KB

README.md

File metadata and controls

62 lines (39 loc) · 1.38 KB

pybuspro - A Buspro Library Written in Python

This repository has been archived. Go to https://github.com/eyesoft/home_assistant_buspro/.

Documentation

See documentation at: https://github.com/eyesoft/pybuspro/docs/.

Home-Assistant Plugin

pybuspro contains a Plugin for the Home-Assistant automation plattform.

Installation

pip3 install pybuspro

Example

"""Example for switching a light on and off."""
import asyncio

from pybuspro.buspro import Buspro
from pybuspro.devices.light import Light

GATEWAY_ADDRESS_SEND_RECEIVE = (('127.0.0.1', 6000), ('', 6000))


def callback_all_messages(telegram):
    print(telegram)
    pass
    
    
async def main():
    """Connect to Buspro bus, switch on light, wait 2 seconds and switch of off again."""
    buspro = Buspro(GATEWAY_ADDRESS_SEND_RECEIVE)
    # buspro.register_telegram_received_cb_2(callback_all_messages)
    await buspro.start()
    
    light = Light(buspro, device_address=(1, 100), channel_number=9, name="name of light")
    await light.set_on()
    await asyncio.sleep(2)
    await light.set_off()
    
    # await buspro.disconnect()


loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.run_forever()