def SetMasterStatusLed(self, state):
    Domoticz.Debug("SetMasterStatusLed - UID:" + self.UIDList[UIDINDEXMASTER])
    try:
        # Create IP connection
        ipcon = IPConnection()
        # Create device object
        master = BrickMaster(self.UIDList[UIDINDEXMASTER], ipcon)
        # Connect to brickd
        ipcon.connect(Parameters["Address"], int(Parameters["Port"]))
        # Don't use device before ipcon is connected
        if state == 0:
            master.disable_status_led()
            Domoticz.Log("Master Status LED disabled.")

        if state == 1:
            master.enable_status_led()
            Domoticz.Log("Master Status LED enabled.")

        ipcon.disconnect()

        return 1

    except:
        # Error
        Domoticz.Log("[ERROR] Can not set Master Status LED.")
        return 0
Esempio n. 2
0
    mb1 = BrickMaster(UID_MB1, ipcon)  # Create device object
    mb2 = BrickMaster(UID_MB2, ipcon)  # Create device object

    ipcon.connect(HOST, PORT)  # Connect to brickd
    # Don't use device before ipcon is connected
    time.sleep(1)
    oled.clear_display()
    oled.write_line(1, 1, "Starting Application...")

    #***********Brick-Config********************************************
    if silent == True:
        mb1.disable_status_led()
        mb2.disable_status_led()
        oled.write_line(3, 1, "Mode: Silent")
    else:
        mb1.enable_status_led()
        mb2.enable_status_led()
        oled.write_line(3, 1, "Mode: Debug")

    #***********Dual-Relay-Config***************************************
    time.sleep(3)
    dr.set_state(False, False)
    oled.write_line(4, 1, "Dual Relay: OK")

    #***********Button-Config*******************************************
    time.sleep(10)
    rlb1.set_color(0, brightness, 0)  # Tor oben
    rlb2.set_color(brightness, 0, 0)  # Licht aus

    if silent == True:
        rlb1.set_status_led_config(rlb1.STATUS_LED_CONFIG_OFF)
Esempio n. 3
0
import time
import confs
from tinkerforge.ip_connection import IPConnection
from tinkerforge.brick_master import BrickMaster
from tinkerforge.bricklet_sound_pressure_level import BrickletSoundPressureLevel

# Create IP connection
ipcon = IPConnection()

# bricks and bricklets
master = BrickMaster(confs.MASTER_UID, ipcon)
spl = BrickletSoundPressureLevel(confs.SOUND_UID, ipcon)

# connect
ipcon.connect(confs.HOST, confs.PORT)

# turn on the leds

master.enable_status_led()
spl.set_status_led_config(1)

# sleepa while
time.sleep(10)

# turn them off
master.disable_status_led()
spl.set_status_led_config(0)

# when done dsiconnect
ipcon.disconnect()