Merge pull request #179 from tochev/feature-energy-cmd
Add energy option to broadlink_cli
This commit is contained in:
		
						commit
						75b323c640
					
				
					 3 changed files with 13 additions and 0 deletions
				
			
		| 
						 | 
					@ -74,6 +74,11 @@ Check power state on a SmartPlug:
 | 
				
			||||||
state = devices[0].check_power()
 | 
					state = devices[0].check_power()
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Check energy consumption on a SmartPlug:
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					state = devices[0].get_energy()
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Set power state for S1 on a SmartPowerStrip MP1:
 | 
					Set power state for S1 on a SmartPowerStrip MP1:
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
devices[0].set_power(1, True)
 | 
					devices[0].set_power(1, True)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -73,3 +73,8 @@ Get Temperature :
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
broadlink_cli --device @BEDROOM.device --temperature
 | 
					broadlink_cli --device @BEDROOM.device --temperature
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Get Energy Consumption (For a SmartPlug) :
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					broadlink_cli --device @BEDROOM.device --energy
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -68,6 +68,7 @@ parser.add_argument("--type", type=auto_int, default=0x2712, help="type of devic
 | 
				
			||||||
parser.add_argument("--host", help="host address")
 | 
					parser.add_argument("--host", help="host address")
 | 
				
			||||||
parser.add_argument("--mac", help="mac address (hex reverse), as used by python-broadlink library")
 | 
					parser.add_argument("--mac", help="mac address (hex reverse), as used by python-broadlink library")
 | 
				
			||||||
parser.add_argument("--temperature",action="store_true", help="request temperature from device")
 | 
					parser.add_argument("--temperature",action="store_true", help="request temperature from device")
 | 
				
			||||||
 | 
					parser.add_argument("--energy",action="store_true", help="request energy consumption from device")
 | 
				
			||||||
parser.add_argument("--check", action="store_true", help="check current power state")
 | 
					parser.add_argument("--check", action="store_true", help="check current power state")
 | 
				
			||||||
parser.add_argument("--checknl", action="store_true", help="check current nightlight state")
 | 
					parser.add_argument("--checknl", action="store_true", help="check current nightlight state")
 | 
				
			||||||
parser.add_argument("--turnon", action="store_true", help="turn on device")
 | 
					parser.add_argument("--turnon", action="store_true", help="turn on device")
 | 
				
			||||||
| 
						 | 
					@ -104,6 +105,8 @@ if args.convert:
 | 
				
			||||||
    print format_durations(durations)
 | 
					    print format_durations(durations)
 | 
				
			||||||
if args.temperature:
 | 
					if args.temperature:
 | 
				
			||||||
    print dev.check_temperature()
 | 
					    print dev.check_temperature()
 | 
				
			||||||
 | 
					if args.energy:
 | 
				
			||||||
 | 
					    print dev.get_energy()
 | 
				
			||||||
if args.sensors:
 | 
					if args.sensors:
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        data = dev.check_sensors()
 | 
					        data = dev.check_sensors()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue