コード例 #1
0
def update_bulb(bulb):
    smartBulb = SmartBulb(bulb.ipAddr)
    if bulb.onOff:
        smartBulb.turn_on()
    else:
        smartBulb.turn_off()
    if smartBulb.is_color:
        hsv = rgb2hsv(int(bulb.rgbColor[0:2], 16), int(bulb.rgbColor[2:4], 16),
                      int(bulb.rgbColor[4:6], 16))
        smartBulb.hsv = hsv

    smartBulb.brightness = bulb.brightness
コード例 #2
0
ファイル: Switch.py プロジェクト: halpet/TPlink
from pyHS100 import SmartPlug, SmartBulb
from pprint import pformat as pf

# plug = SmartPlug("192.168.31.99")
# print("Hardware: %s" % pf(plug.hw_info))
# print("Full sysinfo: %s" % pf(plug.get_sysinfo())) # this prints lots of information about the device
#
#
# print("Current state: %s" % plug.state)
# plug.turn_on()
#
# print("Current time: %s" % plug.time)
#
#
# print("Current LED state: %s" % plug.led)
# plug.led = False # turn off led
# print("New LED state: %s" % plug.led)

bulb = SmartBulb("192.168.31.100")

print(bulb.brightness)
if bulb.is_dimmable:
    bulb.brightness = 100

bulb.turn_on()

#print("Hardware: %s" % pf(bulb.hw_info))
#print("Full sysinfo: %s" % pf(bulb.get_sysinfo()))  # this prints lots of information about the device
print(bulb.is_on)
コード例 #3
0
def bulb_turn_on(bulb):
    smartBulb = SmartBulb(bulb.ipAddr)
    smartBulb.turn_on()
    bulb.onOff = True
    bulb.save()
コード例 #4
0
  h = r.random() * 270
  h = int(h)
          #h = 100
  s = r.random() * 100
  s = int(s)
  s = 100
  for y in range(1,4):
    for x in range(17,25):
    #for x in range(1,35):
        addr = "10.66."+str(y)+"."+str(x)
        print(addr)
        if ( ( x == 24 ) & (y == 1 ) ):
            pass
        else:
         try:
          b = SmartBulb(addr)
          b.turn_on()
#          b.turn_off()
#          b.turn_off()
#          b.turn_off()
#          b.turn_off()
          #s = 100
          b.hsv = (h,s, 100)
         except:
          pass
  print(i)
  i += 1
  t.sleep(1.0)


コード例 #5
0
ファイル: controlDevices.py プロジェクト: flyingtad/MagicWand
 def tpBulbOn(self, ip):
     bulb = SmartBulb(ip)
     bulb.turn_on()