(#27) - Home Automation, Lights and Normal People
Normal
Here's how normal people turn on the lights in the kitchen:Not Normal
And here's how people enamored with Home Automation turn on the lights in the kitchen:
- Fumble around in the dark, pull smartphone from pocket
- Swipe around until Home Automation App found, launch app
- Wait while Home Automation app starts
- Swipe around and find the Lighting Tab on the Home Automation app
- Swipe around and find the room labeled Kitchen
- Press the On button
And the industry wonders why adoption just won't take...
Still, that's far too simple and straight-forward for me, so continuing our TCP Connected Lighting Gateway programming from the last post, lets cover two of the four commands we use.
DeviceSendCommand
DeviceSendCommandLevel
To control individual bulbs, you use one of these two commands. The first turns a bulb on and off. The second command will set the dimming level.
#------------------------------------------------------------
def set_light_value(self, did, value=1, update=True):
rc = self.my_gateway.send_device_command(did, value)
if update:
self.load_rooms_and_devices()
return rc
#-----------------------------------------------------------
def set_light_level(self, did, level=100, update=True):
rc = self.my_gateway.send_device_command_level(did,level)
if update:
self.load_rooms_and_devices()
return rc
The two strings, DeviceSendCommand and DeviceSendLevelCommand were shown back here.
The last two commands of the four affect an entire room and they're used in the same manner:
RoomSendCommand
RoomSendCommandLevel
#------------------------------------------------------------
def set_room_value(self, rid, value=1, update=True):
rc = self.my_gateway.send_room_command(rid,value)
if update:
self.load_rooms_and_devices()
return rc
#------------------------------------------------------------
def set_room_level(self, rid, level=50,update=True):
rc = self.my_gateway.send_room_command_level(rid,level)
if update:
self.load_rooms_and_devices()
return rc
No comments :
Post a Comment