<reponame>Dgragnolati/HAP-python
"""An example of how to setup and start an Accessory.

This is:
1. Create the Accessory object you want.
2. Add it to an AccessoryDriver, which will advertise it on the local network,
    setup a server to answer client queries, etc.
"""
import logging
import signal
import random

from pyhap.accessory import Accessory, Bridge
from pyhap.accessory_driver import AccessoryDriver
import pyhap.loader as loader
from pyhap import camera
from accessories.PlantLove import PlantLoveAccessory

logging.basicConfig(level=logging.DEBUG, format="[%(module)s] %(message)s")


def get_accessory(driver):
    """Call this method to get a standalone Accessory."""
    return PlantLoveAccessory(driver,"Plant Love")


# Start the accessory on port 51826
driver = AccessoryDriver(port=51826)

# Change `get_accessory` to `get_bridge` if you want to run a Bridge.
driver.add_accessory(accessory=get_accessory(driver))

# We want SIGTERM (terminate) to be handled by the driver itself,
# so that it can gracefully stop the accessory, server and advertising.
signal.signal(signal.SIGTERM, driver.signal_handler)

# Start it!
driver.start()

"""An example of how to setup and start an Accessory.

This is:
1. Create the Accessory object you want.
2. Add it to an AccessoryDriver, which will advertise it on the local network,
    setup a server to answer client queries, etc.
"""
import logging
import signal
import random

from pyhap.accessory import Accessory, Bridge
from pyhap.accessory_driver import AccessoryDriver
import pyhap.loader as loader
from pyhap import camera
from accessories.PlantLove import PlantLoveAccessory

logging.basicConfig(level=logging.DEBUG, format="[%(module)s] %(message)s")


def get_accessory(driver):
    """Call this method to get a standalone Accessory."""
    return PlantLoveAccessory(driver,"Plant Love")


# Start the accessory on port 51826
driver = AccessoryDriver(port=51826)

# Change `get_accessory` to `get_bridge` if you want to run a Bridge.
driver.add_accessory(accessory=get_accessory(driver))

# We want SIGTERM (terminate) to be handled by the driver itself,
# so that it can gracefully stop the accessory, server and advertising.
signal.signal(signal.SIGTERM, driver.signal_handler)

# Start it!
driver.start()
An example of how to setup and start an Accessory.  This is: 1. Create the Accessory object you want. 2. Add it to an AccessoryDriver, which will advertise it on the local network,     setup a server to answer client queries, etc. Call this method to get a standalone Accessory. # Start the accessory on port 51826 # Change `get_accessory` to `get_bridge` if you want to run a Bridge. # We want SIGTERM (terminate) to be handled by the driver itself, # so that it can gracefully stop the accessory, server and advertising. # Start it!