yeelight fixes
This commit is contained in:
parent
179861a133
commit
993477ff35
@ -159,6 +159,7 @@ class Yeelight(object):
|
||||
print(device + ": Konnte nicht angesteuert werden")
|
||||
error = True
|
||||
finally:
|
||||
oldState = self.bulbs[device].get_properties()
|
||||
if(str(oldState['power']) != str(state)):
|
||||
if(state=="on"):
|
||||
self.bulbs[device].turn_on()
|
||||
@ -173,6 +174,7 @@ class Yeelight(object):
|
||||
except:
|
||||
print(device + ": Konnte nicht angesteuert werden")
|
||||
finally:
|
||||
oldState = self.bulbs[device].get_properties()
|
||||
if(str(oldState['power']) != str(state)):
|
||||
if(state=="on"):
|
||||
self.bulbs[device].turn_on()
|
||||
@ -182,10 +184,11 @@ class Yeelight(object):
|
||||
print(device + " turned off")
|
||||
try:
|
||||
oldState = self.bulbs[device].get_properties()
|
||||
if(oldState['power'] == str(state)):
|
||||
break
|
||||
except:
|
||||
print(device + " keine Veraenderung")
|
||||
finally:
|
||||
if(oldState['power'] == str(state)):
|
||||
break
|
||||
|
||||
##-----------------------------------------------------------------------------------##
|
||||
def brightness(self, device, group, state=None):
|
||||
@ -215,6 +218,7 @@ class Yeelight(object):
|
||||
print(device + ": Konnte nicht angesteuert werden")
|
||||
error = True
|
||||
finally:
|
||||
oldState = self.bulbs[device].get_properties()
|
||||
if(str(oldState['bright']) != str(state)):
|
||||
self.bulbs[device].set_brightness(int(state))
|
||||
print(device + " turned brightness to " + str(state))
|
||||
@ -225,15 +229,17 @@ class Yeelight(object):
|
||||
except:
|
||||
print(device + ": Konnte nicht angesteuert werden")
|
||||
finally:
|
||||
if(str(oldState['brigh']) != str(state)):
|
||||
oldState = self.bulbs[device].get_properties()
|
||||
if(str(oldState['bright']) != str(state)):
|
||||
self.bulbs[device].set_brightness(int(state))
|
||||
print(device + " turned brightness to " + str(state))
|
||||
try:
|
||||
oldState = self.bulbs[device].get_properties()
|
||||
if(oldState['bright'] == str(state)):
|
||||
break
|
||||
except:
|
||||
print(device + " keine Veraenderung")
|
||||
finally:
|
||||
if(oldState['bright'] == str(state)):
|
||||
break
|
||||
|
||||
##-----------------------------------------------------------------------------------##
|
||||
def temperature(self, device, group, state=None):
|
||||
@ -262,6 +268,7 @@ class Yeelight(object):
|
||||
print(device + ": Konnte nicht angesteuert werden")
|
||||
error = True
|
||||
finally:
|
||||
oldState = self.bulbs[device].get_properties()
|
||||
if(str(oldState['ct']) != str(state)):
|
||||
self.bulbs[device].set_color_temp(int(state))
|
||||
print(device + " turned temperature to " + str(state))
|
||||
@ -272,15 +279,17 @@ class Yeelight(object):
|
||||
except:
|
||||
print(device + ": Konnte nicht angesteuert werden")
|
||||
finally:
|
||||
oldState = self.bulbs[device].get_properties()
|
||||
if(str(oldState['ct']) != str(state)):
|
||||
self.bulbs[device].set_color_temp(int(state))
|
||||
print(device + " turned temperature to " + str(state))
|
||||
try:
|
||||
oldState = self.bulbs[device].get_properties()
|
||||
if(oldState['ct'] == str(state)):
|
||||
break
|
||||
except:
|
||||
print(device + " keine Veraenderung")
|
||||
finally:
|
||||
if(oldState['ct'] == str(state)):
|
||||
break
|
||||
|
||||
##-----------------------------------------------------------------------------------##
|
||||
def color(self, device, group, r, g, b):
|
||||
|
Reference in New Issue
Block a user