February 2022
Intermediate to advanced
182 pages
4h 25m
English
Create a smartplugtest.py file, and replace the YOUR_HUE_BRIDGE_IP_GOES_HERE and the Fan identifiers with the IP address and Hue name of the device in your environment:
| | from phue import Bridge |
| | import time |
| | |
| | huebridge = Bridge('YOUR_HUE_BRIDGE_IP_GOES_HERE') |
| | |
| ① | huebridge.set_light('Fan','on', True) |
| | time.sleep(10) |
| ② | huebridge.set_light('Fan','on', False) |
Power on the device by calling the set_light() function with the name of the device you want to control (in this case, Fan), and setting its value to True.
After waiting ten seconds, the set_light() function is called again, this time setting the Fan device to False to turn it off.
Be near the fan or whatever other ...
Read now
Unlock full access